autotrace 0.1.0 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dce37787636a8564e56fc6694fea1bbc27b2a484ff3f1ae0bf6bba498e1e76e0
4
- data.tar.gz: dce6102e09ddcfa1f46187a8935b118ea9a2094cbfbb1f7375caebe2fc14b349
3
+ metadata.gz: 7272a2b850e301d77b91293d841e67f51ae38f37ca7fe4ba5f1fff695a536f73
4
+ data.tar.gz: 0afb61a635355976b6f6ed9277da2f427e9f67b8e73cb572b7b4a3a266e2cd92
5
5
  SHA512:
6
- metadata.gz: b78ce717031ce4189cfd0ad409f948da4be9747d53d585b8c0726fa81d300d0fbd1493b2ed65e210b4a2cee1e91bc3977449bd4306fc0e0833c270f64cc6ed5a
7
- data.tar.gz: 83553a622e9900f3ad94b5d0594a7763a3c5278619c126d13d45680deeea04390a91bafe258f452f38cf3ebd1737c45b50e32fab88aeb935094f9a69e722ffde
6
+ metadata.gz: 3eb0e1ac38c154a616b3abf32e422cc645c4c6510c3aa15936cab379eb7b1517fb1ef991f1a213388a555f11c5748e2dc6834507820e2dcba50d115f4f19ebfb
7
+ data.tar.gz: f7a219dbc8d55b7adf142901cc2c3ead7b18155b9484a124250248b8a94c94bc37aeb98ac8557a93fff82d71d1bf6b8de4ed62cdbc6a2a155d386b26131f24e0
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Autotrace
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.9"
5
5
  end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ return if RUBY_ENGINE == "jruby"
4
+ return unless defined?(Gem)
5
+
6
+ require "rubygems/commands/push_command"
7
+
8
+ Gem::Commands::PushCommand.prepend(Module.new do
9
+ def send_push_request(name, args)
10
+ return super if options[:attestations]&.any? || @host != "https://rubygems.org"
11
+
12
+ begin
13
+ send_push_request_with_attestation(name, args)
14
+ rescue StandardError => e
15
+ alert_warning "Failed to push with attestation, retrying without attestation.\n#{e.full_message}"
16
+ super
17
+ end
18
+ end
19
+
20
+ def send_push_request_with_attestation(name, args)
21
+ attestation = attest!(name)
22
+ if options[:attestations]
23
+ options[:attestations] << attestation
24
+ send_push_request(name, args)
25
+ else
26
+ rubygems_api_request(*args, scope: get_push_scope) do |request|
27
+ request.set_form([
28
+ ["gem", Gem.read_binary(name), { filename: name, content_type: "application/octet-stream" }],
29
+ ["attestations", "[#{Gem.read_binary(attestation)}]", { content_type: "application/json" }]
30
+ ], "multipart/form-data")
31
+ request.add_field "Authorization", api_key
32
+ end
33
+ end
34
+ end
35
+
36
+ def attest!(name)
37
+ require "open3"
38
+ bundle = "#{name}.sigstore.json"
39
+ env = defined?(Bundler.unbundled_env) ? Bundler.unbundled_env : ENV.to_h
40
+ out, st = Open3.capture2e(
41
+ env,
42
+ Gem.ruby, "-S", "gem", "exec",
43
+ "sigstore-cli:0.2.1", "sign", name, "--bundle", bundle,
44
+ unsetenv_others: true
45
+ )
46
+ raise Gem::Exception, "Failed to sign gem:\n\n#{out}" unless st.success?
47
+
48
+ bundle
49
+ end
50
+ end)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autotrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Player
@@ -50,6 +50,7 @@ files:
50
50
  - lib/autotrace.rb
51
51
  - lib/autotrace/ffi.rb
52
52
  - lib/autotrace/version.rb
53
+ - rubygems_attestation_patch.rb
53
54
  homepage: https://github.com/851-labs/autotrace
54
55
  licenses:
55
56
  - MIT
@@ -72,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
73
  - !ruby/object:Gem::Version
73
74
  version: '0'
74
75
  requirements: []
75
- rubygems_version: 3.5.16
76
+ rubygems_version: 3.5.23
76
77
  signing_key:
77
78
  specification_version: 4
78
79
  summary: Ruby bindings for the Autotrace library