Skip to content

AAK-PRTITLE-IPI-001: PR/issue title flows into LLM client without sanitiser

Severity
HIGH
Category
Taint Analysis (taint-analysis)
Scanner
agent_audit_kit/scanners/prtitle_ipi.py
Auto-fixable
No.
SARIF name
PrTitleIndirectPromptInjection

What it detects

A function pulls a title-like field from a GitHub event source (pull_request.title, pull_request.head.ref, issue.title, or env vars wired to the same) and feeds it into an LLM client call (anthropic.messages.create, openai.chat.completions.create, genai.GenerativeModel.generate_content, langchain.*.invoke) without an HTML-escape, allow-list, or hash on the title. Aonan Guan's 2026-04-25 Comment-and-Control disclosure (CVSS 9.4) showed an attacker-controlled PR title injects instructions the agent executes with its own credentials — credential theft demonstrated against Claude Code Security Review, Gemini CLI Action, and GitHub Copilot Agent.

How to fix

Wrap the title in html.escape (or markupsafe.escape), or validate against a strict allow-list, or hash it before interpolating into the prompt. For TS/JS, use the equivalent. For shell-style agents, prefer shlex.quote. The fix is structural — never interpolate untrusted GitHub event content into an LLM prompt.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-PRTITLE-IPI-001

Limitations

Needs, in one Python function (or one TS/JS file), a title source, an LLM client call and no sanitiser. An event read is a source when it reads the PR or issue title or the PR head ref as an attribute, a subscript or a .get() (pull_request.title, event["pull_request"]["title"], event.get("issue", {}).get("title")), so pull_request.body is not a source, and neither is TypeScript's optional chaining (payload.pull_request?.title) or a .get() whose default is itself a call (event.get("pull_request", dict())); a sink is one of the listed spellings (client.messages.create, openai.chat.completions.create), so client.chat.completions.create is not one. Any json.dumps(, re.escape(, hashlib.*( or html.escape( in the function counts as a sanitiser, including a json.dumps that only builds the prompt. A file over 512 KB is not read.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-PRTITLE-IPI-001.md: the page then shows that text, with the registry reference appended under it.