Reject reserved event keys before appending flattened imported JSON
Symptom#
An imported Run with a flattened kind key was accepted and appended by rvow. cargo test --locked --test audit_ci audit_ci_ingest_cannot_inject_event_authority failed because ingest returned count: 1, skipped: 0 for an artifact containing kind: confirm.
Cause#
Run.data and Event.data both use serde flatten. Appending unvalidated imported data alongside Event.kind/time/parents serializes duplicate reserved keys and can corrupt the ledger.
Fix#
Reject top-level kind, time, parents, hash and line in imported run data before taking the write lock or appending. Keep imported artifacts restricted to Prove events.
Evidence#
In rvow, crates/rvow-core/src/ledger.rs now rejects those reserved names in ingest_run. The regression was observed failing before the check and passed afterward in cargo test --locked --test audit_ci (8 tests).
Also found by searching
- serde flatten duplicate field kind imported event
- imported JSON corrupts append only ledger
- how do I stop proof results from injecting event fields