Skip to content

Check RubyGems Trusted Publishing before every release - #85

Merged
dblock merged 1 commit into
masterfrom
dblock/check-trusted-publishing
Nov 20, 2026
Merged

dblock merged 1 commit into
masterfrom
dblock/check-trusted-publishing

Conversation

@dblock

@dblock dblock commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add RubyGemsCredentials#check!. It performs the same OIDC token request and RubyGems exchange as publication, requires the push_rubygem scope, and returns the token's repository, job_workflow_ref, and environment claims 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.
  • A rejected exchange (from check! or the normal configure!) now names the token claims RubyGems matched against, without the token or response body.
  • Add Workflow::Preflight and a release:workflow:preflight task. With a RubyGems destination it runs the check; other destinations skip it.
  • Every release runs the preflight in both the reusable workflow and the composite action, right after context capture and before validation, edits, or publication. A missing trusted publisher or id-token: write permission now fails before anything is committed, pushed, or published.
  • Add a dry-run boolean input (default false) to the reusable workflow. It runs only the preflight, in a separate job in the same release environment, 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.yml passes the input through for this repository's own dry runs.
  • Docs: a release prerequisites reference, the dry run with a caller snippet, the composite-action equivalent, the 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) and actionlint.
  • New specs cover the check's masking, reported claims, pending-publisher owner, missing push scope, claim diagnostics on rejection, undecodable tokens and non-JSON responses, preflight skipping, the preflight step's position in both interfaces, and the dry-run and caller wiring.
  • Not validated: a real Actions run with OIDC. After merge, gh workflow run publish.yml --ref master -f dry-run=true exercises 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

@dblock
dblock force-pushed the dblock/check-trusted-publishing branch 2 times, most recently from c3ce51d to c02509d Compare November 20, 2026 22:53
@dblock dblock changed the title Check RubyGems Trusted Publishing in a dry run Check RubyGems Trusted Publishing before every release Nov 20, 2026
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
dblock force-pushed the dblock/check-trusted-publishing branch from c02509d to 9a27c3c Compare November 20, 2026 22:59
@dblock
dblock added this pull request to stack #87 November 20, 2026 23:02
@dblock
dblock merged commit cb35e9b into master Nov 20, 2026
11 checks passed
@dblock
dblock deleted the dblock/check-trusted-publishing branch November 20, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant