Repository navigation
ci(release): bind npm-publish to the main-only npm-release environment (TASK-470) #2623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔎 Supported by static analysis
Script executed:
Repository: Team-Commonly/commonly
Length of output: 11985
Do not treat the
npm-releaseenvironment reference as a branch security boundary.A branch copy of this workflow can remove
environment: npm-releaseand theGITHUB_REFcheck. GitHub applies the environment's deployment branch policy only to jobs that reference the environment. If the npm trusted-publisher binding for either package does not require that environment, the modified branch workflow can still obtain an OIDC token and publish.The comments at lines 76–81 and 128–135 call the environment reference a boundary. They should not. Verify the npm trusted-publisher configuration for both packages. Require the
npm-releaseenvironment in that configuration, and restrict who can dispatch this workflow.📝 Suggested comment update
# Bind the publish to the `npm-release` environment, whose deployment # branch policy is `main` only (TASK-470). GitHub refuses to start a # deployment to this environment from any other ref, so a publish # dispatched off a branch is rejected by the platform before the OIDC - # id-token is minted — a boundary the earlier in-workflow main-only - # check (a mistake-catcher, never a security boundary) could not give. + # id-token is minted. This applies only while this job references the + # environment; a branch copy of this file can omit the reference. environment: npm-release# A dispatch can name any branch. Publishing or tagging from one # would release code main does not hold. This catches a mistaken - # dispatch with a clear error; it is not the security boundary, - # because a branch's own copy of this file can drop it. The boundary - # is the `npm-release` environment above, whose main-only deployment - # branch policy GitHub enforces before this job starts (TASK-470), - # plus the trusted-publisher binding and who can dispatch. This check - # stays as the earlier, friendlier failure. + # dispatch with a clear error. It is not a security boundary, because + # a branch's own copy of this file can drop it. The environment + # reference above can be dropped the same way. The npm trusted-publisher + # binding must require the `npm-release` environment, and dispatch + # rights must be restricted to trusted users. if [ "$GITHUB_REF" != "refs/heads/main" ]; thenThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in f6bdac7 — the point is correct. The comments overstated
environment: npm-releaseas a branch-proof boundary. GitHub enforces the environment's deployment-branch policy only while this job references the environment, and a branch copy of the file can drop both that reference and theGITHUB_REFcheck.Reworded both comment blocks (lines ~76–83 and ~128–139) so neither in-file control is presented as a security boundary — they're mistake-catchers — and the comments now name the durable boundary explicitly: npm's trusted-publisher binding for each package (
@commonlyai/cli,@commonlyai/mcp) must require thenpm-releaseenvironment, and dispatch rights must be restricted.On the verification ask: that binding lives in npm's package settings, not in this repo, so the workflow file can't assert it. Confirming both packages' trusted-publisher config requires the
npm-releaseenvironment, and tightening dispatch permissions, is the operative hardening follow-up tracked under TASK-470 — not a change to this file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lilyshen0722 The supplied workflow confirms that both comment blocks now describe the limits correctly. No further comment change is needed.
The external security checks remain unverified. Under TASK-470, please provide confirmation that:
@commonlyai/cliand@commonlyai/mcprequirenpm-releasein their npm trusted-publisher settings.I’ll leave this finding open for that verification. Missing evidence does not establish that either configuration is incorrect.
✏️ Learnings added
You are interacting with an AI system.