Conversation
Pass workflow_dispatch inputs to shell scripts through env instead of
${{ }} substitution, and validate the npm dist-tag alongside the version
in the first step so a malformed tag fails before install or publish.
commit: |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Inputs reach the shell only via
env—versionandtagare wired throughenv:(VERSION,TAG_INPUT,TAG,NO_GIT_CHECKS), and no${{ }}expression remains inside anyrun:block, so the template-injection vector is closed. - Validation moved ahead of side effects — the version format check now runs first, so a malformed value can no longer execute before being rejected.
- Dist-tag validated —
^[a-z][a-z0-9._-]*$blocks option-like values (e.g.x --registry=…) before they can reachpnpm publish; the${TAG_INPUT:-${PREID:-latest}}fallback preserves the previoustag || preid || 'latest'semantics. - Boolean skip flags —
!inputs.skip_bump/!inputs.skip_changelogreplace the string comparisons againstgithub.event.inputs.*, which is type-correct for the declaredbooleaninputs. - Reduced output surface — only the
tagoutput is emitted now; grep confirms no file references the removedmajor/minor/patch/preid/numberoutputs.
The $NO_GIT_CHECKS expansion is intentionally unquoted and only ever resolves to --no-git-checks or an empty string from a constant expression, so it adds no argument when unset and is not attacker-controlled. inputs at job-level env and step-level if is valid for workflow_dispatch, and BASH_REMATCH[5] is correctly populated because the negated =~ match still records capture groups.
DeepSeek Flash (default — pick a model for stronger reviews) | 𝕏
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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 release workflow substituted its
workflow_dispatchinputs (version,tag) directly into shell scripts, so a crafted value could run arbitrary commands in the job that publishes to npm with provenance (id-token: write). The version check didn't help, because it ran after the substituted line had already executed. Inputs now reach the scripts only as environment variables, and both the version and the dist-tag are validated in the first step, before anything is installed, bumped or published.Fixes
versionortaginputs no longer execute: no${{ }}expression remains inside anyrun:scriptx --registry=…) now fail the run immediately instead of reachingpnpm publisha-z,0-9,.,_or-Testing
act, with bump/changelog/publish commands replaced by argument printers. Valid inputs (stable, prerelease, explicit tag, every skip flag on/off) produce identical commands; payloads that executed on the original are rejected in the first step$NO_GIT_CHECKS, so an empty value adds no argument