Repository navigation
Check RubyGems Trusted Publishing before every release - #85
Merged
Merged
Conversation
dblock
force-pushed
the
dblock/check-trusted-publishing
branch
2 times, most recently
from
November 20, 2026 22:53
c3ce51d to
c02509d
Compare
Add RubyGemsCredentials#check!, which performs the real OIDC token request and exchange, verifies push_rubygem scope, and reports the matched repository, workflow, and environment claims without exporting the short-lived credential. Rejected exchanges now name those claims. A Workflow::Preflight runner and release:workflow:preflight task run the check, skipping it for non-RubyGems destinations. Both Actions interfaces run it after context capture, before validation, edits, or publication, so a missing publisher or id-token permission fails before anything is pushed or published. The reusable workflow's dry-run input runs only the preflight in the release environment; the self-release caller passes it through. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011Gr21hZDQo5axDMuFgzL6s
dblock
force-pushed
the
dblock/check-trusted-publishing
branch
from
November 20, 2026 22:59
c02509d to
9a27c3c
Compare
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
RubyGemsCredentials#check!. It performs the same OIDC token request and RubyGems exchange as publication, requires thepush_rubygemscope, and returns the token'srepository,job_workflow_ref, andenvironmentclaims with the credential's scopes and expiry. It masks both credentials and exports nothing; the exchanged key expires after 15 minutes unused, and publication performs its own exchange.check!or the normalconfigure!) now names the token claims RubyGems matched against, without the token or response body.Workflow::Preflightand arelease:workflow:preflighttask. With a RubyGems destination it runs the check; other destinations skip it.id-token: writepermission now fails before anything is committed, pushed, or published.dry-runboolean input (defaultfalse) to the reusable workflow. It runs only the preflight, in a separate job in the samereleaseenvironment, so required reviewers still approve it and RubyGems sees the same workflow and environment claims. That job checks out without persisted credentials and never edits, pushes, builds, or publishes.publish.ymlpasses the input through for this repository's own dry runs.check!contract, and links from README and RELEASING.Limits, documented: RubyGems does not report which gems a trusted publisher is attached to, so the check cannot confirm the publisher belongs to this gem, or that RubyGems would accept the package. The README caller sample is unchanged because it pins
v0.7.0, which does not accept the new input.A GitHub permission check follows as a stacked PR.
Validation
PARALLEL_TEST_PROCESSORS=4 bundle exec rake(446 examples, 0 failures; RuboCop no offenses) andactionlint.gh workflow run publish.yml --ref master -f dry-run=trueexercises it against this repository's trusted publisher.Authored by an AI (Claude) acting on behalf of @dblock.
🤖 Generated with Claude Code
https://claude.ai/code/session_011Gr21hZDQo5axDMuFgzL6s