feat(plugins): add ocsf-audit — OCSF API Activity emitter with attestation chain#128
Open
Levaj2000 wants to merge 2 commits into
Open
feat(plugins): add ocsf-audit — OCSF API Activity emitter with attestation chain#128Levaj2000 wants to merge 2 commits into
Levaj2000 wants to merge 2 commits into
Conversation
…ation chain
New builtin CMF plugin (audit/ocsf), a near-twin of audit-logger that
serializes each dispatched request as an OCSF API Activity event
(class 6003, ai_operation + security_control profiles) instead of a
free-form JSON line.
- Activity ids follow API Activity's real enum: resources/prompts and
readOnlyHint tools -> 2 (Read); other tool calls -> 99 (Other) +
activity_name; completions -> 99. Passive post-hook stream carries
action_id 3 (Observed) / disposition_id 17 (Logged); deny/modify
mapping waits on the framework decision event.
- Optional tamper-evident attestation chain with predecessor binding:
entry_hash = sha256(canonical{chain_uid, event, prev_entry_hash})
over JCS-style canonical bytes — independently recomputable from the
emitted JSON, no shared secret. DSSE signing is a seam (stub) that
consumes the same binding bytes.
- CMF gap fields (stop_reason, mcp.*, framework.*, monotonic labels,
workload identity) ride under OCSF unmapped, keeping the open schema
gaps self-documenting; upstream OCSF issues are being filed.
- Registered as feature-gated builtin (not in default features);
13 unit tests + deterministic emit_sample example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
builtins/plugins/ocsf-audit— a CMF audit plugin that emits each dispatchedrequest as an OCSF API Activity event (class 6003,
ai_operation+security_controlprofiles) instead of a free-form JSON line. Near-twin ofaudit-logger: same observation-only, always-allow contract, same factory + hookwiring; only the record shape differs.
What it does
Message+Extensionsonto OCSF:ai_agent,ai_model,message_context,delegation, actor/user, tool/resource coordinates.readOnlyHint: truetools,resources, prompts →
2 Read; other tool calls →99+"Invoke Tool";completions →
99+"Completion"). The passive post-hook stream carriesaction_id: 3 (Observed)/disposition_id: 17 (Logged).entry_hash = sha256(canonical{chain_uid, event, prev_entry_hash})over JCS-stylecanonical bytes — independently recomputable from the emitted JSON, no shared
secret. DSSE signing is a seam (stub) consuming the same binding bytes.
stop_reason,mcp.*,framework.*, monotoniclabels, workload identity) ride under OCSF
unmapped, so the open schema gaps stayself-documenting; upstream OCSF issues for them are being filed.
Scope / deliberate limits
ocsf-audit), not in default features.action_id2/4) need the framework to surface its decisionto a plugin — per the production-readiness plan, not attempted here.
replica-safe chaining and checkpoint signing are follow-on work.
Validation:
cargo build/test -p cpex-plugin-ocsf-audit(13 tests),cargo clippy --all-targetsclean against the workspace lint wall,cargo fmtclean,
cargo build -p cpex-builtins --features ocsf-auditclean.SAMPLE-OUTPUT.mdholds the deterministic example output.Follows the plan in
ocsf-plugin-production-plan.md(P0 schema-validity items arein; P1+ tracked there).