ci: pass --branch through env and quote it - #2461
Open
kobihikri wants to merge 3 commits into
Open
Conversation
Borda
approved these changes
Jul 28, 2026
Member
@kobihikri ^^ 🦝 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2461 +/- ##
=======================================
Coverage 87% 87%
=======================================
Files 85 85
Lines 12021 12021
=======================================
Hits 10424 10424
Misses 1597 1597 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the reusable workflow_call GitHub Actions workflow by ensuring the branch name is passed to the README augmentation script as a properly quoted runtime argument, rather than being interpolated into the shell command text.
Changes:
- Move
${{ github.head_ref || github.ref_name }}into a step-level environment variable (BRANCH_REF). - Quote the branch argument in the
augment_links.pyinvocation to avoid shell word-splitting and prevent branch-name characters from being interpreted by the shell.
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.
Hi, and thanks for supervision.
In
.github/workflows/build-package.yml, the branch name is passed to the README script by interpolation, unquoted:Actions expands
${{ ... }}into the script text before bash runs, so the branch name becomes part of the command rather than an argument to the script. Git allows$,(,), backticks and spaces in branch names, and$(...)runs inside double quotes — and being unquoted here, a name containing a space would also split into two arguments, soaugment_links.pywould receive a truncated--branchvalue.Scope, honestly: this is a reusable
workflow_callworkflow, and where it is called frompull_requesta fork PR has a read-only token and no secrets. I am raising it as hardening and argument-robustness rather than as a live exploit.The change passes the value through
env:and quotes it:The
||fallback is preserved by keeping the whole expression in theenv:value, so the script receives the same branch string it does today, andcat README.mdis untouched.Disclosure: I used AI assistance to help spot this and prepare the change, and I read the workflow myself.