Honor global mention allowlists in add-comment sanitization#42313
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes a safe-outputs mention-sanitization regression where add_comment was re-sanitizing bodies with a narrower allowlist than the one already resolved earlier in the pipeline, causing globally-allowed mentions (e.g., from teams/collaborators) to be escaped before posting.
Changes:
- Extend
add_comment’s final sanitization pass to include handler-manager-providedallowedMentionAliases(in addition to parent author +mentions.allowed). - Add a regression test ensuring a pre-resolved alias survives the final sanitizer and is posted as a real
@mention. - Minor readability-only refactor in the dashboard CLI child-process buffering logic (expanded single-line
ifblocks).
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/add_comment.cjs | Threads pre-resolved allowedMentionAliases into the final sanitizeContent() allowlist used when posting comments. |
| actions/setup/js/add_comment.test.cjs | Adds regression coverage verifying pre-resolved aliases are not neutralized during the final sanitize pass. |
| .github/extensions/agentic-workflows-dashboard/dashboard-cli.mjs | Expands overflow checks into block form for clearer control flow; no functional change intended. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Low
| const mentionsDisabled = config.mentions === false || config.mentions?.enabled === false; | ||
| const preResolvedMentionAliases = | ||
| !mentionsDisabled && Array.isArray(config.allowedMentionAliases) ? config.allowedMentionAliases.map(alias => (typeof alias === "string" ? alias.trim().replace(/^@+/, "") : "")).filter(alias => alias.length > 0) : []; | ||
| const configuredMentionAliases = | ||
| !mentionsDisabled && Array.isArray(config.mentions?.allowed) ? config.mentions.allowed.map(alias => (typeof alias === "string" ? alias.trim().replace(/^@+/, "") : "")).filter(alias => alias.length > 0) : []; |
🔍 PR Triage — §28395315609
Score breakdown: impact 25 + urgency 15 + quality 16
|
|
@copilot run pr-finisher skill |
|
@copilot Please run the
|
add_commentwas re-sanitizing comment bodies with a narrower allowlist than the one resolved earlier in the safe-outputs pipeline. As a result, mentions allowed via globalsafe-outputs.mentionssettings—especiallyallowed-teamsand collaborator/context-derived aliases—were being escaped before posting.Bug fix: preserve resolved mention aliases in
add_commentallowedMentionAliasesin the finaladd_commentsanitization passmentions.allowedbehavior intactadd_commentwith the global mention resolution already used earlier in the runRegression coverage
@mentionEffective behavior
This keeps the final sanitizer consistent with the resolved global mentions policy instead of collapsing back to comment-local aliases only.