Skip to content

bug(ocsf): top-level container is undefined in OCSF 1.8.0 event classes #4915

Open

Description

@zanetworker

User Story

As an operator sending OpenShell OCSF records to a SIEM or a strict OCSF consumer, I want every native record to pass OCSF 1.8.0 validation, so that strict consumers accept the records and I don't need a pipeline step to drop or move fields.

Problem Statement

Sandbox-associated OCSF records carry a top-level container object. OCSF 1.8.0 does not define container as an event-class attribute; it defines it only under the container profile on objects such as device and process. Every native record with a sandbox identity therefore fails validation:

{"error":"attribute_unknown","message":"Unknown attribute at \"container\"; attribute \"container\" is not defined in class \"ssh_activity\" uid 4007."}

(https://schema.ocsf.io/api/1.8.0/v2/validate, same result for Network Activity, Base Event and Device Config State Change.)

The in-repo schema validator skips this attribute through KNOWN_UNDEFINED_EVENT_ATTRIBUTES in crates/openshell-ocsf/src/validation/schema.rs, so the tests stay green while the official validator rejects it. #4288 makes the rest of the native output conformant and leaves container unchanged; this issue tracks that remaining gap.

Impact / Why This Matters

  • nano's strict OCSF validator rejects every native sandbox record, always on container alone (spike results).
  • Tenzir ocsf_cast and Cribl's Parquet writer drop the field silently, so sandbox identity is lost there.
  • The Cortex XSIAM OpenShell content pack (demisto/content PRs #46184 and #46275) reads top-level container.uid and container.name for sandbox attribution, so moving the field breaks that pack unless it is updated at the same time.

Acceptance Criteria

  • Native sandbox records pass https://schema.ocsf.io/api/1.8.0/v2/validate with no attribute_unknown error for container.
  • Sandbox identity (ID and name) stays available in a defined OCSF attribute, and the docs say where.
  • KNOWN_UNDEFINED_EVENT_ATTRIBUTES no longer lists container.
  • The XSIAM content pack maintainer is told about the change before it ships.

Suggested UX (if applicable)

Two options found so far:

  1. Nest it as device.container and declare the container profile. The image object then requires uid, so the emitter must set the image ID or omit image.
  2. Carry sandbox identity in unmapped or attributes only, and drop top-level container.

Option 1 keeps the data in a typed OCSF location.

Reproduction Steps

  1. Enable supervisor OCSF JSONL for a sandbox: openshell settings set <sandbox> --key ocsf_json_enabled --value true.
  2. Generate any activity, for example openshell sandbox exec --name <sandbox> -- true.
  3. POST any OCSF-JSON record to https://schema.ocsf.io/api/1.8.0/v2/validate.
  4. Observe attribute_unknown for container.

Environment

OpenShell 0.1.5 and main; any driver that emits sandbox-associated records.

Activity

  1. added
    state:acceptedA maintainer decided OpenShell should pursue this issue
    and removed
    state:triage-neededOpened without agent diagnostics and needs triage
    on Oct 26, 2026
  2. aeilot commented on Oct 27, 2026

    @aeilot

    Hi! I’d like to work on this issue. Would moving sandbox identity to device.container with the container profile be the preferred approach? I can also update the validation tests and documentation. Is anyone already working on it?

  3. krishicks commented on Oct 28, 2026

    @krishicks
    Collaborator

    Written by Claude Code, reviewed by @krishicks

    Thanks @aeilot. Nobody else is working on this, so go ahead. device.container with the container profile is the direction we'd like. Some things we found while looking into it:

    • Where container is allowed. In the 1.8.0 exports, container appears under device, process, network_endpoint and network_proxy, and only when the event declares the container profile. It's never a top-level class attribute. device.container is the natural home, because every builder already sets device.
    • image requires uid. OCSF's image object requires uid, but EventContext::container() (crates/openshell-ocsf/src/builders/mod.rs) sets only the image name, so moving the object as-is would still fail validation. Either fill image.uid from a real image ID or digest if one is available, or omit image when there isn't one. Please don't put the image reference in uid. container itself only needs name or uid, and we set both.
    • Gateway events. On gateway events, device is the gateway host. Putting the sandbox under device.container there would claim the gateway host runs the sandbox. For gateway events that concern a sandbox, resources (a resource_details with type sandbox) fits better. API Activity and Detection Finding define resources; Authentication doesn't, and it doesn't emit container today anyway. The profile choice in api_activity.rs and finding.rs keys off ctx.container(), so it will need to follow whatever you decide.
    • Single emission point. EventContext::apply_common_fields sets the top-level container for every builder, so the change is mostly there plus BaseEventData.
    • Validation. feat(ocsf): validate OCSF events against exported JSON Schemas #5019 replaces the hand-written validator with the JSON Schemas the OCSF server exports. Depending on which lands first, remove container from KNOWN_UNDEFINED_EVENT_ATTRIBUTES (crates/openshell-ocsf/src/validation/schema.rs), or remove the top-level container allowance in openshell-ocsf-validate. Either way, the schemas then check the container object itself. The Podman e2e test ocsf_jsonl_conformance validates real supervisor JSONL and is a good end-to-end check.
    • Docs. docs/observability/ocsf-json-export.mdx describes the top-level container and its exception. It should say where the sandbox ID and name live now.

    We'll let the XSIAM content pack maintainer know about the change (the last acceptance criterion), since that pack reads the top-level container.uid and container.name. Please mention in the PR when the new shape is final.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:acceptedA maintainer decided OpenShell should pursue this issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions