feat(plugins): add ocsf-audit — OCSF API Activity emitter with attestation chain - #128
Open
Levaj2000 wants to merge 3 commits into
Open
feat(plugins): add ocsf-audit — OCSF API Activity emitter with attestation chain#128Levaj2000 wants to merge 3 commits into
Levaj2000 wants to merge 3 commits into
Conversation
3 tasks
…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.
Levaj2000
force-pushed
the
feat/ocsf-audit-plugin
branch
from
August 2, 2026 22:50
9fe56e5 to
85a06c4
Compare
…ty_uid Sync the plugin to its current revision (v0.0.3): - Emit the attestation carrier as merged into OCSF 1.9 (ocsf/ocsf-schema#1661): attestation_list[] with fingerprint / prev_event / signatures objects, replacing the draft string entry_hash / prev_entry_hash shape. The fingerprint now covers the whole event per the merged semantics (chain_uid and prev_event inside the hashed bytes; only fingerprint/signatures excluded), so a verifier following the schema can reproduce it with no knowledge of this crate's conventions. metadata.uid is emitted (prev_event.uid needs a target) and correlation_uid moved to metadata, where OCSF defines it. - Replace the DSSE signer stub with a real signer: ECDSA-P256-SHA256 over the DSSE PAE of the same canonical bytes the fingerprint covers, deterministic per RFC 6979 so SAMPLE-OUTPUT.md stays byte-identical across runs. Key is operator-provided PKCS#8 PEM (key handle, not a key service); a configured signer that fails to construct is a loud startup error, never silently-unsigned records. - Emit authority_uid inside the hashed bytes, so the claimed signing authority cannot be swapped post-hoc. Signature bytes + key id ride unmapped pending ocsf/ocsf-schema#1709. - Offline verification ships as running code (sign::signing_input + sign::dsse_pae) and is exercised end-to-end by the signed_event_verifies_offline test and the example's verify lines. - Add Authors: headers to source files. Verified against current dev (92ee83a): build, 21/21 tests, clippy clean, example output reproducible and offline-verifiable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Levaj2000
force-pushed
the
feat/ocsf-audit-plugin
branch
from
August 2, 2026 22:50
85a06c4 to
2ba722d
Compare
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).record_integrityshape (
attestation_list[]withfingerprint/prev_event/signatures) — thefingerprint hashes the whole event (
chain_uidandprev_eventinside; onlyfingerprint/signaturesexcluded) over JCS-style canonical bytes, so anyschema-following verifier can recompute it from the emitted JSON, no shared secret.
DSSE signing is real: ECDSA-P256-SHA256 over the DSSE PAE of the same bytes,
deterministic (RFC 6979), operator-provided key, with
authority_uidinside thehashed 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).