ci: fix expression injection in notify-on-review-wanted workflow #63720
Open
XananasX7 wants to merge 2 commits into
Open
ci: fix expression injection in notify-on-review-wanted workflow
#63720XananasX7 wants to merge 2 commits into
XananasX7 wants to merge 2 commits into
Conversation
The workflow used GitHub Actions expressions directly inside shell run steps:
if [[ -n "${{ github.event.pull_request.number }}" ]]; then
number="${{ github.event.pull_request.number }}"
number="${{ github.event.issue.number }}"
Fix: move expressions into env vars, reference env vars in shell.
Ref: https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#understanding-the-risk-of-script-injections
Signed-off-by: El Mehdi Abenhazou <mehdiananas007@gmail.com>
Collaborator
|
Review requested:
|
Member
|
These are non-user-controlled numeric variables, so shell escaping is not a concern here? We already pass string variables appropriately. |
Author
|
That's a fair point — That said, I'd argue the env-var approach still has value even for numeric inputs:
Happy to close this if the team prefers to keep the existing style — just wanted to explain the rationale. Up to you. |
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.
The
.github/workflows/notify-on-review-wanted.ymlworkflow injects GitHub Actions expressions directly into a shell run step. This is flagged by zizmor/actionlint and violates GitHub's security hardening guidelines. Fix: use env vars instead of inline expressions.