{{ message }}
Repository navigation
Conversation
Issue and PR title/body responses are passed through sanitize.Sanitize (invisible-glyph, BiDi, HTML-tag and code-fence-metadata stripping), but the two remaining body-bearing read paths were not: - convertToMinimalIssueComment returned comment bodies verbatim, so every comment read delivered raw attacker-controlled content. - GetSubIssues marshalled sub-issues (title+body) verbatim. A hostile comment could therefore carry hidden prompt-injection content (invisible Unicode tag block, BiDi overrides) straight into the model context, bypassing the control applied on every sibling path. Apply the same sanitize.Sanitize call in both places.
…read paths Full Sanitize runs bluemonday, which escapes entities and silently truncates a fenced code block at the first '<'. Comment and review bodies are the most code-dense fields the server returns, so applying it there corrupts content delivered to the model. Add sanitize.FilterBody (invisible characters + code fence metadata, no HTML filtering) and use it for issue comment, PR review, PR review comment and sub-issue bodies. Titles keep the full Sanitize treatment. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b8dd0f23-2c6e-47c1-bad5-c1d0c9361f13
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b8dd0f23-2c6e-47c1-bad5-c1d0c9361f13
The remaining read paths still ran bodies through the HTML filter, which escapes entities and truncates a fenced code block at the first '<'. Bodies on issue_read and pull_request_read are as code-dense as comment bodies, so they get the same treatment. Titles keep the full Sanitize pass. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b8dd0f23-2c6e-47c1-bad5-c1d0c9361f13
IrynaKulakova
approved these changes
Aug 18, 2026
IrynaKulakova
left a comment
Contributor
There was a problem hiding this comment.
Approving. The read-path gap is real and the fix is now consistent across every body-bearing path.
Note that this PR was iterated on during review: bodies use sanitize.FilterBody (invisible characters + code-fence metadata) rather than the full Sanitize, because the bluemonday pass silently truncates a fenced code block at the first <. Titles still get the full treatment. Test coverage was added at the sanitize unit level, per-converter, and end-to-end through the issue_read handler.
Disclosure: I pushed the follow-up commits (57d4875, 9915997, 585519e) to this branch, so a second maintainer eye on those would be good before merge.
Author
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.

Problem
The server sanitizes issue/PR titles and bodies on read, but two body-bearing read paths missed the control entirely:
convertToMinimalIssueComment(minimal_types.go) — comment bodies were returned verbatim, so everyget_commentsread delivered raw attacker-controlled text.GetSubIssues(issues.go) — sub-issue titles/bodies were marshalled verbatim.A hostile comment or sub-issue could carry hidden prompt-injection payloads — invisible Unicode tag blocks or BiDi overrides, invisible to a human reviewer but legible to the model — straight into the context window.
Fixing that surfaced a second problem in the paths that were covered.
sanitize.Sanitizeends withFilterHTMLTags, which runs bluemonday over the content:Bodies are the most code-dense fields the server returns — generics, JSX, shell redirects, diffs. Truncating a fenced code block at the first
<corrupts the content delivered to the model, which is worse than the injection vector it defends against.Fix
Add
sanitize.FilterBody— invisible-character filtering plus code-fence metadata stripping, without the HTML pass — and use it for every body on a read path:convertToMinimalIssueComment)convertToMinimalPullRequestReview)convertToMinimalReviewComment)GetSubIssues)GetIssue,fragmentToMinimalIssue)GetPullRequest, PR list)Titles keep the full
sanitize.Sanitizetreatment: they are single-line and not code-bearing, so HTML filtering is safe there. Lockdown-mode filtering is untouched and orthogonal.The injection payloads that motivated this — Unicode tag characters (U+E0000 block), BiDi overrides, zero-width joiners, and hidden code-fence info strings — are all still stripped; only the HTML pass is dropped for bodies.
Testing
TestSanitizeBodyinpkg/sanitize: tag characters, BiDi overrides and hidden fence metadata are stripped; angle brackets, fenced code containing<, and HTML-like markup survive.pkg/github/minimal_types_test.go: per-converter coverage for comment, review, review-comment and GraphQL issue-fragment bodies.Test_GetSubIssues_Sanitization: end-to-end through theissue_readhandler.script/lintandscript/testpass. No tool schema or response-shape change, so toolsnaps and README are unaffected.