Repository navigation
feat(security): bind source admission to excision policy - #4646
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7ba0ac32dc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Session excision records every sibling attachment and sidecar hash, not just the session payload's. `write_source_raw_session` and `write_source_raw_session_blob_ref` checked only the primary hash, so a later ingest whose own payload is admissible could still carry a durably excised hash in `additional_blob_refs`: the loop inserted its `blob_refs` row and consumed its publication receipt, making the excised bytes reachable again under a new raw record. `write_source_blob_refs` was fixed for this exact class and its docstring already claimed the other two writers were gated. Both writers now validate every additional reference against the policy snapshot and the durable ledger before opening their transaction, so a refusal leaves no side effect, and it refuses per reference naming the hash like `write_source_blob_refs` does. Executed anti-vacuity at 9f450db: both writers accept the excised sibling and leave two `blob_refs` rows pointing at the excised hash; with the gate both refuse and leave zero, while an admissible sibling still writes. Raised by PR #4646 review. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy (cherry picked from commit ce5dadf)
Session excision records every sibling attachment and sidecar hash, not just the session payload's. `write_source_raw_session` and `write_source_raw_session_blob_ref` checked only the primary hash, so a later ingest whose own payload is admissible could still carry a durably excised hash in `additional_blob_refs`: the loop inserted its `blob_refs` row and consumed its publication receipt, making the excised bytes reachable again under a new raw record. `write_source_blob_refs` was fixed for this exact class and its docstring already claimed the other two writers were gated. Both writers now validate every additional reference against the policy snapshot and the durable ledger before opening their transaction, so a refusal leaves no side effect, and it refuses per reference naming the hash like `write_source_blob_refs` does. Executed anti-vacuity at 9f450db: both writers accept the excised sibling and leave two `blob_refs` rows pointing at the excised hash; with the gate both refuse and leave zero, while an admissible sibling still writes. Raised by PR #4646 review. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy (cherry picked from commit ce5dadf)
|
Closing out open Codex review threads on this PR (evidence checked against master at ef10e59):
Resolving the fixed, stale and refuted threads; tracked threads stay open. |
|
Closing out open Codex review threads on this PR (evidence checked against master at 0914f89):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Bound durable excision policy to production acquisition admission. The canonical async acquisition service now builds one immutable snapshot before source traversal and carries it through the pending raw-admission request. The synchronous ArchiveStore governance routes use the same snapshot builder before raw payload, blob-reference, artifact, parsed-session, and hook writes. Schema identity is derived from the current tier versions.
Problem
The prior implementation exposed policy parameters only at low-level writers. Every production caller left them at
None, so the guard was a no-op andbuild_excision_policy_snapshotwas reachable only from a unit test.Solution
The binding belongs at the acquisition orchestration and governance layers.
AcquisitionService.acquire_sourcescaptures policy before candidate traversal,persist_raw_recordcarries it into the admission request, and the async executor rejects the content hash before source-row side effects. Shared synchronous governance entrypoints resolve and forward the same policy to the raw-admission chokepoint. The regression invokesAcquisitionService.acquire_sourcesagainst a real source file and confirms the excised payload creates noraw_sessionsrow.Verification
nix develop --accept-flake-config --command devtools test tests/unit/pipeline/test_acquisition_excision_policy.py tests/unit/security/test_excision_policy.py: 3 passed.nix develop --accept-flake-config --command devtools test tests/unit/pipeline/test_acquisition_blob_gc_age_gate.py tests/unit/pipeline/test_stage_independence.py tests/unit/storage/test_raw_admission_async_parity.py: 24 passed; the selected acquisition blob test also hit the inherited fresh-bootstrapindex schema semantic manifest mismatchfor extra tableschema_identitywhen run in the combined selection.nix develop --accept-flake-config --command devtools test tests/unit/storage/test_source_items.py tests/unit/storage/test_raw_admission_async_parity.py tests/unit/security/test_excision_policy.py tests/unit/pipeline/test_acquisition_excision_policy.py: 13 passed; two hook-route tests hit the same inherited schema-manifest mismatch.nix develop --accept-flake-config --command devtools verify --quick: passed after the route binding was added.origin/masterat6de9e5d4746b3ea9cb0c02b20b8e21b0850bd4b0.Residual risk
The source-generation projection remains lazily created by
publish_source_generation; its numbered source migration and the broader durable excision transition are outside this route-binding repair. The legacysource.excised_contentledger remains unchanged.