github-mcp-server
github-mcp-server copied to clipboard
fix(sanitize): preserve angle brackets inside markdown code
Summary
- Fix issue read responses dropping text like
<int>inside markdown code blocks becausebluemonday.StrictPolicy()treats unknown angle-bracket tokens as HTML tags - Protect
<and>inside fenced code blocks and inline code spans with sentinels before HTML sanitization, then restore them afterward - Strip NUL bytes before protection to prevent sentinel collision attacks
Root cause
FilterHTMLTags runs bluemonday on the full issue/PR body. Content such as mut_raw_ptr<int> is parsed as an unrecognized HTML tag and removed, so MCP clients see mut_raw_ptr instead.
Test plan
- [x]
go test ./pkg/sanitize/... - [x]
go test ./pkg/github/... -run Test_GetIssue_PreservesAngleBracketsInCodeBlocks - [x]
./script/lint - [x] Verified fenced code blocks preserve
mut_raw_ptr<int> - [x] Verified inline code preserves
Vec<String> - [x] Verified
<script>outside code is still stripped
Closes #2202
Merge-ready check-in
This PR looks ready for maintainer review/merge when you have a moment.
- Change: fix(sanitize): preserve angle brackets inside markdown code
- CI: green / passing
- Review: REVIEW_REQUIRED (mergeable: MERGEABLE)
Happy to rebase or address any remaining feedback. Thanks for maintaining the project.