feat(reviewer): INJ Phase 1 — fenced findings (D-INJ-3) + nonce envelope + output sanitization#350
Open
ProtocolWarden wants to merge 2 commits into
Open
feat(reviewer): INJ Phase 1 — fenced findings (D-INJ-3) + nonce envelope + output sanitization#350ProtocolWarden wants to merge 2 commits into
ProtocolWarden wants to merge 2 commits into
Conversation
…-INJ-1)
The reviewer emitted a free-text {"result": "LGTM"} the MODEL authored, so any
prompt injection in the diff/spec/Custodian findings contended directly for the
merge decision. Per HARNESS_TRUST_HARDENING.md §2.2/D-INJ-1 the capability is
removed: the model fills a typed {check_id, status, evidence_span} per enumerated
review check and CODE computes LGTM/CONCERNS.
- New pr_review_watcher/verdict.py: REVIEW_CHECKS, compute_verdict() (pure),
verdict_schema_prompt().
- _run_direct_review (the trust boundary) computes the verdict from the model's
typed checks and ignores any model-authored "result".
- Fail-safe: missing/unknown/malformed -> CONCERNS, never auto-LGTM (D-INJ-2).
Acceptance (§2.4): a forged {"result":"LGTM"} with no real checks computes to
CONCERNS. 11 verdict-unit + 2 boundary tests; 237 reviewer tests pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… sanitization
D-INJ-3: _custodian_findings emits only {detector_id×count}, never the raw
path/line/message (attacker-authored repo content laundered through a trusted
channel — the spec's strongest attack). New pr_review_watcher/inj.py: per-run
nonce fence wrapping every untrusted span (title/diff/spec) with a system
preamble (outer defense; live nonce redacted from payload so a close marker
can't be forged), and sanitize_for_comment defanging @-mentions + zero-width/
bidi chars before reflecting any text to GitHub (D-INJ output sanitization).
10 new inj tests; 247 reviewer tests pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
Author
|
Needs human attention (reason= CI has not gone green after 20 checks (1 failing: License headers: failure). Not merged (red CI) and not closed (work preserved) — needs a human to fix CI. |
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.
Summary
Completes the OC-side of Phase 1 (INJ) (stacked on #349's typed verdict).
_custodian_findingsnow emits only{detector_id×count}— never the raw path/line/message, which are attacker-authored repo content laundered through a trusted channel (the spec's single strongest attack). The reviewer re-derives which lines from the diff (itself fenced).pr_review_watcher/inj.pywraps every untrusted span (PR title, diff, campaign spec) in a per-run randomized fence + system preamble. Attacker text can't close the fence; a literal copy of the live nonce is redacted from the payload.sanitize_for_commentdefangs @-mentions + zero-width/bidi chars before any model/untrusted text is reflected to GitHub.Verification
Acceptance §2.4: no raw custodian sample reaches the goal (grep + test). 10 new inj tests; 247 reviewer tests pass; ruff/ty/audit clean.