shopify_app 13.0.0 → 14.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.github/PULL_REQUEST_TEMPLATE.md +6 -0
  3. data/.github/workflows/rubocop.yml +28 -0
  4. data/.rubocop.yml +13 -6
  5. data/.travis.yml +3 -3
  6. data/CHANGELOG.md +51 -0
  7. data/Gemfile +5 -0
  8. data/README.md +79 -41
  9. data/Rakefile +1 -0
  10. data/SECURITY.md +59 -0
  11. data/app/controllers/concerns/shopify_app/authenticated.rb +1 -0
  12. data/app/controllers/concerns/shopify_app/require_known_shop.rb +39 -0
  13. data/app/controllers/shopify_app/authenticated_controller.rb +1 -0
  14. data/app/controllers/shopify_app/callback_controller.rb +41 -10
  15. data/app/controllers/shopify_app/extension_verification_controller.rb +2 -7
  16. data/app/controllers/shopify_app/sessions_controller.rb +9 -6
  17. data/app/controllers/shopify_app/webhooks_controller.rb +6 -5
  18. data/config/locales/fi.yml +1 -1
  19. data/config/locales/nl.yml +7 -7
  20. data/config/routes.rb +1 -0
  21. data/docs/Quickstart.md +7 -17
  22. data/docs/Releasing.md +1 -0
  23. data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +5 -3
  24. data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +1 -0
  25. data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +2 -1
  26. data/lib/generators/shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb +4 -4
  27. data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +5 -4
  28. data/lib/generators/shopify_app/add_webhook/templates/{webhook_job.rb → webhook_job.rb.tt} +5 -0
  29. data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +4 -3
  30. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb +3 -3
  31. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb +10 -9
  32. data/lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator.rb +1 -1
  33. data/lib/generators/shopify_app/controllers/controllers_generator.rb +1 -0
  34. data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +22 -3
  35. data/lib/generators/shopify_app/home_controller/templates/index.html.erb +67 -17
  36. data/lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb +10 -0
  37. data/lib/generators/shopify_app/install/install_generator.rb +10 -9
  38. data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +1 -1
  39. data/lib/generators/shopify_app/install/templates/flash_messages.js +0 -2
  40. data/lib/generators/shopify_app/install/templates/omniauth.rb +2 -1
  41. data/lib/generators/shopify_app/install/templates/{shopify_app.rb → shopify_app.rb.tt} +2 -1
  42. data/lib/generators/shopify_app/install/templates/user_agent.rb +2 -1
  43. data/lib/generators/shopify_app/products_controller/products_controller_generator.rb +19 -0
  44. data/lib/generators/shopify_app/products_controller/templates/products_controller.rb +8 -0
  45. data/lib/generators/shopify_app/routes/routes_generator.rb +1 -0
  46. data/lib/generators/shopify_app/routes/templates/routes.rb +10 -9
  47. data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +12 -7
  48. data/lib/generators/shopify_app/shop_model/templates/shop.rb +1 -0
  49. data/lib/generators/shopify_app/shopify_app_generator.rb +4 -3
  50. data/lib/generators/shopify_app/user_model/templates/user.rb +1 -0
  51. data/lib/generators/shopify_app/user_model/user_model_generator.rb +12 -7
  52. data/lib/generators/shopify_app/views/views_generator.rb +1 -0
  53. data/lib/shopify_app/configuration.rb +15 -8
  54. data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +3 -3
  55. data/lib/shopify_app/controller_concerns/csrf_protection.rb +15 -0
  56. data/lib/shopify_app/controller_concerns/embedded_app.rb +3 -2
  57. data/lib/shopify_app/controller_concerns/localization.rb +1 -0
  58. data/lib/shopify_app/controller_concerns/login_protection.rb +60 -15
  59. data/lib/shopify_app/controller_concerns/payload_verification.rb +24 -0
  60. data/lib/shopify_app/controller_concerns/webhook_verification.rb +3 -18
  61. data/lib/shopify_app/engine.rb +5 -0
  62. data/lib/shopify_app/jobs/scripttags_manager_job.rb +1 -1
  63. data/lib/shopify_app/jobs/webhooks_manager_job.rb +1 -1
  64. data/lib/shopify_app/managers/scripttags_manager.rb +4 -3
  65. data/lib/shopify_app/managers/webhooks_manager.rb +4 -3
  66. data/lib/shopify_app/middleware/jwt_middleware.rb +42 -0
  67. data/lib/shopify_app/middleware/same_site_cookie_middleware.rb +2 -1
  68. data/lib/shopify_app/session/in_memory_session_store.rb +7 -3
  69. data/lib/shopify_app/session/in_memory_shop_session_store.rb +10 -0
  70. data/lib/shopify_app/session/in_memory_user_session_store.rb +10 -0
  71. data/lib/shopify_app/session/jwt.rb +61 -0
  72. data/lib/shopify_app/session/null_user_session_store.rb +22 -0
  73. data/lib/shopify_app/session/session_repository.rb +13 -16
  74. data/lib/shopify_app/session/session_storage.rb +1 -0
  75. data/lib/shopify_app/session/shop_session_storage.rb +21 -9
  76. data/lib/shopify_app/session/user_session_storage.rb +19 -8
  77. data/lib/shopify_app/test_helpers/all.rb +2 -0
  78. data/lib/shopify_app/test_helpers/webhook_verification_helper.rb +17 -0
  79. data/lib/shopify_app/utils.rb +6 -5
  80. data/lib/shopify_app/version.rb +2 -1
  81. data/lib/shopify_app.rb +12 -5
  82. data/package-lock.json +10 -78
  83. data/package.json +1 -1
  84. data/shopify_app.gemspec +12 -7
  85. data/yarn.lock +12 -12
  86. metadata +53 -10
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ShopifyApp
2
3
  module UserSessionStorage
3
4
  extend ActiveSupport::Concern
@@ -17,14 +18,24 @@ module ShopifyApp
17
18
  end
18
19
 
19
20
  def retrieve(id)
20
- return unless id
21
- if user = find_by(id: id)
22
- ShopifyAPI::Session.new(
23
- domain: user.shopify_domain,
24
- token: user.shopify_token,
25
- api_version: user.api_version
26
- )
27
- end
21
+ user = find_by(id: id)
22
+ construct_session(user)
23
+ end
24
+
25
+ def retrieve_by_shopify_user_id(user_id)
26
+ user = find_by(shopify_user_id: user_id)
27
+ construct_session(user)
28
+ end
29
+
30
+ private
31
+
32
+ def construct_session(user)
33
+ return unless user
34
+ ShopifyAPI::Session.new(
35
+ domain: user.shopify_domain,
36
+ token: user.shopify_token,
37
+ api_version: user.api_version,
38
+ )
28
39
  end
29
40
  end
30
41
  end
@@ -0,0 +1,2 @@
1
+ # frozen_string_literal: true
2
+ require 'shopify_app/test_helpers/webhook_verification_helper'
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+ module ShopifyApp
3
+ module TestHelpers
4
+ module WebhookVerificationHelper
5
+ def authorized_webhook_verification_headers!(params = {})
6
+ digest = OpenSSL::Digest.new('sha256')
7
+ secret = ShopifyApp.configuration.secret
8
+ valid_hmac = Base64.encode64(OpenSSL::HMAC.digest(digest, secret, params.to_query)).strip
9
+ @request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'] = valid_hmac
10
+ end
11
+
12
+ def unauthorized_webhook_verification_headers!
13
+ @request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'] = "invalid_hmac"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,13 +1,14 @@
1
+ # frozen_string_literal: true
1
2
  module ShopifyApp
2
3
  module Utils
3
-
4
4
  def self.sanitize_shop_domain(shop_domain)
5
+ myshopify_domain = ShopifyApp.configuration.myshopify_domain
5
6
  name = shop_domain.to_s.downcase.strip
6
- name += ".#{ShopifyApp.configuration.myshopify_domain}" if !name.include?("#{ShopifyApp.configuration.myshopify_domain}") && !name.include?(".")
7
+ name += ".#{myshopify_domain}" if !name.include?(myshopify_domain.to_s) && !name.include?(".")
7
8
  name.sub!(%r|https?://|, '')
8
9
 
9
10
  u = URI("http://#{name}")
10
- u.host if u.host&.match(/^[a-z0-9][a-z0-9\-]*[a-z0-9]\.#{Regexp.escape(ShopifyApp.configuration.myshopify_domain)}$/)
11
+ u.host if u.host&.match(/^[a-z0-9][a-z0-9\-]*[a-z0-9]\.#{Regexp.escape(myshopify_domain)}$/)
11
12
  rescue URI::InvalidURIError
12
13
  nil
13
14
  end
@@ -16,8 +17,8 @@ module ShopifyApp
16
17
  Rails.logger.info("[ShopifyAPI::ApiVersion] Fetching known Admin API Versions from Shopify...")
17
18
  ShopifyAPI::ApiVersion.fetch_known_versions
18
19
  Rails.logger.info("[ShopifyAPI::ApiVersion] Known API Versions: #{ShopifyAPI::ApiVersion.versions.keys}")
19
- rescue ActiveResource::ConnectionError
20
- logger.error( "[ShopifyAPI::ApiVersion] Unable to fetch api_versions from Shopify")
20
+ rescue ActiveResource::ConnectionError
21
+ logger.error("[ShopifyAPI::ApiVersion] Unable to fetch api_versions from Shopify")
21
22
  end
22
23
  end
23
24
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ShopifyApp
2
- VERSION = '13.0.0'.freeze
3
+ VERSION = '14.0.0'
3
4
  end
data/lib/shopify_app.rb CHANGED
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
1
2
  require 'shopify_app/version'
2
3
 
3
4
  # deps
4
5
  require 'shopify_api'
5
6
  require 'omniauth-shopify-oauth2'
7
+ require 'redirect_safely'
6
8
 
7
9
  module ShopifyApp
8
10
  def self.rails6?
@@ -25,12 +27,14 @@ module ShopifyApp
25
27
  require 'shopify_app/utils'
26
28
 
27
29
  # controller concerns
30
+ require 'shopify_app/controller_concerns/csrf_protection'
28
31
  require 'shopify_app/controller_concerns/localization'
29
32
  require 'shopify_app/controller_concerns/itp'
30
33
  require 'shopify_app/controller_concerns/login_protection'
31
34
  require 'shopify_app/controller_concerns/embedded_app'
32
- require 'shopify_app/controller_concerns/webhook_verification'
35
+ require 'shopify_app/controller_concerns/payload_verification'
33
36
  require 'shopify_app/controller_concerns/app_proxy_verification'
37
+ require 'shopify_app/controller_concerns/webhook_verification'
34
38
 
35
39
  # jobs
36
40
  require 'shopify_app/jobs/webhooks_manager_job'
@@ -41,14 +45,17 @@ module ShopifyApp
41
45
  require 'shopify_app/managers/scripttags_manager'
42
46
 
43
47
  # middleware
48
+ require 'shopify_app/middleware/jwt_middleware'
44
49
  require 'shopify_app/middleware/same_site_cookie_middleware'
45
50
 
46
51
  # session
47
- require 'shopify_app/session/session_storage'
48
- require 'shopify_app/session/shop_session_storage'
49
- require 'shopify_app/session/user_session_storage'
50
- require 'shopify_app/session/session_repository'
51
52
  require 'shopify_app/session/in_memory_session_store'
52
53
  require 'shopify_app/session/in_memory_shop_session_store'
53
54
  require 'shopify_app/session/in_memory_user_session_store'
55
+ require 'shopify_app/session/jwt'
56
+ require 'shopify_app/session/null_user_session_store'
57
+ require 'shopify_app/session/session_repository'
58
+ require 'shopify_app/session/session_storage'
59
+ require 'shopify_app/session/shop_session_storage'
60
+ require 'shopify_app/session/user_session_storage'
54
61
  end
data/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shopify_app",
3
- "version": "12.0.2",
3
+ "version": "13.6.0",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -53,12 +53,6 @@
53
53
  "minimist": "^1.2.0"
54
54
  }
55
55
  },
56
- "lodash": {
57
- "version": "4.17.15",
58
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
59
- "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
60
- "dev": true
61
- },
62
56
  "ms": {
63
57
  "version": "2.1.2",
64
58
  "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -78,14 +72,6 @@
78
72
  "lodash": "^4.17.13",
79
73
  "source-map": "^0.5.0",
80
74
  "trim-right": "^1.0.1"
81
- },
82
- "dependencies": {
83
- "lodash": {
84
- "version": "4.17.15",
85
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
86
- "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
87
- "dev": true
88
- }
89
75
  }
90
76
  },
91
77
  "@babel/helper-annotate-as-pure": {
@@ -151,14 +137,6 @@
151
137
  "@babel/helper-function-name": "^7.1.0",
152
138
  "@babel/types": "^7.5.5",
153
139
  "lodash": "^4.17.13"
154
- },
155
- "dependencies": {
156
- "lodash": {
157
- "version": "4.17.15",
158
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
159
- "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
160
- "dev": true
161
- }
162
140
  }
163
141
  },
164
142
  "@babel/helper-explode-assignable-expression": {
@@ -230,14 +208,6 @@
230
208
  "@babel/template": "^7.4.4",
231
209
  "@babel/types": "^7.5.5",
232
210
  "lodash": "^4.17.13"
233
- },
234
- "dependencies": {
235
- "lodash": {
236
- "version": "4.17.15",
237
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
238
- "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
239
- "dev": true
240
- }
241
211
  }
242
212
  },
243
213
  "@babel/helper-optimise-call-expression": {
@@ -262,14 +232,6 @@
262
232
  "dev": true,
263
233
  "requires": {
264
234
  "lodash": "^4.17.13"
265
- },
266
- "dependencies": {
267
- "lodash": {
268
- "version": "4.17.15",
269
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
270
- "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
271
- "dev": true
272
- }
273
235
  }
274
236
  },
275
237
  "@babel/helper-remap-async-to-generator": {
@@ -598,14 +560,6 @@
598
560
  "requires": {
599
561
  "@babel/helper-plugin-utils": "^7.0.0",
600
562
  "lodash": "^4.17.13"
601
- },
602
- "dependencies": {
603
- "lodash": {
604
- "version": "4.17.15",
605
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
606
- "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
607
- "dev": true
608
- }
609
563
  }
610
564
  },
611
565
  "@babel/plugin-transform-classes": {
@@ -1056,12 +1010,6 @@
1056
1010
  "ms": "^2.1.1"
1057
1011
  }
1058
1012
  },
1059
- "lodash": {
1060
- "version": "4.17.15",
1061
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
1062
- "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
1063
- "dev": true
1064
- },
1065
1013
  "ms": {
1066
1014
  "version": "2.1.2",
1067
1015
  "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -1079,14 +1027,6 @@
1079
1027
  "esutils": "^2.0.2",
1080
1028
  "lodash": "^4.17.13",
1081
1029
  "to-fast-properties": "^2.0.0"
1082
- },
1083
- "dependencies": {
1084
- "lodash": {
1085
- "version": "4.17.15",
1086
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
1087
- "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
1088
- "dev": true
1089
- }
1090
1030
  }
1091
1031
  },
1092
1032
  "@sinonjs/commons": {
@@ -1117,14 +1057,6 @@
1117
1057
  "@sinonjs/commons": "^1.3.0",
1118
1058
  "array-from": "^2.1.1",
1119
1059
  "lodash": "^4.17.15"
1120
- },
1121
- "dependencies": {
1122
- "lodash": {
1123
- "version": "4.17.15",
1124
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
1125
- "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
1126
- "dev": true
1127
- }
1128
1060
  }
1129
1061
  },
1130
1062
  "@sinonjs/text-encoding": {
@@ -1332,9 +1264,9 @@
1332
1264
  }
1333
1265
  },
1334
1266
  "acorn": {
1335
- "version": "6.3.0",
1336
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz",
1337
- "integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==",
1267
+ "version": "6.4.1",
1268
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz",
1269
+ "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==",
1338
1270
  "dev": true
1339
1271
  },
1340
1272
  "after": {
@@ -2600,9 +2532,9 @@
2600
2532
  "dev": true
2601
2533
  },
2602
2534
  "elliptic": {
2603
- "version": "6.5.1",
2604
- "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.1.tgz",
2605
- "integrity": "sha512-xvJINNLbTeWQjrl6X+7eQCrIy/YPv5XCpKW6kB5mKvtnGILoLDcySuwomfdzt0BMdLNVnuRNTuzKNHj0bva1Cg==",
2535
+ "version": "6.5.3",
2536
+ "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
2537
+ "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
2606
2538
  "dev": true,
2607
2539
  "requires": {
2608
2540
  "bn.js": "^4.4.0",
@@ -4579,9 +4511,9 @@
4579
4511
  }
4580
4512
  },
4581
4513
  "lodash": {
4582
- "version": "4.17.15",
4583
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
4584
- "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
4514
+ "version": "4.17.19",
4515
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
4516
+ "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==",
4585
4517
  "dev": true
4586
4518
  },
4587
4519
  "log-symbols": {
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shopify_app",
3
- "version": "13.0.0",
3
+ "version": "14.0.0",
4
4
  "repository": "git@github.com:Shopify/shopify_app.git",
5
5
  "author": "Shopify",
6
6
  "license": "MIT",
data/shopify_app.gemspec CHANGED
@@ -1,4 +1,5 @@
1
- $LOAD_PATH.push File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+ $LOAD_PATH.push(File.expand_path('../lib', __FILE__))
2
3
  require "shopify_app/version"
3
4
 
4
5
  Gem::Specification.new do |s|
@@ -6,14 +7,18 @@ Gem::Specification.new do |s|
6
7
  s.version = ShopifyApp::VERSION
7
8
  s.platform = Gem::Platform::RUBY
8
9
  s.author = "Shopify"
9
- s.summary = %q{This gem is used to get quickly started with the Shopify API}
10
+ s.summary = 'This gem is used to get quickly started with the Shopify API'
10
11
 
11
- s.required_ruby_version = ">= 2.3.1"
12
+ s.required_ruby_version = ">= 2.5"
12
13
 
13
- s.add_runtime_dependency('browser_sniffer', '~> 1.2.0')
14
+ s.metadata['allowed_push_host'] = 'https://rubygems.org'
15
+
16
+ s.add_runtime_dependency('browser_sniffer', '~> 1.2.2')
14
17
  s.add_runtime_dependency('rails', '> 5.2.1')
15
- s.add_runtime_dependency('shopify_api', '~> 9.0.2')
18
+ s.add_runtime_dependency('shopify_api', '~> 9.1')
16
19
  s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 2.2.2')
20
+ s.add_runtime_dependency('jwt', '~> 2.2.1')
21
+ s.add_runtime_dependency('redirect_safely', '~> 1.0')
17
22
 
18
23
  s.add_development_dependency('rake')
19
24
  s.add_development_dependency('byebug')
@@ -26,7 +31,7 @@ Gem::Specification.new do |s|
26
31
  s.add_development_dependency('mocha')
27
32
  s.add_development_dependency('webmock')
28
33
 
29
- s.files = `git ls-files`.split("\n").reject { |f| f.match(%r{^(test|example)/}) }
30
- s.test_files = `git ls-files -- {test}/*`.split("\n")
34
+ s.files = %x(git ls-files).split("\n").reject { |f| f.match(%r{^(test|example)/}) }
35
+ s.test_files = %x(git ls-files -- {test}/*).split("\n")
31
36
  s.require_paths = ["lib"]
32
37
  end
data/yarn.lock CHANGED
@@ -994,9 +994,9 @@ accepts@~1.3.4:
994
994
  negotiator "0.6.2"
995
995
 
996
996
  acorn@^6.2.1:
997
- version "6.3.0"
998
- resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e"
999
- integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==
997
+ version "6.4.1"
998
+ resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.1.tgz#531e58ba3f51b9dacb9a6646ca4debf5b14ca474"
999
+ integrity sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==
1000
1000
 
1001
1001
  after@0.8.2:
1002
1002
  version "0.8.2"
@@ -1293,9 +1293,9 @@ bluebird@^3.3.0, bluebird@^3.5.5:
1293
1293
  integrity sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w==
1294
1294
 
1295
1295
  bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0:
1296
- version "4.11.8"
1297
- resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f"
1298
- integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==
1296
+ version "4.11.9"
1297
+ resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828"
1298
+ integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==
1299
1299
 
1300
1300
  body-parser@^1.16.1:
1301
1301
  version "1.19.0"
@@ -2039,9 +2039,9 @@ electron-to-chromium@^1.3.247:
2039
2039
  integrity sha512-wGt+OivF1C1MPwaSv3LJ96ebNbLAWlx3HndivDDWqwIVSQxmhL17Y/YmwUdEMtS/bPyommELt47Dct0/VZNQBQ==
2040
2040
 
2041
2041
  elliptic@^6.0.0:
2042
- version "6.5.1"
2043
- resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.1.tgz#c380f5f909bf1b9b4428d028cd18d3b0efd6b52b"
2044
- integrity sha512-xvJINNLbTeWQjrl6X+7eQCrIy/YPv5XCpKW6kB5mKvtnGILoLDcySuwomfdzt0BMdLNVnuRNTuzKNHj0bva1Cg==
2042
+ version "6.5.3"
2043
+ resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6"
2044
+ integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==
2045
2045
  dependencies:
2046
2046
  bn.js "^4.4.0"
2047
2047
  brorand "^1.0.1"
@@ -3202,9 +3202,9 @@ locate-path@^3.0.0:
3202
3202
  path-exists "^3.0.0"
3203
3203
 
3204
3204
  lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15:
3205
- version "4.17.15"
3206
- resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
3207
- integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
3205
+ version "4.17.19"
3206
+ resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
3207
+ integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
3208
3208
 
3209
3209
  log-symbols@2.2.0:
3210
3210
  version "2.2.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.0.0
4
+ version: 14.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-16 00:00:00.000000000 Z
11
+ date: 2020-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: browser_sniffer
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.0
19
+ version: 1.2.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.2.0
26
+ version: 1.2.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 9.0.2
47
+ version: '9.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 9.0.2
54
+ version: '9.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: omniauth-shopify-oauth2
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.2.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: jwt
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 2.2.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 2.2.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: redirect_safely
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: rake
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -215,7 +243,9 @@ files:
215
243
  - ".babelrc"
216
244
  - ".github/CODEOWNERS"
217
245
  - ".github/ISSUE_TEMPLATE.md"
246
+ - ".github/PULL_REQUEST_TEMPLATE.md"
218
247
  - ".github/probots.yml"
248
+ - ".github/workflows/rubocop.yml"
219
249
  - ".gitignore"
220
250
  - ".nvmrc"
221
251
  - ".rubocop.yml"
@@ -226,6 +256,7 @@ files:
226
256
  - LICENSE
227
257
  - README.md
228
258
  - Rakefile
259
+ - SECURITY.md
229
260
  - app/assets/images/storage_access.svg
230
261
  - app/assets/javascripts/shopify_app/enable_cookies.js
231
262
  - app/assets/javascripts/shopify_app/itp_helper.js
@@ -237,6 +268,7 @@ files:
237
268
  - app/assets/javascripts/shopify_app/top_level.js
238
269
  - app/assets/javascripts/shopify_app/top_level_interaction.js
239
270
  - app/controllers/concerns/shopify_app/authenticated.rb
271
+ - app/controllers/concerns/shopify_app/require_known_shop.rb
240
272
  - app/controllers/shopify_app/authenticated_controller.rb
241
273
  - app/controllers/shopify_app/callback_controller.rb
242
274
  - app/controllers/shopify_app/extension_verification_controller.rb
@@ -287,7 +319,7 @@ files:
287
319
  - lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb
288
320
  - lib/generators/shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb
289
321
  - lib/generators/shopify_app/add_webhook/add_webhook_generator.rb
290
- - lib/generators/shopify_app/add_webhook/templates/webhook_job.rb
322
+ - lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt
291
323
  - lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb
292
324
  - lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb
293
325
  - lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb
@@ -298,6 +330,7 @@ files:
298
330
  - lib/generators/shopify_app/home_controller/home_controller_generator.rb
299
331
  - lib/generators/shopify_app/home_controller/templates/home_controller.rb
300
332
  - lib/generators/shopify_app/home_controller/templates/index.html.erb
333
+ - lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb
301
334
  - lib/generators/shopify_app/install/install_generator.rb
302
335
  - lib/generators/shopify_app/install/templates/_flash_messages.html.erb
303
336
  - lib/generators/shopify_app/install/templates/embedded_app.html.erb
@@ -305,10 +338,12 @@ files:
305
338
  - lib/generators/shopify_app/install/templates/omniauth.rb
306
339
  - lib/generators/shopify_app/install/templates/session_store.rb
307
340
  - lib/generators/shopify_app/install/templates/shopify_app.js
308
- - lib/generators/shopify_app/install/templates/shopify_app.rb
341
+ - lib/generators/shopify_app/install/templates/shopify_app.rb.tt
309
342
  - lib/generators/shopify_app/install/templates/shopify_app_index.js
310
343
  - lib/generators/shopify_app/install/templates/shopify_provider.rb
311
344
  - lib/generators/shopify_app/install/templates/user_agent.rb
345
+ - lib/generators/shopify_app/products_controller/products_controller_generator.rb
346
+ - lib/generators/shopify_app/products_controller/templates/products_controller.rb
312
347
  - lib/generators/shopify_app/rotate_shopify_token_job/rotate_shopify_token_job_generator.rb
313
348
  - lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token.rake
314
349
  - lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token_job.rb
@@ -327,24 +362,31 @@ files:
327
362
  - lib/shopify_app.rb
328
363
  - lib/shopify_app/configuration.rb
329
364
  - lib/shopify_app/controller_concerns/app_proxy_verification.rb
365
+ - lib/shopify_app/controller_concerns/csrf_protection.rb
330
366
  - lib/shopify_app/controller_concerns/embedded_app.rb
331
367
  - lib/shopify_app/controller_concerns/itp.rb
332
368
  - lib/shopify_app/controller_concerns/localization.rb
333
369
  - lib/shopify_app/controller_concerns/login_protection.rb
370
+ - lib/shopify_app/controller_concerns/payload_verification.rb
334
371
  - lib/shopify_app/controller_concerns/webhook_verification.rb
335
372
  - lib/shopify_app/engine.rb
336
373
  - lib/shopify_app/jobs/scripttags_manager_job.rb
337
374
  - lib/shopify_app/jobs/webhooks_manager_job.rb
338
375
  - lib/shopify_app/managers/scripttags_manager.rb
339
376
  - lib/shopify_app/managers/webhooks_manager.rb
377
+ - lib/shopify_app/middleware/jwt_middleware.rb
340
378
  - lib/shopify_app/middleware/same_site_cookie_middleware.rb
341
379
  - lib/shopify_app/session/in_memory_session_store.rb
342
380
  - lib/shopify_app/session/in_memory_shop_session_store.rb
343
381
  - lib/shopify_app/session/in_memory_user_session_store.rb
382
+ - lib/shopify_app/session/jwt.rb
383
+ - lib/shopify_app/session/null_user_session_store.rb
344
384
  - lib/shopify_app/session/session_repository.rb
345
385
  - lib/shopify_app/session/session_storage.rb
346
386
  - lib/shopify_app/session/shop_session_storage.rb
347
387
  - lib/shopify_app/session/user_session_storage.rb
388
+ - lib/shopify_app/test_helpers/all.rb
389
+ - lib/shopify_app/test_helpers/webhook_verification_helper.rb
348
390
  - lib/shopify_app/utils.rb
349
391
  - lib/shopify_app/version.rb
350
392
  - package-lock.json
@@ -357,7 +399,8 @@ files:
357
399
  - yarn.lock
358
400
  homepage:
359
401
  licenses: []
360
- metadata: {}
402
+ metadata:
403
+ allowed_push_host: https://rubygems.org
361
404
  post_install_message:
362
405
  rdoc_options: []
363
406
  require_paths:
@@ -366,7 +409,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
366
409
  requirements:
367
410
  - - ">="
368
411
  - !ruby/object:Gem::Version
369
- version: 2.3.1
412
+ version: '2.5'
370
413
  required_rubygems_version: !ruby/object:Gem::Requirement
371
414
  requirements:
372
415
  - - ">="