Upload attestation of gem provenance at release#16
Conversation
Since last year, RubyGems.org accepts Sigstore Bundles with Gem Pushes: https://github.com/rubygems/rfcs/blob/33b5ebddeb161e847cd950cc77fbaf667ff180bd/text/0000-rubygems.org-sigstore-bundles.md This uses sigstore-cli[1][2] to generate a sigstore bundle[3] that we include in the push to RubyGems.org. I got this command from rubygems/release-gem#11 I've tested this over at https://rubygems.org/gems/slenips https://github.com/spinels/slenips/blob/ae7cc4fa6d777f49ea0860acf0426b187c50a1fe/.github/workflows/release.yml#L25-L32 See also - https://segiddins.github.io/are-we-attested-yet/ - https://blog.rubygems.org/2025/03/19/february-rubygems-updates.html - https://blog.trailofbits.com/2024/11/14/attestations-a-new-generation-of-signatures-on-pypi/ 1: https://github.com/sigstore/sigstore-ruby 2: https://rubygems.org/gems/sigstore-cli 3: https://docs.sigstore.dev/about/bundle/
|
I'm intentionally not using the |
For example, it tries to push the tag (in a specific format) to your git repo. |
Example sigstore bundle for the curious: https://gist.github.com/dentarg/3133c87d404c951d47298aa9c08ff829 |
I missed that this gem do use |
Lazy reviewer just bought your reasoning too 😁 |
|
I do like that we record who pushed the tag in git Instead of it being pushed by "GitHub Actions" (maybe it is possible to configure that, dunno) |
|
I'm thinking we stick to the way it is now: #18 |
This adds sigstore attestations for our published gems. We do not need to provide an OIDC token to the sigstore client because by default it will request the token from the GitHub Actions environment: https://github.com/sigstore/sigstore-ruby/blob/9ac72d3c27edcd791c8c831316447f0ab7dfb407/cli/lib/sigstore/cli/id_token.rb#L45-L68 The code inspiration for this change came from: * 84codes/rubocop-eightyfourcodes#16 * rubygems/release-gem#11 You can see an example of how this attestation will look on RubyGems here: https://rubygems.org/gems/sigstore/versions/0.2.1
| - run: gem install *.gem | ||
| - run: gem push *.gem | ||
| - run: | | ||
| ruby -S gem exec sigstore-cli:0.2.1 sign *.gem --bundle attestation.sigstore.json |
There was a problem hiding this comment.
I'm curious... why did you do ruby -S here, versus all the other calls you do gem exec by itself?
There was a problem hiding this comment.
I just copied that from the rubygems/release-gem action: https://github.com/rubygems/release-gem/pull/11/files#diff-bbc4dcfa3b9d8c948a1e28efe575fb30910f0f05057fb22735e2245e90a0cbd8R40-R43
I'm not sure it is needed, I didn't think much of it. Actually, I never looked up what -S does, as I trusted @segiddins to know his shit :)
-S Makes Ruby use the PATH environment variable to search for
script, unless its name begins with a slash. This is used
to emulate #! on machines that don't support it, in the
following manner:
#! /usr/local/bin/ruby
# This line makes the next one a comment in Ruby \
exec /usr/local/bin/ruby -S $0 $*
On some systems $0 does not always contain the full
pathname, so you need the -S switch to tell Ruby to search
for the script if necessary (to handle embedded spaces and
such). A better construct than $* would be ${1+"$@"}, but
it does not work if the script is being interpreted by
csh(1).
Sounds like it doesn't really make sense on the command line, like here, but when using Open3.capture2e it makes more sense?
How did you find this PR @jeffwidman? :)
There was a problem hiding this comment.
Stumbled across it while researching dependabot/dependabot-core#12025 😄
This adds sigstore attestations for our published gems. We do not need to provide an OIDC token to the sigstore client because by default it will request the token from the GitHub Actions environment: https://github.com/sigstore/sigstore-ruby/blob/9ac72d3c27edcd791c8c831316447f0ab7dfb407/cli/lib/sigstore/cli/id_token.rb#L45-L68 The code inspiration for this change came from: * 84codes/rubocop-eightyfourcodes#16 * rubygems/release-gem#11 You can see an example of how this attestation will look on RubyGems here: https://rubygems.org/gems/sigstore/versions/0.2.1
This adds sigstore attestations for our published gems. We do not need to provide an OIDC token to the sigstore client because by default it will request the token from the GitHub Actions environment: https://github.com/sigstore/sigstore-ruby/blob/9ac72d3c27edcd791c8c831316447f0ab7dfb407/cli/lib/sigstore/cli/id_token.rb#L45-L68 The code inspiration for this change came from: * 84codes/rubocop-eightyfourcodes#16 * rubygems/release-gem#11 You can see an example of how this attestation will look on RubyGems here: https://rubygems.org/gems/sigstore/versions/0.2.1 Co-authored-by: Nish Sinha <nishnha@github.com>
Since last year, RubyGems.org accepts Sigstore Bundles with Gem Pushes: https://github.com/rubygems/rfcs/blob/33b5ebddeb161e847cd950cc77fbaf667ff180bd/text/0000-rubygems.org-sigstore-bundles.md
This uses sigstore-cli[1][2] to generate a sigstore bundle[3] that we include in the push to RubyGems.org.
I got this command from rubygems/release-gem#11 I've tested this over at https://rubygems.org/gems/slenips https://github.com/spinels/slenips/blob/ae7cc4fa6d777f49ea0860acf0426b187c50a1fe/.github/workflows/release.yml#L25-L32
See also
1: https://github.com/sigstore/sigstore-ruby
2: https://rubygems.org/gems/sigstore-cli
3: https://docs.sigstore.dev/about/bundle/