Skip to content

Commit ef9e9ec

Browse files
committed
fix(ocsf): emit schema-conformant OCSF 1.8 events
Native events failed the official OCSF 1.8.0 validator: HTTP Activity emitted is_src_dst_assignment_known, sandbox Process Activity events had no actor, connection_info lacked direction_id, and SSH Activity events named no endpoint. Schema tests missed these because they checked only top-level, non-profile attributes. Add a connection direction enum, require an actor on Process Activity and an endpoint on SSH Activity at compile time, name the supervisor's SSH server with svc_name and its socket path, set hostname on domain endpoints, and make schema validation recurse into nested objects, reject undefined attributes, and honour declared profiles. Keep it fixed with a Podman e2e test that validates the supervisor's real JSONL, schemas compiled into test binaries so archived runs need no source files, a production-like fallback context for producer tests, and documented schema update steps. Top-level container stays unchanged pending a decision on NVIDIA#4283. The schema downgrade is unchanged. Closes NVIDIA#4283 Signed-off-by: Adel Zaalouk <[email protected]>
1 parent b58e24c commit ef9e9ec

28 files changed

Lines changed: 1520 additions & 136 deletions

File tree

‎crates/openshell-ocsf/schemas/ocsf/README.md‎

Lines changed: 56 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/openshell-ocsf/schemas/ocsf/v1.8.0/objects/network_connection_info.json‎

Lines changed: 230 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/openshell-ocsf/src/builders/http.rs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'a> HttpActivityBuilder<'a, MissingHttpContext> {
4242
/// be built.
4343
///
4444
/// ```compile_fail
45-
/// use openshell_ocsf::{EventContext, HttpActivityBuilder};
45+
/// use openshell_ocsf::{EventContext, EventOrigin, HttpActivityBuilder};
4646
///
4747
/// let ctx = EventContext {
4848
/// sandbox_id: String::new(),
@@ -52,6 +52,7 @@ impl<'a> HttpActivityBuilder<'a, MissingHttpContext> {
5252
/// product_version: String::new(),
5353
/// proxy_ip: "127.0.0.1".parse().unwrap(),
5454
/// proxy_port: 3128,
55+
/// origin: EventOrigin::Supervisor,
5556
/// };
5657
/// HttpActivityBuilder::new(&ctx).build();
5758
/// ```
@@ -254,7 +255,6 @@ impl HttpActivityBuilder<'_, HasHttpContext> {
254255
action: self.action,
255256
disposition: self.disposition,
256257
observation_point_id: Some(2),
257-
is_src_dst_assignment_known: Some(true),
258258
})
259259
}
260260
}
@@ -286,6 +286,8 @@ mod tests {
286286
assert_eq!(json["activity_name"], "Get");
287287
assert_eq!(json["http_request"]["http_method"], "GET");
288288
assert_eq!(json["actor"]["process"]["name"], "curl");
289+
// HTTP Activity does not define this attribute in any OCSF version.
290+
assert!(json.get("is_src_dst_assignment_known").is_none());
289291
}
290292

291293
#[test]

0 commit comments

Comments
 (0)