shopify_api 11.0.0 → 11.0.1

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: e6ef6d1ca6d9c8e54ddd8fd1c4ca34fdb015e2fe1157c1a101810c8036a69b02
4
- data.tar.gz: 94cf5af5bf1e14d8fa1728bb87d0c138f92bebcdbb16d47885a2e2ce73ffba81
3
+ metadata.gz: 480de35765a695c4111ca43f241270a12a7eb4a22c83844fa5820a27ac829125
4
+ data.tar.gz: 5d20da61c0cad987a0b6048cf6a10460af29e80df2d7c89617e24e12fc5f1049
5
5
  SHA512:
6
- metadata.gz: 505926c8d97d9ec73a4dbab76ff42aabf7f0559c503450ada931c51f900a62540ea52cfe4c8e02877a86f515b50b5f7c7f6536fde6d760ff44337d8e68bc6ed5
7
- data.tar.gz: 84c6d2c78256cd4b84290ba324d3825ed2365aad7e142bd7f0ca0275f5f9c48d9f2251ff9a022cc2bb663a3a25c5d6c9841af25558a2dd154f62323305e4fd85
6
+ metadata.gz: 68662d27963ec681ca2b1604e11991f33ae19b3833711828743ac17905c5ed62ed37d2ca425b2042ea2093608ece1cc14d2bc2052f0f6b71c42d21b667e7ef71
7
+ data.tar.gz: febcfc8ca74c8bf13529d71d91ef6083075c011edb4aeda539b3e5a7d003471a2536a94180ba182b8bbf335ac7f7d9f4752e49ddfac08d1897e02880b24bbff8
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ Note: For changes to the API, see https://shopify.dev/changelog?filter=api
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ N/A
8
+
9
+ ## Version 11.0.1
10
+
11
+ - [#990](https://github.com/Shopify/shopify-api-ruby/pull/991) Validate `hmac` signature of OAuth callback using both old and new API secrets
12
+
7
13
  ## Version 11.0.0
8
14
 
9
15
  - [#987](https://github.com/Shopify/shopify_api/pull/987) ⚠️ [Breaking] Add REST resources for July 2022 API version, remove support and REST resources for July 2021 (`2021-07`) API version
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify_api (11.0.0)
4
+ shopify_api (11.0.1)
5
5
  concurrent-ruby
6
6
  hash_diff
7
7
  httparty
@@ -13,18 +13,28 @@ module ShopifyAPI
13
13
  def validate(verifiable_query)
14
14
  return false unless verifiable_query.hmac
15
15
 
16
- received_signature = verifiable_query.hmac
17
- computed_signature = compute_signature(verifiable_query.to_signable_string)
18
- OpenSSL.secure_compare(computed_signature, received_signature)
16
+ result = validate_signature(verifiable_query, Context.api_secret_key)
17
+ if result || Context.old_api_secret_key.blank?
18
+ result
19
+ else
20
+ validate_signature(verifiable_query, T.must(Context.old_api_secret_key))
21
+ end
19
22
  end
20
23
 
21
24
  private
22
25
 
23
- sig { params(signable_string: String).returns(String) }
24
- def compute_signature(signable_string)
26
+ sig { params(verifiable_query: VerifiableQuery, secret: String).returns(T::Boolean) }
27
+ def validate_signature(verifiable_query, secret)
28
+ received_signature = verifiable_query.hmac
29
+ computed_signature = compute_signature(verifiable_query.to_signable_string, secret)
30
+ OpenSSL.secure_compare(computed_signature, received_signature)
31
+ end
32
+
33
+ sig { params(signable_string: String, secret: String).returns(String) }
34
+ def compute_signature(signable_string, secret)
25
35
  OpenSSL::HMAC.hexdigest(
26
36
  OpenSSL::Digest.new("sha256"),
27
- ShopifyAPI::Context.api_secret_key,
37
+ secret,
28
38
  signable_string,
29
39
  )
30
40
  end
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module ShopifyAPI
5
- VERSION = "11.0.0"
5
+ VERSION = "11.0.1"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.0.0
4
+ version: 11.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-04 00:00:00.000000000 Z
11
+ date: 2022-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby