ci: fix expression injection in slack-issue-notification workflow#896
Open
anishesg wants to merge 1 commit intoanthropics:mainfrom
Open
ci: fix expression injection in slack-issue-notification workflow#896anishesg wants to merge 1 commit intoanthropics:mainfrom
anishesg wants to merge 1 commit intoanthropics:mainfrom
Conversation
## Problem Signed-off-by: anish k <ak8686@princeton.edu>
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
.github/workflows/slack-issue-notification.ymlinterpolatedgithub.event.issue.titledirectly into the Slack payload JSON string (line 25). Because theslackapi/slack-github-actionv2.1.1 passes the payload throughjs-yaml(which uses last-wins semantics on duplicate keys), a crafted issue title containing JSON/YAML syntax can inject arbitrary extra Slack message blocks. A HackerOne researcher demonstrated this with a title containing a"}},{"type":"section",...payload that successfully appended an extra section to the posted Slack message.Fix
Replaced the inline expression interpolation with a dedicated
jqstep that constructs the JSON payload fromenv:variables. All untrusted values (ISSUE_TITLE,ISSUE_AUTHOR, etc.) are passed as--argstrings tojq -n, so they are treated as opaque literals and any embedded JSON/YAML syntax is properly escaped before the payload is handed to the Slack action.Fixes #895