acme-client 2.0.34 → 2.0.36

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: 89c12bcb307e446e08b101e2ceade09f0edb11bbdbac66406706bf3cc5235f2d
4
- data.tar.gz: cf2b1335b4e3080c344fd685731d41d15340265e152037ac9fe4c8e362f8199b
3
+ metadata.gz: d4ab7c4f62fe9ee94eb105e8924b8e5689269de9ca768003dc996bdc378b95fa
4
+ data.tar.gz: f53abdfe758d06c8ebdd82e2e732152abe6dc2bdada7499bcb71b42584fae966
5
5
  SHA512:
6
- metadata.gz: b0a658e05c3d12188e8615cc0bad63b23649b0839fe96352cc3362be6a567e5b05527f94b645bbee093830a8f2f8e12ca39ca422f44bfa6f479e50e1740d1035
7
- data.tar.gz: 00b4f8042dbae77cd3ae156b650f7a63927c6628142ba4b65831892937b237b096b4f00f944436444d3078afc7b2c36f50cef5a17f392a48e2de43b6a656d75b
6
+ metadata.gz: 10e1928f15b1e9842eb4a6dc7601440721ad43e1ca150bc3919dd51327dc22cf9a95c497ebf9a5acfd03daae951733f6a01eaf1b081630ac4baba7ef656233ec
7
+ data.tar.gz: f75213b52a604e85c8ae3e32dc4b3ceb51be3de75f6702516eb781c57c0c38d90677c1828df809cdfe1030447ec71c7ca05d817f83dbde55d8027f609d4661af
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## `2.0.36`
2
+
3
+ * Fix ARI certificate identifier for serials with the high bit set: keep the DER sign byte, as required by RFC 9773
4
+ * Fix `Account#update` ignoring its `terms_of_service_agreed:` argument
5
+ * Parse ACME JSON responses with `JSON.parse` instead of `JSON.load`, so a response cannot instantiate arbitrary classes via `json_class`
6
+
7
+ ## `2.0.35`
8
+
9
+ * Expose the RFC 8555 order `error` field on `Resources::Order#error` and add `Order#typed_error`
10
+
1
11
  ## `2.0.34`
2
12
 
3
13
  * Add badAttestationStatement error
data/README.md CHANGED
@@ -224,6 +224,15 @@ end
224
224
  order.certificate # => PEM-formatted certificate
225
225
  ```
226
226
 
227
+ When the server fails issuance after accepting the finalize request, the order moves to `invalid` and carries a problem document explaining why.
228
+
229
+ ```ruby
230
+ if order.status == 'invalid'
231
+ order.error # => { "type" => "urn:ietf:params:acme:error:rateLimited", "detail" => "..." }
232
+ order.typed_error # => Acme::Client::Error::RateLimited
233
+ end
234
+ ```
235
+
227
236
  ### Ordering an alternative certificate
228
237
 
229
238
  The provider may provide alternate certificate with different certificate chain. You can specify the required chain and the client will automatically download alternate certificate and match the chain by name.
data/Rakefile CHANGED
@@ -3,4 +3,9 @@ require 'bundler/gem_tasks'
3
3
  require 'rspec/core/rake_task'
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
+ desc 'Check the gem against the live IANA ACME error registry'
7
+ task :spec_iana_registry do
8
+ sh({ 'RUN_IANA_REGISTRY_SPEC' => '1' }, 'bundle exec rspec spec/iana_registry_spec.rb')
9
+ end
10
+
6
11
  task default: [:spec]
@@ -138,7 +138,7 @@ module Acme::Client::HTTPClient
138
138
  content_type = env.response_headers['Content-Type'].to_s
139
139
 
140
140
  if content_type.start_with?('application/json', 'application/problem+json')
141
- JSON.load(env.body)
141
+ JSON.parse(env.body) unless env.body.nil? || env.body.empty?
142
142
  else
143
143
  env.body
144
144
  end
@@ -14,7 +14,7 @@ class Acme::Client::Resources::Account
14
14
 
15
15
  def update(contact: nil, terms_of_service_agreed: nil)
16
16
  assign_attributes(**@client.account_update(
17
- contact: contact, terms_of_service_agreed: term_of_service
17
+ contact: contact, terms_of_service_agreed: terms_of_service_agreed
18
18
  ).to_h)
19
19
  true
20
20
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Acme::Client::Resources::Order
4
- attr_reader :url, :status, :contact, :finalize_url, :identifiers, :authorization_urls, :expires, :certificate_url, :profile, :replaces, :retry_after, :retry_after_time
4
+ attr_reader :url, :status, :contact, :finalize_url, :identifiers, :authorization_urls, :expires, :certificate_url, :profile, :replaces, :error, :retry_after, :retry_after_time
5
5
 
6
6
  def initialize(client, **arguments)
7
7
  @client = client
@@ -46,6 +46,16 @@ class Acme::Client::Resources::Order
46
46
  @client.renewal_info(certificate:, ari_id:)
47
47
  end
48
48
 
49
+ def typed_error
50
+ return nil unless error
51
+
52
+ problem = Acme::Client::Problem.from(error)
53
+ error_type = problem&.type
54
+ error_detail = problem&.detail || 'Unknown error'
55
+ error_class = Acme::Client::Error::ACME_ERRORS.fetch(error_type, Acme::Client::Error)
56
+ error_class.new(error_detail, problem: problem)
57
+ end
58
+
49
59
  def to_h
50
60
  {
51
61
  url: url,
@@ -57,13 +67,14 @@ class Acme::Client::Resources::Order
57
67
  certificate_url: certificate_url,
58
68
  profile: profile,
59
69
  replaces: replaces,
70
+ error: error,
60
71
  retry_after: retry_after
61
72
  }
62
73
  end
63
74
 
64
75
  private
65
76
 
66
- def assign_attributes(url: nil, status:, expires:, finalize_url:, authorization_urls:, identifiers:, certificate_url: nil, profile: nil, replaces: nil, retry_after: nil) # rubocop:disable Layout/LineLength,Metrics/ParameterLists
77
+ def assign_attributes(url: nil, status:, expires:, finalize_url:, authorization_urls:, identifiers:, certificate_url: nil, profile: nil, replaces: nil, error: nil, retry_after: nil) # rubocop:disable Layout/LineLength,Metrics/ParameterLists
67
78
  @url = url unless url.nil?
68
79
  @status = status
69
80
  @expires = expires
@@ -73,6 +84,7 @@ class Acme::Client::Resources::Order
73
84
  @certificate_url = certificate_url
74
85
  @profile = profile
75
86
  @replaces = replaces
87
+ @error = error
76
88
  @retry_after = retry_after
77
89
  @retry_after_time = Acme::Client::Util.parse_retry_after(retry_after)
78
90
  end
@@ -80,7 +80,9 @@ module Acme::Client::Util
80
80
 
81
81
  key_identifier = hex_string.split(':').map { |hex| hex.to_i(16).chr }.join
82
82
  serial_der = OpenSSL::ASN1::Integer.new(cert.serial).to_der
83
- serial_value = OpenSSL::ASN1.decode(serial_der).value.to_s(2)
83
+ header_length = 0
84
+ OpenSSL::ASN1.traverse(serial_der) { |_depth, _offset, header_len| header_length = header_len }
85
+ serial_value = serial_der.byteslice(header_length..-1)
84
86
 
85
87
  aki_b64 = urlsafe_base64(key_identifier)
86
88
  serial_b64 = urlsafe_base64(serial_value)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Acme
4
4
  class Client
5
- VERSION = '2.0.34'.freeze
5
+ VERSION = '2.0.36'.freeze
6
6
  end
7
7
  end
data/lib/acme/client.rb CHANGED
@@ -323,7 +323,8 @@ class Acme::Client
323
323
  [:certificate_url, 'certificate'],
324
324
  :identifiers,
325
325
  :profile,
326
- :replaces
326
+ :replaces,
327
+ :error
327
328
  )
328
329
 
329
330
  attributes[:url] = response.headers[:location] if response.headers[:location]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acme-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.34
4
+ version: 2.0.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Barbier
@@ -172,7 +172,6 @@ files:
172
172
  - LICENSE.txt
173
173
  - README.md
174
174
  - Rakefile
175
- - acme-client-2.0.32.gem
176
175
  - acme-client.gemspec
177
176
  - bin/console
178
177
  - bin/generate_keystash
Binary file