You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the architecture audit. Part 3 of 6. Must land before the Agent adapter (6/6). Depends on 2/6.
Problem
Defenses against prompt injection only exist inside the HTTP path: harden_system_prompt, the diff fence (fence_for), comment_sanitizer, hallucinated-path filter. A caller that builds its own prompt from a packet loses them, and anything a judge returns (title, body, suggested_fix) flows to formatters, SARIF upload, history and MCP responses. Specific gaps:
rule_id is deserialized from model output (types.rs), then feeds inline_suppress, ignore.rules matching and the deterministic cap.
No bounds on issue count, title/body/suggested_fix length or line range; line is never checked against hunks; scan has no path guard, no fence, no sanitizer.
Cache key (cache.rs) is diff + model + provider + base_url + temperature only. focus, rules, profile, sanitize_comments, ignore.rules, min_severity (baked into cached should_block) and cora version do not invalidate it; nothing separates "LLM found nothing" from "no LLM ran".
Proposal
Packet is self-contained: carries the hardened system prompt, fence, sanitized text, valid_files (and the claim warning).
finalize treats any judge output as untrusted: clear rule_id, enforce bounds, path/line validation, judge can add findings but never remove deterministic ones.
Cache moves behind the HttpLlm adapter and keys on a hash of the whole Packet plus adapter id; never read/written for None or Agent.
Done when
Tests: forged rule_id, oversized body, out-of-diff file/line, and injection-looking text in findings are neutralized in finalize.
Changing focus/rules/profile/sanitize invalidates the cache; a deterministic-only result is never served as an LLM review.
Activity
ajianaz commentedon Oct 15, 2026
Series map (sequential, one PR each): 1/6 finalize #648 → 2/6 prepare/judge/finalize #649 → 3/6 untrusted judge output + cache #644 → 4/6 scan deterministic family #645 (can parallel 3/6) → 5/6 select_judge #646 → 6/6 MCP agent tools + skill #647.
security(review): admit judge output as untrusted input; cache keyed …
security(review): admit judge output as untrusted input; cache keyed …