ci(publish): pass release tag via env to avoid script injection
Re-review nit: interpolating `${{ github.event.release.tag_name }}` directly
into the `run:` block is a script-injection surface (a crafted tag with shell
metacharacters would splice into the script). Pass it through `env: TAG` so it
arrives as a plain shell variable instead. Purely defensive; no behavior change.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BrihGWcrM9JGRyu41nzZYw
This commit is contained in:
parent
59b2ebacb4
commit
85d5bd447e
1 changed files with 5 additions and 2 deletions
7
.github/workflows/main.yml
vendored
7
.github/workflows/main.yml
vendored
|
|
@ -116,10 +116,13 @@ jobs:
|
|||
# pack:verify) if they disagree — e.g. a release drafted without running
|
||||
# `npm version`, or cut from the wrong commit — since publishing is
|
||||
# irreversible. Tolerates the conventional leading `v` (npm version tags
|
||||
# as `vX.Y.Z`).
|
||||
# as `vX.Y.Z`). The tag arrives via `env:` (not spliced into the script)
|
||||
# to avoid the script-injection surface of interpolating `${{ }}` into a
|
||||
# `run:` block.
|
||||
env:
|
||||
TAG: ${{ github.event.release.tag_name }}
|
||||
run: |
|
||||
PKG="$(node -p "require('./package.json').version")"
|
||||
TAG="${{ github.event.release.tag_name }}"
|
||||
if [ "${TAG#v}" != "$PKG" ]; then
|
||||
echo "Release tag '$TAG' does not match package.json version '$PKG'"
|
||||
exit 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue