feat(ocsf): carry structured events on sandbox log stream - #3104
feat(ocsf): carry structured events on sandbox log stream#3104krishicks wants to merge 1 commit into
Conversation
Review findings
|
Is this really the case? I know previously the supervisor was always using the latest image, but do we make any guarantees about using a newer supervisor with an older gateway? |
I think this should be done as a separate PR. Thoughts? |
I don't think we explicitly prevent this case. Maybe for pre-0.1.0 this doesn't matter. But I think the review agent was orienting around HA rolling upgrades where the mismatch could happen. |
4f2efeb to
362c556
Compare
362c556 to
6933e73
Compare
|
The |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
publish_security_log_event() computes the shorthand first but returns without emitting anything if to_json_line() fails. The receiving side deliberately keeps the text fallback when structured OCSF is bad, so the sender should preserve that contract and send the shorthand with empty ocsf_json on serialization failure instead of dropping the security event entirely. A forced-serialization-error test would pin this.
|
@zanetworker My current thinking is that doing the downgrade at the sandbox is not sufficient, or scalable, because we would need to support many potential downgrades, and there can be multiple destinations for OCSF events, including OTLP, a rotated log file, and others. Throwing away information at the sandbox to satisfy a single SIEM schema is suboptimal, I think. Someone at NVIDIA built a pretty comprehensive solution that correlates information from gateways and sandboxes, including OCSF events but also spans and other logs. This solution makes me think we should keep the gateway and sandbox implementation as simple as possible and rely on other tooling (like that solution) to do transformation of the data for various consumers. The architecture of that solution today looks like this: flowchart LR
A[OpenShell files] --> E[Exporter]
B[OpenShell read-only gRPC] --> E
C[Gateway and Relay OTLP] --> E
D[Kubernetes context] --> E
E --> P[Identify, validate, redact, correlate]
P --> Q1[Persistent CloudEvents queue]
P --> Q2[Persistent OTLP queues]
P --> R[Redacted recovery archive]
Q1 --> S[SIEM, security, data lake, policy system]
Q2 --> O[Observability backend]
I spiked having different kinds of exporters built into the gateway and I feel it expands the scope of the gateway too much, particularly given how critical OCSF events are. Instead, I think we should keep it simple and have the gateway create a durable record of OCSF events using the latest supported schema version and use something like the above tooling to read that stream, do any other relevant correlation, as well as necessary PII redaction, and forward it on to external consumers. That means all the queuing and retrying behavior that we'd want would exist in the other tool, not within the gateway. What do you think? |
Sandbox log streams now retain complete OCSF event payloads, allowing exporters and API consumers to use the original structured security and audit records without reconstructing them from display text. `openshell logs` continues to show readable shorthand, including across supported mixed-version deployments. Ordinary log lines and malformed or older structured payloads still display their original message instead of being dropped. Refs #1055 Signed-off-by: Kris Hicks <khicks@nvidia.com>
6933e73 to
2e2e2c8
Compare
Summary
Sandbox log streams now retain complete OCSF event payloads, allowing exporters and API consumers to use the original structured security and audit records without reconstructing them from display text.
openshell logscontinues to show readable shorthand, including across supported mixed-version deployments. Ordinary log lines and malformed or older structured payloads still display their original message instead of being dropped.Related Issue
#1055
Changes
Testing
mise run pre-commitpassesChecklist