Plan: Events carry their audit header; the event-type string table goes
Status
Done (2026-11-17) — every event states its audit header, staging refuses one without it, craig-security files each row from the header and a headerless message as a degraded system row, and the event-type string table and its two censuses are deleted.
Closes: #2314 (epic &105). Branch: one refactor/audit-header-<step> per step of § Scope and order.
Tree: written against main of 2026-11-15; line references are to that tree.
Erratum (2026-11-16): D1 names the UUID spelling as its one declared row change, but the header’s bounds change rows too once a publisher with a text actor or roles migrates: an actor over 256 bytes is cut with no truncation marker (the parser capped at 1024 and wrote one), a denial keeps at most 32 roles of 128 bytes, an empty actor is stored as system, and a forged header with an unreadable resource token stores unknown where the parser stored authz_decision. The headerless path keeps the old values until the last step.
Erratum (2026-11-16): a denial whose only role is empty text states no roles, so its row keeps the role unknown the parser gave it.
Erratum (2026-11-17): D8’s "carries forward" means the allowlist test takes over the property of the two actor-key censuses; they, CHAIN_PINS and CONTEXT are deleted with their file, since both are defined against the parser’s actor chain.
Context
craig-security binds its audit queue to every routing key (#, services/craig-security/src/lib.rs:603 and :617).
For each event, handle_inbound_event (lib.rs:777-864) writes one audit_log row. The envelope
(crates/craig-mq/src/envelope.rs:20-37) carries id, timestamp, source_service, event_type, an untyped
payload and trace_context. It carries nothing that says who acted on what. The subscriber guesses, in
services/craig-security/src/event_parsing.rs (5,484 lines, about 1,440 of them production code):
-
Action and resource type come from a string table keyed by
event_type(parse_event_type,:717-810, and its sub-catalogs,:828-1440). Three payload lifts sit on top (parse_envelope_type:548,parse_authz_access_denied:496). -
Resource id comes from a payload key guess: a prefix-family table and a generic key list (
:59-66,:82,extract_resource_id:447). -
Actor is the first payload key present among
created_by,approved_by,user_id,archived_by,sub(ACTOR_KEYS:31), elsesystem. -
Role and outcome are
unknownand success, except forauthz.access_denied.
Two census tests hold this together by lexing every publisher in the workspace:
event_parsing/audit_census_tests.rs (1,293 lines) and event_parsing/resource_census_tests.rs (2,034 lines). The
second lists all 190 routing keys the fleet stages (CENSUS, :75-816). Every publisher must stay in step with a
table in another service, and each actor or id fix (#1913, #2231, #2245) was a miss of that kind.
The publisher knows the action, the record and the actor as typed values at the staging site, so it should say them.
One property constrains the change. The detection rules count rows by substring of the action column
(services/craig-security/src/detection_sql.rs:14-36): %auth%fail%, %read%, %get%, %list%, %privilege%,
%escalat%, %unauthorized%, %export%, %download%, %lockout%. The action text is therefore part of the
detection contract, and it must not change.
Design
D1. AuditMeta and its home
New file crates/craig-mq/src/audit_meta.rs, re-exported from the crate root.
pub struct AuditMeta { action, resource_type, resource_id, actor, outcome, actor_roles, degraded } // all private
pub enum AuditAction { Create, Update, /* … D2 */ Unknown }
pub enum AuditResource { Case, Payment, /* … D2 */ Unknown }
pub enum AuditActor { Sub(Uuid), System, Named(ActorName) }
pub struct ActorName(String); // private field
pub enum AuditOutcome { Done, Refused }
-
AuditMeta::new(action, resource_type, resource_id: Option<Uuid>, actor)setsoutcome = Doneand no roles. A nil UUID is stored asNone..refused()setsRefused;.with_roles(Vec<String>)setsactor_roles. Read accessors return each field. The constructor is infallible; D4 says where anUnknowntoken is refused. -
The actor.
Subis a worker’s UUID.Systemis no actor.Namedcarries, verbatim, every non-UUID actor the audit log holds today:service:<name>,config:<layer>@<sha>,system:<pass>(system:retention), a rawsubthat does not parse, and a legacy text such aslegacy-operator. -
ActorName’s field is private and it has no public constructor, so code outside craig-mq cannot write `AuditActor::Named(..)itself.AuditActor::named(text: &str) → AuditActoris the only way to buildNamed(a_named_actor_cannot_be_built_outside_craig_mq, acompile_faildoctest onActorName), and it normalises: text thatUuid::parse_straccepts isSub; empty text orsystemisSystem; anything else isNamed. SoNamedis never empty and never UUID-shaped.a_uuid_shaped_actor_is_always_sub(property) pins it. -
The header is bounded at construction, so no publisher can stage one of unbounded size:
namedkeeps at most 256 bytes of the text (cut on a character boundary), andwith_roleskeeps at most 32 roles of at most 128 bytes each.from_wireapplies the same bounds.an_audit_header_serialises_within_its_bound(property, incrates/craig-mq/src/audit_meta.rs) asserts the serialised header never exceedsMAX_AUDIT_HEADER_BYTES, a constant computed from those limits. -
AuditActor::user_id()returns the text foraudit_log.user_id: the hyphenated lowercase UUID,system, or theNamedtext. One declared change: a UUID actor written in another spelling (upper case, no hyphens) is stored verbatim today and in the canonical spelling on the header path. -
Wire. The header is an object with the keys
action,resource_type,resource_id(omitted when none),actor(theuser_id()text),outcome(doneorrefused) andactor_roles(omitted when empty).degradedis not on the wire. -
Decode is per field (
AuditMeta::from_wire(&serde_json::Value) → Option<AuditMeta>). A bad field never discards its siblings (a_bad_header_field_keeps_its_siblings):-
action,resource_type: a missing, non-string or unknown token isUnknown. -
resource_id: anything but a non-nil UUID string isNone. -
actor: a string goes throughAuditActor::named; a missing or non-string value isSystem. -
outcome:doneorrefused; any other value isRefusedwhen the action isdeny, elseDone. A refusal is never recorded as a success because its outcome was garbled (a_garbled_outcome_on_a_deny_stays_refused). -
actor_roles: an array keeps its string members; anything else is empty. -
Each substitution above, except an absent
resource_idoractor_roles, setsdegraded(AuditMeta::is_degraded()). -
Only a value that is not a JSON object returns
None: the envelope is then headerless (D5).
-
-
The types live in craig-mq because the envelope does, and because craig-authz depends on craig-mq (
crates/craig-authz/Cargo.toml:22), so craig-mq cannot name craig-authz’sResourceType.
D2. The closed enums and their tokens
Both enums serialise with #[serde(rename_all = "snake_case")]. A variant is the token in UpperCamelCase, one
capital per underscore-separated word, an acronym treated as a word: afcars_export_failed is AfcarsExportFailed,
ive_determination is IveDetermination, icpc_request is IcpcRequest, nist_control is NistControl.
The token set is fixed by what the audit log holds today.
AuditAction, 43 tokens. The 35 the table’s arms emit:
abort, afcars_export_failed, afcars_export_generated, archive, assign_admin_unit, authz_fallback_admit,
catch_up, create, delete, deny, dismiss, evaluate, export, field_proposal_decided, field_proposed,
field_written, import, link_persons, ncands_export_failed, ncands_export_generated, portal_read,
promote, purge, read, refuse_release, release, replay, restage, reveal, revoke_admin_unit,
rollback, send_requested, system, update, upload_failed. And the 8 of the routing keys that have no arm
and take the raw split today (generic_event_split, event_parsing.rs:812-819): assignment_changed,
child_facts_changed, permanency_plan_established, cache_miss, cache_refreshed, cache_invalidated,
invalidated, changed.
AuditResource, 85 tokens. The 75 of CENSUS:
admin_unit, afcars_submission, authz, authz_decision, caregiver_identity, case, case_plan,
case_plan_task, claim, composition, composition_override, contact, contact_attachment, court_order,
custody_episode, data_quality_issue, dead_letter, detection_rule, education_record, event_outbox,
exchange_agreement, exchange_partner, exchange_send_job, exchange_transaction, field_proposal,
foster_home, foster_home_caregiver, foster_portal, governed_record, health_record, home_document,
household_member, icpc_attachment, icpc_request, investigation, ive_determination, major_change,
medicaid_application, ncands_submission, nist_control, partner, partner_api_key, partner_signer_key,
payment, payment_adjustment, person, placement, portal_invitation, rate_table, referral,
removal_episode, report, report_attachment, report_person, rule_evaluation, rule_evaluations, rule_set,
rules, ruleset, screening_cohort, screening_review, screening_run, security_alert, security_archive,
security_review, ssa_screening_job, subsidy_agreement, subsidy_backpay_batch, subsidy_generation,
subsidy_import, subsidy_review, subsidy_sweep, trigger_admission, worker_admin_unit, worker_identity.
Plus security (the unknown security.* catch-all, event_parsing.rs:801-803). Plus the 9 craig-authz
ResourceType tokens (crates/craig-authz/src/types.rs:51-219, 60 variants) that CENSUS lacks, because the deny
row and the fallback admit lift any of the 60 today (payload_resource_type, event_parsing.rs:533-539):
audit_event, background_job, benefit_fact, disposition_follow_up, icpc_home_study, kinship_option,
quality_review, screening_decision, subsidy_backpay.
-
craig-authz gains
impl From<ResourceType> for AuditResource. It maps each of the 60 variants to the variant of the same token; no token differs.authz_decisionhas noResourceType: today it is the deny row’s fallback for a payload token craig-authz does not know, which a typedResourceTypecannot produce. It stays a token because the headerless deny row uses it (D5). -
Each enum has an
Unknownvariant, stored asunknown. Only decode produces it (D1, D4).
Tokens are byte-identical to today’s action and resource_type text, with one declared exception. The two keys
with a runtime suffix (composition.invalidated.<jurisdiction>, ruleset.changed.<name>) store
invalidated.<jurisdiction> and changed.<name> as the action today. They become invalidated and changed. The
suffix stays in details. A rule-set name can no longer match a detection substring by accident. The release note
says so.
D3. The wire field, and the outbox copy
-
EventEnvelopegainspub audit: Option<AuditMeta>, with#[serde(default, skip_serializing_if = "Option::is_none", deserialize_with = …)]. The field ispubbecause every other field is and the workspace deniespartial_pub_fields;AuditMeta’s own fields are private, so a header is only built through D1. The field stays an `Optionfor good: decode must keep accepting a headerless message (D5). -
The deserialiser reads the
auditvalue as JSON and callsAuditMeta::from_wire. It never fails the envelope’s decode (arbitrary_audit_json_never_fails_envelope_decode), which would send the message to the dead-letter queue and lose the audit row. -
StagedEnvelope(crates/craig-mq/src/outbox.rs:110-123) is the borrowed copy thatprepare_staged_envelope(:205) writes to the outbox. It gainsaudit: Option<&'a AuditMeta>with the same skip rule. Without this the header never leaves the publishing service. At step 8 the field becomesaudit: &'a AuditMeta(D4). -
Envelopes that craig-mq derives from another carry its header unchanged:
wrap_for_dlx(crates/craig-mq/src/publisher.rs:484) clones the envelope, andwrap_for_capture(crates/craig-mq/src/park.rs:188) copiesinput.envelope.auditonto the outer envelope thatbuild_outer(:294-312) makes. The copy sits outside theParkWrapper, which is allfit_capture(park.rs:260-291) measures. Sofit_capturetakes the header’s serialised length as a reserve and holds the wrapper toMAX_CAPTURE_BYTESminus that reserve, in its early-return test (:262) as well as in its truncation budget (:283-285). A capture’s published size then keeps the bound it has without a header,MAX_CAPTURE_BYTESplusOUTER_MARGIN_BYTES(a_capture_with_the_largest_header_keeps_the_capture_bound, inpark.rs: one wrapper just under the reduced ceiling and one over it).wrap_malformed(:220) has no original and stays headerless.OutboxAuditSink::stage(crates/craig-bootstrap/src/audit_sink.rs:40-43) stages the envelope craig-authz built and needs no change.
D4. How a publisher supplies it
-
Step 0 adds
EventEnvelope::audited(source, event_type, payload, audit: AuditMeta)andstage_audited_json_event(tx, source, event_type, payload, audit: AuditMeta)besideEventEnvelope::newandstage_json_event(outbox.rs:283), which keep their signatures until step 8. Step 8 givesnewandstage_json_eventtheauditargument and deletesauditedandstage_audited_json_event. -
domain_event!(crates/craig-mq/src/domain_event.rs:79-108) gains a clause after the routing key, on both arms:craig_mq::domain_event! { publish_payment_created(payment_id: Uuid, user_id: Uuid), "financial.payment_created", audit = (Create, Payment, Some(payment_id), Sub(user_id)), { "payment_id": payment_id, "user_id": user_id } }The four parts are: an
AuditActionvariant name, anAuditResourcevariant name, anOption<Uuid>expression, and anAuditActorexpression. The expansion bringsAuditActorand itsSubandSysteminto scope. The first two are bare identifiers so the censuses of § Tests can read them as text. In steps 0 to 7 the clause is optional; step 8 makes it mandatory. -
Actor forms at a site.
-
A worker’s
Uuid:Sub(user_id). -
An optional worker (
publish_person_updated,publish_report_submitted,services/craig-cases/src/events.rs:283,:522):user_id.map_or(AuditActor::System, AuditActor::Sub). -
Text in the ADR-085 encoding:
AuditActor::named(text). That covers thesubof the three craig-authz inputs (crates/craig-authz/src/audit.rs:89,:156,:212, fed byacting_encoding,engine.rs:1748), the fallback admit (services/craig-rules/src/engine.rs:1431), the config reconcile actor (services/craig-rules/src/config_reconcile/apply.rs:62, used at:238and:279), rules'archived_by(system:retention) and craig-security’spublish_alert_acknowledgedtext actor. -
An upload attempt’s creator (
services/craig-reporting/src/upload_finalizers.rs:125,services/craig-cases/src/events.rs:581,:692,:735):attempt.creator().map_or(AuditActor::System, |c| AuditActor::named(&c.encoding())). -
rules.evaluated(services/craig-rules/src/engine.rs:919):System. Its payload (evaluated_event_payload,:1463) names no actor today;evaluated_by(:902) is written to the evaluation row only. The header keeps that, and the site is a row of D8’s allowlist.
-
-
A site that cannot use the clause builds
AuditMeta::new(..)by hand: a resource type chosen at run time (placement.field_written, from itstarget_tableby the mapping ofgoverned_record_type,event_parsing.rs:567-575, elseGovernedRecord;rules.authz_fallback_admitandauthz.access_denied, through D2’sFrom), or a deny (.refused().with_roles(..); the suppression flush passes no roles), incrates/craig-authz/src/audit.rs. -
Staging refuses what a publisher must not send.
prepare_staged_envelopereturnsStageError::Unpublishable(Unpublishable::UnknownAuditToken)for a header whose action or resource isUnknown(step 0), andUnpublishable::MissingAuditHeaderfor an envelope with no header (step 8). Both variants are new incrates/craig-mq-error/src/lib.rs. This plan refuses at staging and not in the constructor: every publisher passes that one point, and craig-authz’s envelope builders have no error path. -
Adding the field breaks the two struct-literal envelopes, both test code (
services/craig-rules/src/main.rs:586,services/craig-security/src/event_parsing.rs:4544). Step 0 rewrites each toEventEnvelope::newfollowed by field assignments.
D5. The subscriber
New file services/craig-security/src/audit_columns.rs holds the column derivation and the two counters.
handle_inbound_event (lib.rs:777) chooses per envelope.
Header present. The columns come from the header: action and resource_type are the enum tokens; resource_id
the header’s; user_id is actor.user_id(); actor_user_sub is the UUID of Sub, else NULL; user_role is the
roles joined by a comma, or unknown when empty; success is outcome == Done. service, actor_service and
details are unchanged. Every text column still passes through the existing capping and escaping
(lib.rs:832-844), so a Named actor is capped and escaped exactly as today’s user_id text. The payload is not
consulted. A header with is_degraded() increments audit_degraded_headers_total and logs one WARN.
Header absent, steps 0 to 7. Today’s parser runs, unchanged.
Header absent, from step 8. The row still lands, degraded. Two cases are kept from today’s parser so that evidence is not inverted:
-
authz.access_deniedlandsaction = deny,resource_type = authz_decision,success = false(the meaning oflib.rs:826). -
any other
security.*type lands (system,security) (event_parsing.rs:801-803). -
everything else lands the raw split of
event_type(the rule ofgeneric_event_split),success = true.
In all three, user_id is system, resource_id and actor_user_sub are NULL and user_role is unknown. The
payload is not read. The subscriber logs one WARN with the stable message audit event carries no header (capped
fields only) and increments audit_headerless_events_total. This path is the legacy fallback the issue asks for. It
is permanent: there is no later removal.
Counters. audit_headerless_events_total and audit_degraded_headers_total are OpenTelemetry u64 counters with
no labels (the envelope’s text is not trusted), built on first use in a OnceLock on
opentelemetry::global::meter("craig-security-audit"). That is the service’s existing mechanism
(services/craig-security/src/identity/keys/ring.rs:44, :380-388); the Prometheus bridge serves them on
/metrics.
In flight at the step 8 deploy. CRAIG has no production deployment before 1.0, so this is a devstack concern. The step 8 release note says: drain or discard each service’s outbox before upgrading; an admin replay of an outbox row written before its publisher’s step lands a degraded row.
The archive bookkeeping for rules.evaluations_archived (lib.rs:781, record_rules_archive_bookkeeping :876) and
the dead-letter disposition map (disposition, lib.rs:1028) are untouched.
D6. The actor is data, as today
The header is written by the publishing service. A compromised publisher can name any actor, exactly as it can put
any user_id in a payload today. The header changes where the claim is read, not who is trusted. Nothing in
CRAIG authorises on it.
D7. Test call sites
There is no test-only feature and no test-only constructor. Test code that builds an envelope states explicit audit
facts through the public API. The reason: the release-artifact gate classifies features per crate
([package.metadata.craig] test-only-features, read by xtask/src/cmd/release_artifact_gate.rs), and a craig-mq
test feature enabled through craig-test-lib would enter xtask’s graph and need a third named exception beside
craig-auth/test-fixtures and craig-common/test-zones (XTASK_GRAPH_EXCEPTIONS, :77-90, both waiting on #2671).
-
craig-test-lib gains
craig_test_lib::audit::plain() → AuditMeta, which returnsAuditMeta::new(AuditAction::Update, AuditResource::Case, None, AuditActor::System), for a test that does not care about the audit row. For it, craig-test-lib’scraig-mqdependency (crates/craig-test-lib/Cargo.toml:70) stops being optional andfault-injectionbecomes["craig-mq/fault-injection"]. xtask already links craig-mq with no feature (xtask/Cargo.toml:36);cargo xtask release-artifact-gatemust stay green at step 0. -
craig-mq’s in-crate unit tests cannot use it (the crate under test is not the craig-mq that craig-test-lib links). They call
AuditMeta::newdirectly. -
A test of the headerless path decodes a JSON envelope with no
auditkey; it needs no constructor. -
A test that builds another service’s envelope by hand states the header that service’s publisher states. A test that finds its audit row by resource id passes that id to
AuditMeta::new.
D8. What guards the header once the string censuses go
The two censuses guard today that no staff act audits as system and that each key names its record. Deleting them
must not make the audit trail easier to falsify. A source census replaces them:
services/craig-security/src/audit_header_census_tests.rs, declared #[cfg(test)] in lib.rs. It exists from
step 0 and reads the crates in MIGRATED (§ Tests); step 8 widens it to the workspace. It scans every .rs under a
src directory of services/ and crates/, test files included, except crates/craig-mq. Its four tests:
-
every_envelope_outside_craig_mq_is_built_with_a_header: noEventEnvelope { .. }struct literal, no write to.audit, and everydomain_event!, staging call and envelope constructor carries the audit argument. -
no_publisher_names_an_unknown_audit_token:Unknownappears in no audit clause andAuditAction::Unknown/AuditResource::Unknownappear in no file outside craig-mq and craig-security. D4’s staging refusal is the run-time half. -
every_system_actor_and_recordless_site_is_allowlisted: each non-test site whose actor expression mentionsSystem, or whose id isNone, has a row(file, site, reason)inSYSTEM_OR_RECORDLESS. The table is exhaustive both ways (a site with no row fails; a row with no such site fails) and shrink-only: its length is pinned bySYSTEM_OR_RECORDLESS_CEILING, set at step 8, which a later change may lower and not raise without review of that constant. It carries forwardevery_payload_actor_key_is_lifted_or_contextandevery_multi_key_or_sub_payload_is_pinned_to_its_actor(audit_census_tests.rs:963,:1009,CHAIN_PINS). -
every_person_event_audits_against_the_person: each site whose routing key startscase.person_statesPerson(todayaudit_census_tests.rs:1277).
In steps 0 to 7 it reuses the lexer of resource_census_tests.rs (mod read, :980) and the source walk of
audit_census_tests.rs (scan::workspace_sources, :399), widened to pub(crate). Step 8 moves both into the
new file before deleting the old ones.
A header can still name the wrong variable of the right type. No census proves intent; review does, and the
allowlist makes each System a stated decision.
Scope and order
Each step is one merge request that is green on its own (Relates to #2314; the last Closes #2314). A step
migrates every staging site of its crates, adds the crates to MIGRATED, converts the tests in those crates that
build an envelope (D7), and rewrites the hand-built envelopes of its routing keys in craig-security’s suites so they
carry a header and exercise the header path. Until its step, a suite’s headerless envelope still passes through the
parser. Steps are numbered 0 to 8.
-
craig-mq. D1, D2, D3 and D7;
EventEnvelope::audited,stage_audited_json_event, the optional macro clause andUnknownAuditToken(D4); the header-present path of D5 withaudit_degraded_headers_total; craig-authz’sFrom; D8’s census and the equivalence census withMIGRATEDempty; the contract and property tests. The census readers learn the new forms:site_at(resource_census_tests.rs:1161) also readsstage_audited_json_event(key at argument 2, payload 3, header 4) andEventEnvelope::audited(key 1, payload 2, header 3);wrapper_site(:1127) takes a third part that opensaudit =as the header and the parts after it as the payload;RawSitegains the header’s tokens.MARKERSandSTAGING(audit_census_tests.rs:307,:315) gainstage_audited_json_event.domain_event_wrappers_stage_the_declared_key_source_and_payloadgains a wrapper with the clause. -
craig-reporting and craig-composition (6 and 2 routing keys).
-
craig-rules, craig-authz (
audit.rs: the deny, suppression-flush, cache-miss and cache-refresh events) and craig-api (admin_replay/act.rs:108). Suites:services/craig-security/tests/authz_deny_audit.rs(:137,:174) builds its two envelopes withcraig_authz::build_access_denied_eventandbuild_access_denied_suppressed_event. Inaudit_emission_evil_tests.rs,Case::deny_storing(:236) and therules.evaluations_archivedcase (:847) decode a wire envelope whoseauditobject carries the same hostile text in the matching header field. -
craig-exchange (
exchange.,icpc.,ssa.*). -
craig-placement (
placement.,foster_home.). -
craig-financial (
financial.*). -
craig-cases (
case.*,eligibility.evaluated). -
craig-security’s own events (
security.*). Suites:tests/worker_admin_unit_audit.rs(its assigned and revoked envelopes). The cases that stay headerless on purpose (its catch-all case, andCase::typed,audit_emission_evil_tests.rs:247) build their envelope by decoding JSON (D7). The exampleexamples/inbox_latency_probestates existing tokens and gets no token of its own:probe_envelope(main.rs:188) statesAuditMeta::new(AuditAction::System, AuditResource::Security, Some(id), AuditActor::System), withidthe payload’s id, andVISIBLE_SQL(subscriber.rs:58) selectsresource_type = 'security'. The ids are fresh, so the query stays exact. -
Mandatory.
newandstage_json_eventtake the header, the macro clause is required,MissingAuditHeaderis refused at staging andStagedEnvelope.auditloses itsOption(D4). craig-mq keeps apub(crate)EventEnvelope::unauditedforbuild_outer(park.rs:294); captures are published directly and are not staged. D5’s degraded path replaces the parser. The rangeevent_parsing.rs:577-704(EvaluationsArchivedPayload,RULES_ARCHIVE_PREFIX,validate_evaluations_archivedand its helpers) moves, with its tests, toservices/craig-security/src/archive_validation.rs. D8’s census widens to the workspace and takes over the lexer. Inxtask/src/cmd/audit_write_census.rs,each_event_verdict_names_a_staged_key_with_an_audit_arm(:232) stops readingevent_parsing.rsand drops its arm check; it keepskey_is_stagedand is renamedeach_event_verdict_names_a_staged_key. The arm check is redundant then: a staged key cannot lack a header. Headerless suites change with the path:Case::typed(audit_emission_evil_tests.rs:247) anda_security_catch_all_event_still_lands_system_securityfind their row bydetails→>'id', because the headerless row has noresource_id(rows_under,:698);a_revoke_attributed_only_by_revoked_by_falls_to_systempins a parser rule that no longer exists and is replaced by D8’s allowlist test.
services/craig-security/src/events/actor_audit_tests.rs is rewritten leg by leg: a leg that drives a real
craig-security producer changes at step 7; a hand-built leg changes at the step of its routing-key prefix
(reporting., composition. 1; rules. 2; exchange., icpc., ssa. 3; placement., foster_home. 4;
financial. 5; case. 6; security. 7).
Only the last step deletes: event_parsing.rs, event_parsing/audit_census_tests.rs and
event_parsing/resource_census_tests.rs, and with them the equivalence census.
craig-intake stages no events and has no step.
Out of scope:
-
Typing the 190 payloads as contract structs. The header removes the need for the subscriber to read them; typing them is separate work.
-
detailsstoring a copy of the whole payload. Noted on #2314. -
Any
audit_logschema change. The columns are TEXT with no vocabulary constraint, so there is no migration. -
Naming the evaluator on
rules.evaluated(D4). It would change today’s row; it is a separate issue.
Risks
| Risk | Class | Mitigation, and the test that pins it |
|---|---|---|
|
silent |
|
An action token drifts from today’s text and a detection rule stops counting. |
silent |
|
A site names the wrong id or actor variable, or is skipped in its step and keeps the parser’s guess. |
silent |
The equivalence census compares the clause’s id and actor with the payload key the parser reads for that routing
key. |
With the string censuses gone, a new staff act is staged as |
silent |
D8: |
A publisher builds a headerless envelope or names |
fail-closed |
Staging refuses both (D4): |
A compromised publisher forges a header (D6). |
fail-open |
Same exposure as today’s payload keys. |
One malformed header field discards the rest, so a deny with a hostile |
fail-open |
D1’s per-field decode. |
A headerless message arrives after step 8: its actor and record are lost, and a read it reports is not counted by the bulk-access rule unless its raw split matches. |
silent |
The row still lands with |
An unknown token or a malformed |
fail-closed |
D1’s |
A deny row loses |
silent |
|
A non-UUID actor ( |
silent |
|
The suffix dropped from the two runtime-suffixed actions (D2) is one an operator filtered on. |
silent |
Accepted; the release note names both. |
A large header (a long actor text, many roles) is copied beside a parked message and pushes the capture over the publish limit, so the capture fails. |
fail-closed |
The header is bounded at construction and at decode, and |
Tests
| Category | Tests, with their file | Devstack |
|---|---|---|
Contract (wire) |
|
no |
Contract (outbox) |
|
yes |
Property ( |
|
no |
Regression (equivalence census, steps 0 to 7) |
|
no |
Regression (header census, permanent) |
|
no |
Regression (subscriber) |
|
yes, except the last |
Evil |
|
yes |
Every new test gets a red proof. Devstack tests are #[ignore = "requires devstack"] and run in the car.
failure_variants_carry_their_v12_dispositions (lib.rs:1359) already pins the dead-letter disposition map and stays.
Delivery
-
Canonical page:
docs/modules/ROOT/pages/data-model-security.adoc, §audit_log: where each column comes from (the header), and the degraded row. Updated at step 0 and at step 8. -
Also updated:
shared-crates.adoc(theEventEnvelopeandnewsignatures near line 429, andstage_json_eventanddomain_event!near lines 480-490), at step 0 and step 8;implementation-guide.adoc(the paragraph onevent_parsing::ACTOR_KEYS, and how to stage an event with a header); thedomain_event!doc comment. -
ADR-003 amendment (a dated section in
adrs/adr-003-rabbitmq-topology.adoc, at step 0): the envelope carries an audit header; it supersedes the #2211 amendment ("every payload names its actor under a lifted key") once step 8 lands. -
CHANGELOG entry: the release-note fragment
changelog.d/2314.changed.adoc, added at step 0, the step that changes the wire (a new optional envelope field; older consumers ignore it; a UUID actor is stored in canonical spelling). Step 8 addschangelog.d/2314.mandatory.changed.adoc: the header is required to stage, a headerless message audits assystem, and the two suffixed actions lose their suffix. Its ops note: drain or discard each outbox before upgrading; an admin replay of a pre-header outbox row lands a degraded row; watchaudit_headerless_events_totalandaudit_degraded_headers_total, which should stay at zero. -
Close:
Closes #2314on step 8; after merge, one line with the merge SHA. Before Status flips:cargo xtask plan-lint --done docs/modules/ROOT/pages/plans/audit-header.adoc \ --allow-missing services/craig-security/src/event_parsing.rs \ --allow-missing services/craig-security/src/event_parsing/audit_census_tests.rs \ --allow-missing services/craig-security/src/event_parsing/resource_census_tests.rs
Review log
| Round | Vendor | Resolved model | Verdict |
|---|---|---|---|
1 |
Anthropic |
vertex-anthropic/claude-fable-5-2 (cold read) |
Conventions PASS, implementable FAIL, scaffolding PASS, readable PASS. Folded: non-UUID actors ( |
2 |
gemini-4-carbon |
Conventions FAIL, implementable FAIL, scaffolding PASS, readable PASS. Folded: the headerless path keeps the deny and |
Not put to the maintainer for approval before work starts: by the ruling of 2026-11-15 (#1654) the agent writes the plan, runs the two reviews and builds, and the maintainer reads the plan in its merge request.