Skip to content

[MEDIUM] Harden RubyGems publication inputs - #63

Open
OskarEichler wants to merge 1 commit into
lostisland:mainfrom
OskarEichler:codex/security-harden-release-inputs
Open

OskarEichler wants to merge 1 commit into
lostisland:mainfrom
OskarEichler:codex/security-harden-release-inputs

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Summary

This hardens the RubyGems publication boundary in two focused ways:

  • pins every third-party action in the privileged release job to a reviewed full commit SHA and disables checkout credential persistence
  • uses a small, checksummed release-only bundle instead of resolving the unlocked development graph and its unpinned Faraday Git source

The release job keeps its existing bundle exec rake release flow. Gemfile.release contains only the local gemspec, Rake, and RSpec because the Rakefile loads both libraries before defining the release task.

Security impact

The current release job grants contents: write and id-token: write to the whole job. It then executes three actions through mutable major tags and performs Bundler resolution from a Gemfile that follows lostisland/faraday's default branch without a lockfile. A compromised action tag or allowed dependency source could therefore affect the release workspace or package while publication authority is available.

The patch binds the action code to these reviewed releases:

  • actions/checkout v7.0.1
  • ruby/setup-ruby v1.321.0
  • rubygems/release-gem v1.4.1

The release bundle resolves 10 gems including the local package; every remote gem has a SHA-256 checksum in Gemfile.release.lock.

Verification

  • Ruby 4.0.6: 386 RSpec examples, zero failures; 10 RuboCop files, no offenses; all runtime Ruby syntax checks passed
  • Ruby 3.2.11: 386 RSpec examples, zero failures; 10 RuboCop files, no offenses; all runtime Ruby syntax checks passed
  • release-only bundle installed and passed bundle check on both Rubies
  • bundle exec rake build produced the gem on both Rubies
  • unpacked package files were byte-identical between Ruby 4.0.6 and 3.2.11 and byte-identical to the five package-selected files on current main
  • package metadata stayed unchanged: version 3.4.4, platform ruby, Ruby >= 3.0.0, and net-http ~> 0.5
  • workflow YAML parsed successfully and git diff --check passed

No tests were added or modified.

Limitations

I did not run an actual RubyGems OIDC publication or inspect repository-level branch, environment, and trusted-publisher settings. The existing release action still requires contents: write because its release task pushes the version tag.

Breaking changes

No runtime or package-contract breaking changes. Release maintenance now requires explicit lockfile refreshes when build dependencies are updated; the release workflow uses the checked-in Bundler 4 lock with its existing Ruby 3.4.4 toolchain.

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