Repository navigation
ci(release): gate RubyGems publishing behind an environment and verify publish_tag - #132
Merged
mogita merged 4 commits intoNov 25, 2026
Merged
Conversation
…y publish_tag Run the publish job in the rubygems environment. Check out publish_tag as refs/tags/<tag>, and publish it only if its commit is on the release branch the run was dispatched from. Part of SEC-2515. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g check Review follow-up. Reject revision syntax such as v1.2.3~1, which resolved to an untagged commit, and accept only the default branch or a branch named N.x, since *.x also matched feature/foo.x. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The workflow triggers on any *.x branch, so a 4.1.x hotfix branch has to pass this check too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mogita
approved these changes
Nov 25, 2026
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.
What
publishjob runs in a newrubygemsenvironment.publish_tagis checked out asrefs/tags/<tag>, so a value that names a branch or a SHA no longer checks anything out.publish_tagis exactly a tag (git show-ref --verify, so revision syntax such asv1.2.3~1is rejected); the run comes from the default branch or anN.xbranch; and the tag's commit is on that branch (git merge-base --is-ancestor). Before this, any tag could be published, including one pushed on a commit that was never reviewed.Why
Security audit finding CI-03. Part of SEC-2515. The RubyGems OIDC publish job had no environment gate, and it checked out any
publish_tagit was given.Settings needed for this to take effect
A run from another branch uses that branch's copy of
release.yml, so these settings, not the in-workflow checks, are what stop a modified copy:rubygemsenvironment: GitHub creates it with no protection on the first run. Add required reviewers, and set deployment branches tomasterand*.x. Protect*.xwith a branch ruleset first (SEC-2513).getstream-ruby→ Trusted Publisher: set the environment torubygems. Once RubyGems has an environment set, it rejects tokens from any other environment.refs/tags/v*. release-please creates the tags with this workflow'sGITHUB_TOKEN, so the ruleset must let GitHub Actions through, or releases stop getting tagged. Letting GitHub Actions through also lets any workflow withcontents: writecreate tags. Tagging with getstream-sdk-bot instead would let the ruleset trust only that app.Merge order
rubygemsenvironment as listed above.rubygemson the rubygems.org trusted publisher. Don't pin it before this PR merges: the current job runs without an environment, so a pinned publisher would reject its token.Behaviour change
publish_taghas to be dispatched from itsN.xbranch, notmaster.Testing
actionlint1.7.12 withshellcheck0.11.0: no new findings.🤖 Generated with Claude Code