Repository navigation
fix(guardrails): tighten system_prompt_leak heuristic to stop agent-traffic false-positives (#4041) - #4414
Merged
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…raffic false-positives (#4041)
diegosouzapw
force-pushed
the
fix/4041-injection-heuristic
branch
from
June 20, 2026 19:49
60f8460 to
c2d306a
Compare
tkgo11
pushed a commit
to tkgo11/OmniRoute
that referenced
this pull request
Sep 23, 2026
…raffic false-positives (cheaper-inference#4041) (cheaper-inference#4414)
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.
Refs #4041 (one slice of the multi-pronged heap-OOM report)
Context
#4041 reports a heap-OOM crash-loop under concurrent coding-agent load. It is multi-pronged; the two highest-leverage levers — bounding the injection-guard regex scan to a 16 KB prefix (#3932/#4041,
MAX_INJECTION_SCAN_BYTES) and the heap-pressure guard (#4371) — already shipped. This PR lands the remaining self-contained piece the owner called out: thesystem_prompt_leakheuristic false-positiveshighon essentially all agent traffic.Problem
The pattern matched a bare
instructionsafterreveal/show/display/print/output/repeat, so normal agent text ("show the instructions", "display your instructions") tripped ahigh-severity detection on the hot path — noise that buries real signals.Fix
Require a
system|initial|hidden|originalqualifier beforeprompt|instructions(src/shared/utils/inputSanitizer.ts). Real leak attempts still match ("reveal your system prompt", "print the initial prompt"), qualified instruction leaks now match too ("display your system instructions"), and generic agent "instructions" text no longer trips. No nested quantifiers → no ReDoS risk.Validation (TDD)
New
tests/unit/injection-system-prompt-leak-heuristic-4041.test.ts— fails on the unfixed pattern (generic "show the instructions" flagged), passes after (2/2). Injection/security regression suites green (44/0):security-fase01,prompt-injection-guard,injection-guard-scan-bound-3932,guardrails/injection-route-coverage.typecheck:core+ lint clean.The remaining #4041 levers (parse-once / double-parse → see the #4380 PR; honoring
REDIS_URL; body streaming; backpressure cap) are tracked separately; this issue stays open.