shopify_api 9.4.0 → 9.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb95bdd7eace9c3fd781e8e05b8888b657ed84e85707f00d9220f049e13fdaa9
4
- data.tar.gz: 856d86bf1f36fc436ad7d1a713b1956b5b69ef6c708b83edd4a5d6001eae5f91
3
+ metadata.gz: 9b4f86a8f19033687d5dda9d848efcc2906e506375d7f05365180afa065e0c7e
4
+ data.tar.gz: 47f66045afe505387863977fc14a02217fe85ac11d9d9d0f0e8ac061f2f2af6d
5
5
  SHA512:
6
- metadata.gz: 978438061f1192357b7fe6b238f1fb88efb9d3129b4ed63efe0cab98330dd9420462cfb4548ee4024aeb4a5c9b07ea7d7ec865799798167b7dae09b2b26558f2
7
- data.tar.gz: e07296eda7512ab2ba356bdf9f157e4dad758e4a2273d171c56423f0761815e8fd74a747f27b7c54ee33148f131e757e54b5ef1578c4c8506bf462905f2ea51a
6
+ metadata.gz: 2aa02363f15762bc316b4d5281799526ac00c9793570fc4b63ff41d7db033ae70ff046ca007d3d855dbb14dde54803a7d42e62a1466c45a30ddd3664493950a6
7
+ data.tar.gz: 5e720ca16972acd0dd2a96eac7d331d06ce3979efd7b97b007f612458f2b05de89d9a08a4d54bc8265553e3664811f3814c91b5cc8957317dd4e0f444f85c27a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## Version 9.4.1
2
+
3
+ * [#847](https://github.com/Shopify/shopify_api/pull/847) Update `create_permission_url` method to use grant_options
4
+ * [#852](https://github.com/Shopify/shopify_api/pull/852) Bumping kramdown to fix a security vulnerability
5
+
1
6
  ## Version 9.4.0
2
7
 
3
8
  * [#843](https://github.com/Shopify/shopify_api/pull/843) Introduce a new `access_scopes` attribute on the Session class.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify_api (9.4.0)
4
+ shopify_api (9.4.1)
5
5
  activeresource (>= 4.1.0, < 6.0.0)
6
6
  graphql-client
7
7
  rack
@@ -41,7 +41,7 @@ GEM
41
41
  eventmachine (1.2.7)
42
42
  ffi (1.12.2)
43
43
  forwardable-extended (2.6.0)
44
- graphql (1.12.5)
44
+ graphql (1.12.6)
45
45
  graphql-client (0.16.0)
46
46
  activesupport (>= 3.0)
47
47
  graphql (~> 1.8)
@@ -68,7 +68,7 @@ GEM
68
68
  sassc (> 2.0.1, < 3.0)
69
69
  jekyll-watch (2.2.1)
70
70
  listen (~> 3.0)
71
- kramdown (2.3.0)
71
+ kramdown (2.3.1)
72
72
  rexml
73
73
  kramdown-parser-gfm (1.1.0)
74
74
  kramdown (~> 2.0)
data/README.md CHANGED
@@ -149,7 +149,7 @@ Under the hood, the `create_permission_url` method is preparing the app to make
149
149
  * ``scope`` – Required – The list of required scopes (explained here: https://shopify.dev/tutorials/authenticate-with-oauth#scopes)
150
150
  * ``redirect_uri`` – Required – The URL where you want to redirect the users after they authorize the client. The complete URL specified here must be identical to one of the Application Redirect URLs set in the app's section of the Partners dashboard.
151
151
  * ``state`` – Optional – A randomly selected value provided by your application, which is unique for each authorization request. During the OAuth callback phase, your application must check that this value matches the one you provided during authorization. [This mechanism is essential for the security of your application](https://tools.ietf.org/html/rfc6819#section-3.6).
152
- * ``grant_options[]`` - Optional - Set this parameter to `per-user` to receive an access token that respects the user's permission level when making API requests (called online access). We strongly recommend using this parameter for embedded apps.
152
+ * ``grant_options`` - Optional - Set this parameter to `per-user` to receive an access token that respects the user's permission level when making API requests (called online access). We strongly recommend using this parameter for embedded apps.
153
153
 
154
154
  ### 4) Trading your `code` for an access token.
155
155
 
@@ -3,6 +3,9 @@ module ActiveResource
3
3
  class DetailedLogSubscriber < ActiveSupport::LogSubscriber
4
4
  VERSION_EOL_WARNING_HEADER = 'x-shopify-api-version-warning'
5
5
  VERSION_DEPRECATION_HEADER = 'x-shopify-api-deprecated-reason'
6
+ SHOPIFY_ACCESS_TOKEN = 'X-Shopify-Access-Token'
7
+ FILTERED = '[FILTERED]'
8
+
6
9
  def request(event)
7
10
  log_request_response_details(event)
8
11
  warn_on_deprecated_header_or_version_eol_header(event)
@@ -17,6 +20,7 @@ module ActiveResource
17
20
  def log_request_response_details(event)
18
21
  data = event.payload[:data]
19
22
  headers = data.extract_options!
23
+ headers[SHOPIFY_ACCESS_TOKEN] = FILTERED
20
24
  request_body = data.first
21
25
 
22
26
  info("Request:\n#{request_body}") if request_body
@@ -103,6 +103,7 @@ module ShopifyAPI
103
103
  def create_permission_url(scope, redirect_uri, options = {})
104
104
  params = { client_id: api_key, scope: ShopifyAPI::ApiAccess.new(scope).to_s, redirect_uri: redirect_uri }
105
105
  params[:state] = options[:state] if options[:state]
106
+ params["grant_options[]".to_sym] = options[:grant_options] if options[:grant_options]
106
107
  construct_oauth_url("authorize", params)
107
108
  end
108
109
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ShopifyAPI
3
- VERSION = "9.4.0"
3
+ VERSION = "9.4.1"
4
4
  end
@@ -14,7 +14,7 @@ class LogSubscriberTest < Test::Unit::TestCase
14
14
  @ua_header = "\"User-Agent\"=>\"ShopifyAPI/#{ShopifyAPI::VERSION} " \
15
15
  "ActiveResource/#{ActiveResource::VERSION::STRING} Ruby/#{RUBY_VERSION}\""
16
16
  @request_headers = "Headers: {\"Accept\"=>\"application/json\", " \
17
- "#{@ua_header}, \"X-Shopify-Access-Token\"=>\"access_token\"}"
17
+ "#{@ua_header}, \"X-Shopify-Access-Token\"=>\"[FILTERED]\"}"
18
18
 
19
19
  ShopifyAPI::Base.clear_session
20
20
  fake(
data/test/session_test.rb CHANGED
@@ -338,6 +338,22 @@ class SessionTest < Test::Unit::TestCase
338
338
  )
339
339
  end
340
340
 
341
+ test "create_permission_url returns correct url with grant_options[]" do
342
+ ShopifyAPI::Session.setup(api_key: "My_test_key", secret: "My test secret")
343
+ session = ShopifyAPI::Session.new(
344
+ domain: 'http://localhost.myshopify.com',
345
+ token: 'any-token',
346
+ api_version: any_api_version
347
+ )
348
+ scope = []
349
+ permission_url = session.create_permission_url(scope, "http://my_redirect_uri.com", grant_options: "per-user")
350
+ assert_equal(
351
+ "https://localhost.myshopify.com/admin/oauth/authorize?client_id=My_test_key&" \
352
+ "scope=&redirect_uri=http://my_redirect_uri.com&grant_options[]=per-user",
353
+ permission_url
354
+ )
355
+ end
356
+
341
357
  test "raise exception if code invalid in request token" do
342
358
  ShopifyAPI::Session.setup(api_key: "My test key", secret: "My test secret")
343
359
  session = ShopifyAPI::Session.new(
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: 9.4.0
4
+ version: 9.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2021-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource