Repository navigation
feat(json): write JSON report artefacts as I-JSON/JCS - #237
Conversation
The estate JSON policy (standards 3-practice/JSON-POLICY.adoc, rule J-1) makes authored JSON I-JSON (RFC 7493) serialised as JCS (RFC 8785) with one final line feed. panic-attack wrote every report with to_string_pretty, so none of it was canonical. Add crate::json::to_canonical_string, which serialises through serde_json::Value and canonicalises with ijson-jcs (the tool behind the estate gate, pinned to a full commit SHA because it is not on crates.io), so output passes `ijson-jcs check` by construction. Route the report artefacts through it: - ReportOutputFormat::Json (--output-format json, save_report, storage) - assail --output and its --quiet/--headless stdout form - the amuck, abduct, axial, adjudicate, assay, aggregate and assemblyline reports, the assemblyline storage copy and ReportFormatter::save - the patch-bridge triage report and mitigation registry The assail --attest seal already hashes report_json.as_bytes(), so it now hashes canonical bytes. Stdout prints use print!, because the canonical string already ends in its one LF. Left alone, with separate consumers: VeriSimDB hexads, SARIF, PanLL exports, the attestation envelope (next PR) and ad-hoc CLI JSON. Checks: build on stable and on 1.89.0 --locked, clippy -D warnings --all-features, 662 tests pass. New tests cover the RFC 8785 rules (sorted keys, 1e+21, -0, \u0001, one LF), the I-JSON ±(2^53-1) bound, and idempotence on a real report. `assail --output` and stdout outputs both pass `ijson-jcs check`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFaqv6iBXrt3W5Akd1Fq5k
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 31 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com>
Part of the KYAML / I-JSON-JCS follow-up stack to #234. Independent of #235 and #236, so it is based on
main.Summary
The estate JSON policy (
hyperpolymath/standards3-practice/JSON-POLICY.adoc, rule J-1) requires authored JSON to be I-JSON (RFC 7493), serialised as JCS (RFC 8785), with exactly one final LF. panic-attack wrote every report withto_string_pretty, so none of its output was canonical.crate::json::to_canonical_string. It serialises throughserde_json::Valueand canonicalises withijson-jcs, the tool behind the estate gate, so output passesijson-jcs checkby construction.ijson-jcsisn't on crates.io, so it is a git dependency pinned to a full commit SHA (3a9a4ee). panic-attack doesn't publish to crates.io, and the shared CI runs no cargo-deny, so a git source is allowed.--output-format json(save_report, storage)assail --outputand its--quiet/--headlessstdout formReportFormatter::save.machine_readable/patch-bridge/registry.json)assail --attestalready sealsreport_json.as_bytes(), so the report hash is now taken over canonical bytes. The stdout paths useprint!, because the canonical string already ends in its one LF.Consumer check (in this repo)
jq(bridge-gate,scan-and-report), which parses.chapel-cigreps a value (repo-alpha), which compaction keeps.Deliberately left alone
These have separate consumers and should be follow-ups if wanted:
queryhitsFound while testing (not fixed here)
Two
assailruns on the same input give different reports:recommended_attacks,frameworksand the taint-matrix rows come fromHashSet/HashMapiteration order. JCS sorts object keys, but by design it leaves array order alone. So until this is fixed, "equal input gives equal bytes" doesn't hold for the report itself. The fix (deriveOrd, useBTreeSet/BTreeMap) is the next small PR.Verification
cargo fmt --check: clean.cargo build --locked: no warnings, on stable and on 1.89.0.cargo clippy --locked --all-features --all-targets -- -D warnings: clean.cargo test --locked --all-features --no-fail-fast: 662 passed, 0 failed.1e+21,-0→0,\u0001, one LF.assailreport.assail --output x.jsonand--quietstdout both passijson-jcs check.Generated by Claude Code