Repository navigation
Land #171 on main: injection-attack detection and prompt-injection hardening (#118) - #178
Merged
Merged
Conversation
…rompt injection Injection attacks against applications (extends #166): - sql_injection, command_injection, log4shell, path_traversal, ssrf_metadata, xss and template_injection rules, matched on the twice URL-decoded line; most only apply to HTTP request lines so plain DB query logs don't trigger. - A single probe is medium (scanners hit every public site); at THREAT_INJECTION_THRESHOLD (default 5) attempts from one source IP the finding is high ("sustained") and the incident becomes a security incident. Prompt injection against the agent (#118): - Detection: prompt_injection (instruction overrides, role switches, chat-template tokens, requests to call the agent's own tools, approve/merge requests aimed at bots, "don't tell security") and hidden_unicode (zero-width, bidi-override, tag characters), MITRE ATLAS AML.T0051. Incident data, code-review diffs and every tool result are scanned. - Invisible characters are stripped before anything reaches the model; incident data and tool output are wrapped in <untrusted_incident_data>/<untrusted_tool_output> with a warning when an injection was found, and every system prompt states that this content is evidence, never instructions. - Once an injection is found, mutating tools are refused for the rest of the incident (state kept in the checkpointed context); suggest_fix, notify_slack and post_code_review remain, but post_code_review can never APPROVE while locked. Code-review incidents can only post their review, never change infrastructure. - Escalation reason `prompt_injection`; the code-review prompt treats an injection attempt as REQUEST_CHANGES. Fixes #118 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
#171 was approved and merged, but into
feat/threat-detection-166, notmain. It was stacked on #170, and GitHub only retargets a stacked PR when its base branch is deleted. #170 merged first and the branch stayed, so #171's commit never reachedmain.This PR brings exactly that commit (7a37db6) to
main. It's the same diff that was reviewed in #171: injection-attack detection (SQLi, command injection, Log4Shell, path traversal, SSRF, XSS, SSTI) and the prompt-injection protections for #118 (detection, sanitising, untrusted-data marking, the mutating-tool lock, and the code-review tool policy). It merges cleanly onto currentmain(#172, #173, #177). CI on this PR checks the combination.Fixes #118
After merging,
feat/threat-detection-166andfeat/injection-detectioncan be deleted.