ci(ospo): gate npm publish behind environment + branch ruleset prep#145
Merged
Conversation
OSPO compliance: secrets used by publishing workflows must be scoped to a GitHub Environment with required reviewers and a tag-only deployment branch policy. NPM_TOKEN is now only injected when the publish job declares environment: npm-publish, and the environment restricts deployments to v* and agent-v* tags.
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.
Summary
OSPO compliance changes — part 1 (workflow side):
npm-publishGitHub Environmentnpm-publishGitHub EnvironmentThe
npm-publishenvironment was created out-of-band via the GitHub API with:v*oragent-v*can deployNPM_TOKENshould be moved from repo-level to environment-level so the token is unavailable to any other workflow / jobWhy
Repo-level secrets are accessible to every workflow run, including dependabot PR runs and any future workflow added by a contributor. Scoping
NPM_TOKENto an environment with required reviewers means a malicious workflow change can no longer exfil the token without a human approving the deployment.Follow-ups (not in this PR)
NPM_TOKENfrom repo secrets →npm-publishenvironment secrets (requires the actual token value)main(will be done after this PR merges)Test plan
gh workflow view release-hana-cli.ymlandgh workflow view release-agent-instructions.ymlPublish to npmjob awaiting reviewer approval — confirm the gate appearsnpm publishsucceeds with the environment-scoped token