Skip to content

Land #171 on main: injection-attack detection and prompt-injection hardening (#118) - #178

Merged
OkiriGabriel merged 3 commits into
mainfrom
feat/injection-detection
Nov 21, 2026
Merged

OkiriGabriel merged 3 commits into
mainfrom
feat/injection-detection

Conversation

@OkiriGabriel

@OkiriGabriel OkiriGabriel commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

#171 was approved and merged, but into feat/threat-detection-166, not main. 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 reached main.

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 current main (#172, #173, #177). CI on this PR checks the combination.

Fixes #118

After merging, feat/threat-detection-166 and feat/injection-detection can be deleted.

OkiriGabriel and others added 3 commits November 14, 2026 18:49
…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]>
@OkiriGabriel
OkiriGabriel merged commit 0a86974 into main Nov 21, 2026
16 checks passed
@OkiriGabriel
OkiriGabriel deleted the feat/injection-detection branch November 26, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SECURITY] Prompt-injection hardening: alert, log and PR content reaches the model as trusted text

1 participant