Skip to content

fix(review): escape PR-controlled text in agent feedback (prompt injection) - #180

Merged
backnotprop merged 1 commit into
plannotator:mainfrom
sebastianst:seb/review-pr-header
Nov 22, 2026
Merged

backnotprop merged 1 commit into
plannotator:mainfrom
sebastianst:seb/review-pr-header

Conversation

@sebastianst

@sebastianst sebastianst commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Prompt injection fix: a PR's author picks its title, branch name and file paths, and the review feedback sent to the agent interpolated them into Markdown as they came, so they could pose as review notes:

  • A title with line breaks could append a fake ## Global comments section after the bold title line.
  • A branch name with a backtick (git allows one) ended its code span early.
  • A file path with a newline (git allows that too, and patch.rs unquotes it) did the same in its ## <path> heading.
  • A reviewed commit's subject, in the **Diff:** line, can still carry a CR, which Markdown reads as a line break.

Control characters, plus U+2028/U+2029, in those values are now written as escapes (\n), and the branches go into a code span whose delimiter is longer than any backtick run inside. Ordinary input gives the same bytes as before, so the browser-matching tests are unchanged.

🤖 Co-created with Claude Opus 5.5

@sebastianst sebastianst changed the title fix(review): a PR's title, branches and paths can't open sections in the agent's feedback fix(review): escape PR-controlled text in agent feedback (prompt injection) Nov 20, 2026
@backnotprop
backnotprop added this pull request to the merge queue Nov 22, 2026
Merged via the queue into plannotator:main with commit d5125c7 Nov 22, 2026
3 checks passed
@sebastianst
sebastianst deleted the seb/review-pr-header branch November 23, 2026 14:52
@backnotprop backnotprop mentioned this pull request Nov 23, 2026
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.

2 participants