Skip to content

fix(github): sanitize PR review and discussion bodies on read paths - #3039

Open
SashaMIT wants to merge 1 commit into
github:mainfrom
SashaMIT:fix/sanitize-review-discussion-bodies
Open

fix(github): sanitize PR review and discussion bodies on read paths#3039
SashaMIT wants to merge 1 commit into
github:mainfrom
SashaMIT:fix/sanitize-review-discussion-bodies

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 8, 2026

Copy link
Copy Markdown

Problem

Issue and PR title/body reads already run through sanitize.Sanitize (invisible Unicode tags, BiDi overrides, HTML, code-fence metadata) before content reaches the model. Several sibling user-authored read paths still returned raw text:

  1. PR reviews (convertToMinimalPullRequestReview) — review bodies verbatim.
  2. PR review-thread comments (convertToMinimalReviewComment) — comment bodies verbatim.
  3. Discussions (get_discussion / list_discussions / get_discussion_comments) — titles, bodies, and comment/reply bodies verbatim.

A hostile review or Discussion post could therefore carry hidden prompt-injection payloads into the context window, bypassing the baseline control its sibling issue/PR paths apply. Related prior: #3035 (issue comments + sub-issues).

Fix

Apply the same sanitize.Sanitize on those converters and Discussion response builders. No behavior change for clean content; lockdown-mode filtering is untouched and orthogonal.

Testing

go test ./pkg/github/ ./pkg/sanitize/ pass.

Made with Cursor

Issue/PR title and body reads already run through sanitize.Sanitize.
PR review bodies, review-thread comments, and Discussion title/body/comments
still returned raw attacker-controlled text into the model context.

Apply the same sanitize control on those sibling read paths. Clean content
is unchanged; lockdown filtering is untouched.
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.

1 participant