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 +4 -4
- data/lib/autotrace/version.rb +1 -1
- data/rubygems_attestation_patch.rb +50 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7272a2b850e301d77b91293d841e67f51ae38f37ca7fe4ba5f1fff695a536f73
|
4
|
+
data.tar.gz: 0afb61a635355976b6f6ed9277da2f427e9f67b8e73cb572b7b4a3a266e2cd92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3eb0e1ac38c154a616b3abf32e422cc645c4c6510c3aa15936cab379eb7b1517fb1ef991f1a213388a555f11c5748e2dc6834507820e2dcba50d115f4f19ebfb
|
7
|
+
data.tar.gz: f7a219dbc8d55b7adf142901cc2c3ead7b18155b9484a124250248b8a94c94bc37aeb98ac8557a93fff82d71d1bf6b8de4ed62cdbc6a2a155d386b26131f24e0
|
data/lib/autotrace/version.rb
CHANGED
@@ -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.
|
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.
|
76
|
+
rubygems_version: 3.5.23
|
76
77
|
signing_key:
|
77
78
|
specification_version: 4
|
78
79
|
summary: Ruby bindings for the Autotrace library
|