ci: harden security-review.yml against script injection#3365
Open
nebeid wants to merge 1 commit into
Open
Conversation
Move untrusted github.event.* values (repository.name,
pull_request.number, pull_request.head.sha) into env: vars and
reference them as quoted shell variables instead of interpolating
${{ }} templates directly into run: blocks.
Same hardening applied in
aws@8afd2f6
which covered the other workflows but not security-review.yml.
Contributor
|
🔒 Security Review — View Report Please review before merging. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3365 +/- ##
=======================================
Coverage 78.20% 78.20%
=======================================
Files 695 695
Lines 124172 124172
Branches 17238 17239 +1
=======================================
+ Hits 97104 97106 +2
+ Misses 26147 26145 -2
Partials 921 921 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
geedo0
approved these changes
Jul 21, 2026
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.
Issues:
Addresses V2265233159
Description of changes:
Continuation of 8afd2f6, extending the same script-injection hardening to
security-review.yml.Directly interpolating
${{ github.event.* }}context expressions intorun:shell bodies lets Actions splice them in as text before the shell runs — a script-injection risk. This PR hoists each flagged value into the step'senv:block and references it as a quoted shell variable instead. Behavior is unchanged.Update commit status: hoistgithub.event.repository.name,github.event.pull_request.number, andgithub.event.pull_request.head.shaintoenv.Post review comment: hoistgithub.event.repository.nameandgithub.event.pull_request.numberintoenv.Call-outs:
pull_request_target, so hardening these interpolations matters even though the flagged fields (repo name, PR number, commit SHA) are format-constrained.${{ github.repository }}is left inline — it is notgithub.event.*attacker-influenced input.Testing:
CI-config-only, no product code impact. File parses as valid YAML; no
${{ github.event.* }}interpolations remain in anyrun:body.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.