Repository navigation
ci(ENG-4207): publish an existing release tag to npm on demand - #161
Conversation
When the publish step fails after release-please has cut the release, a re-run skips publishing because the release already exists. A manual run with a tag (e.g. defender-v0.9.6) now checks out that tag, checks package.json matches it, builds and publishes, with the same steps and token as the release job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| - name: Checkout Repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: refs/tags/${{ inputs.tag }} |
There was a problem hiding this comment.
🟠 High - Manual publish accepts attacker-created release tags
A repository user with write access can create an unprotected defender-vX.Y.Z tag on an arbitrary commit, set its package.json version to match, and dispatch this workflow. The job then runs that tag's package-defined build and publish scripts with NPM_TOKEN, allowing unauthorized publication of attacker-controlled package contents and potentially disclosure or misuse of the npm credential.
Show fix
Restrict this recovery path to release tags whose commits are authenticated and reachable from the protected release history, or require an approval-gated environment and an explicit allowlist of release actors. Do not rely only on the tag spelling and package version; independently verify tag provenance/immutability and consider replacing the long-lived npm token with a narrowly scoped, approval-protected publishing credential.
More info - Reply on this comment to give feedback or ignore the issue.
It published defender-v0.9.6 after the release job's npm token failed. Publishing is back on the release job, so the manual path isn't needed. This reverts #161. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
What
Adds a manual
workflow_dispatchtrigger torelease-please.ymlthat publishes an existing release tag to npm.Why: when the publish step fails after release-please has cut the release, re-running the job doesn't help. release-please sees the release already exists, reports nothing released, and skips every publish step. That's what happened to
defender-v0.9.6.How: run the workflow from the Actions tab with a tag, e.g.
defender-v0.9.6. The newpublish-tagjob:defender-vX.Y.Z);package.json's version matches the tag;NPM_TOKENas the release job.On a push to
main, only the release-please job runs, as before.🤖 Generated with Claude Code
Summary by cubic
Adds a manual workflow trigger to
release-please.ymlto publish an existing release tag to npm when the publish step fails after release-please has already cut the release.publish-tagjob checks the tag format, checks out the tag with LFS, verifiespackage.jsonmatches the tag, then builds and publishes using the same steps andNPM_TOKENas the release job.main, only the release-please job runs, keeping the existing behavior.Written for commit 1716a39. Summary will update on new commits.