Primary finding
Unescaped user-controlled text in PR comments can trigger unintended GitHub mentions/formatting
- apps/web/lib/pr-comment.ts:43
- apps/web/lib/pr-comment.ts:48-50
- apps/web/lib/pr-comment.ts:107
Finding titles, reasoning, and recommendations are inserted directly into Markdown without escaping. While GitHub sanitizes raw HTML, Markdown mentions like @org/team or #123 will still resolve and may ping users or cross-link unexpectedly. Agent-produced content could include such tokens, causing notification spam or misleading formatting in posted comments and receipts.
Recommendation
Sanitize user-provided strings before interpolation: at minimum, neutralize mention and autolink tokens (e.g., replace "@" with "@\u200b" or "@"), and escape Markdown-reserved characters where appropriate. Alternatively, wrap dynamic text in code spans to prevent Markdown interpretation. Add a small sanitizer used by both formatPRComment and formatClosureReceipt.