shopify_app 13.0.1 → 13.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rubocop.yml +28 -0
  3. data/.rubocop.yml +2 -2
  4. data/.travis.yml +4 -3
  5. data/CHANGELOG.md +27 -0
  6. data/Gemfile +3 -1
  7. data/README.md +39 -42
  8. data/SECURITY.md +59 -0
  9. data/app/controllers/concerns/shopify_app/authenticated.rb +1 -0
  10. data/app/controllers/concerns/shopify_app/require_known_shop.rb +39 -0
  11. data/app/controllers/shopify_app/callback_controller.rb +38 -7
  12. data/app/controllers/shopify_app/extension_verification_controller.rb +2 -7
  13. data/app/controllers/shopify_app/sessions_controller.rb +1 -1
  14. data/app/controllers/shopify_app/webhooks_controller.rb +1 -1
  15. data/config/locales/nl.yml +7 -7
  16. data/docs/Quickstart.md +7 -17
  17. data/docs/Releasing.md +1 -0
  18. data/lib/generators/shopify_app/add_webhook/templates/{webhook_job.rb → webhook_job.rb.tt} +0 -0
  19. data/lib/generators/shopify_app/install/install_generator.rb +1 -1
  20. data/lib/generators/shopify_app/install/templates/flash_messages.js +0 -2
  21. data/lib/generators/shopify_app/install/templates/{shopify_app.rb → shopify_app.rb.tt} +1 -1
  22. data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +7 -3
  23. data/lib/generators/shopify_app/user_model/user_model_generator.rb +7 -3
  24. data/lib/shopify_app.rb +5 -1
  25. data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +0 -1
  26. data/lib/shopify_app/controller_concerns/csrf_protection.rb +15 -0
  27. data/lib/shopify_app/controller_concerns/login_protection.rb +14 -12
  28. data/lib/shopify_app/controller_concerns/payload_verification.rb +24 -0
  29. data/lib/shopify_app/controller_concerns/webhook_verification.rb +1 -17
  30. data/lib/shopify_app/engine.rb +4 -0
  31. data/lib/shopify_app/middleware/jwt_middleware.rb +42 -0
  32. data/lib/shopify_app/session/jwt.rb +35 -22
  33. data/lib/shopify_app/test_helpers/all.rb +1 -0
  34. data/lib/shopify_app/test_helpers/webhook_verification_helper.rb +2 -1
  35. data/lib/shopify_app/version.rb +1 -1
  36. data/package.json +1 -1
  37. data/shopify_app.gemspec +4 -3
  38. metadata +29 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c32f23c198e7bfcc44d3557857c11194ce71f2dc8a1a42ff0d220569c4eb4599
4
- data.tar.gz: cf430f7fb26c01592d68d5110a5690f290452ab18c5853dcc4602c5f1d5c0521
3
+ metadata.gz: 3f4300bbcbbf4e0e2c6b64d3943a83f8eda2774615016551b109880b21cb32d6
4
+ data.tar.gz: 68eca06abf0153e592b7a167bcaf0b60720213e351355737c59eafba01f65e82
5
5
  SHA512:
6
- metadata.gz: 4af6eb8ff59c68d9bc1089c577d90d40cfa2997550331314e90f620580da62898000e2b7568616b077fa15080878d0e8ddc9a09160490dea3a4ce719f4e814cd
7
- data.tar.gz: b3cf9731363e7df4b3cc78f057bd96204f25f9ab2832662e2cc7e98a3e52ad98ef68d142bcca6d9c96d232eac2cc1dbc2518a41d364f1470247100c2eddd92fc
6
+ metadata.gz: 9052491aa073afeacbb8cc6dc5bd6e12fe73c4935ed36e823ed5b3966df8c240d1e1a48e9adf02444c79e4aacada04b85e0de8184ea8148b9227589ef600fc6c
7
+ data.tar.gz: a78d6b3a5fb2a02c3122afabd2a4b2e564f5e5d0c7cb530622004e39143f695e0fbb804a9be20379a245e600330e08e3e8837dfb9dafe0ad8ceeade613c07c3d
@@ -0,0 +1,28 @@
1
+ name: RuboCop
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ - name: Set up Ruby 2.7
12
+ uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: 2.7
15
+ - name: Cache gems
16
+ uses: actions/cache@v1
17
+ with:
18
+ path: vendor/bundle
19
+ key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
20
+ restore-keys: |
21
+ ${{ runner.os }}-rubocop-
22
+ - name: Install gems
23
+ run: |
24
+ bundle config path vendor/bundle
25
+ bundle config set without 'default development test'
26
+ bundle install --jobs 4 --retry 3
27
+ - name: Run RuboCop
28
+ run: bundle exec rubocop --parallel
@@ -2,10 +2,10 @@ inherit_gem:
2
2
  rubocop-shopify: rubocop.yml
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: 2.4
5
+ TargetRubyVersion: 2.7
6
6
  Exclude:
7
- - 'lib/generators/**/*'
8
7
  - 'test/tmp/**/*'
8
+ - 'vendor/bundle/**/*'
9
9
 
10
10
  Style/MethodCallWithArgsParentheses:
11
11
  Exclude:
@@ -13,9 +13,10 @@ cache:
13
13
  yarn: true
14
14
 
15
15
  rvm:
16
- - 2.4.3
17
- - 2.5.0
18
- - 2.6.2
16
+ - 2.4
17
+ - 2.5
18
+ - 2.6
19
+ - 2.7
19
20
 
20
21
  install:
21
22
  - bundle install
@@ -1,8 +1,35 @@
1
+ 13.4.0
2
+ ------
3
+ * Skip CSRF protection if a valid signed JWT token is present as we trust Shopify to be the only source that can sign it securely. [#994](https://github.com/Shopify/shopify_app/pull/994)
4
+
5
+ 13.3.0
6
+ ------
7
+ * Added Payload Verification module [#992](https://github.com/Shopify/shopify_app/pull/992)
8
+ * Add concern to check for valid shop domains in the unauthenticated controller
9
+
10
+ 13.2.0
11
+ ------
12
+ * Get current shop domain from JWT header
13
+ * Validate that the omniauth data matches the JWT data
14
+ * Persist the token information to the session store
15
+
16
+ 13.1.1
17
+ ------
18
+ * Update browser_sniffer to 1.2.2
19
+
20
+ 13.1.0
21
+ ------
22
+ * Adds the shop URL as a parameter when redirecting after the callback
23
+ * Bump minimum Ruby version to 2.4
24
+ * Bug fixes
25
+
1
26
  13.0.1
2
27
  ------
3
28
  * Small addition to WebhookJob to return if the shop is nil #952
4
29
  * Added Rubocop to the Repo #948
5
30
  * Added a WebhookVerification test helper #950
31
+ * Fix for deprecation warning while loading session storage at startup
32
+ * Changes that will allow future JWT authentication
6
33
 
7
34
  13.0.1
8
35
  ------
data/Gemfile CHANGED
@@ -6,4 +6,6 @@ gemspec
6
6
 
7
7
  gem 'rails-controller-testing', group: :test
8
8
 
9
- gem 'rubocop-shopify', require: false
9
+ group :rubocop do
10
+ gem 'rubocop-shopify', require: false
11
+ end
data/README.md CHANGED
@@ -8,7 +8,7 @@ Shopify App
8
8
 
9
9
  Shopify Application Rails engine and generator
10
10
 
11
- #### NOTE : Versions 8.0.0 through 8.2.3 contained a CSRF vulnerability that was addressed in version 8.2.4. Please update to version 8.2.4 if you're using an old version.
11
+ #### NOTE: Versions 8.0.0 through 8.2.3 contained a CSRF vulnerability that was addressed in version 8.2.4. Please update to version 8.2.4 if you're using an old version.
12
12
 
13
13
  Table of Contents
14
14
  -----------------
@@ -32,9 +32,9 @@ Table of Contents
32
32
 
33
33
  Introduction
34
34
  -----------
35
- Get started with the [Shopify Admin API](https://help.shopify.com/en/api/getting-started) faster; This gem includes a Rails Engine and generators for writing Rails applications using the Shopify API. The Engine provides a SessionsController and all the required code for authenticating with a shop via Oauth (other authentication methods are not supported).
35
+ Get started with the [Shopify Admin API](https://help.shopify.com/en/api/getting-started) faster; This gem includes a Rails Engine and generators for writing Rails applications using the Shopify API. The Engine provides a SessionsController and all the required code for authenticating with a shop via OAuth (other authentication methods are not supported).
36
36
 
37
- *Note: It's recommended to use this on a new Rails project, so that the generator won't overwrite/delete your files.*
37
+ *Note: It's recommended to use this on a new Rails project so that the generator won't overwrite/delete your files.*
38
38
 
39
39
  Learn how to create and deploy a new Shopify App to Heroku with our [quickstart guide](https://github.com/Shopify/shopify_app/blob/master/docs/Quickstart.md), or dive in in less than 5 minutes with this quickstart video:
40
40
 
@@ -42,7 +42,7 @@ Learn how to create and deploy a new Shopify App to Heroku with our [quickstart
42
42
 
43
43
  Become a Shopify App Developer
44
44
  --------------------------------
45
- To become a Shopify App Developer you'll need a [Shopify Partner account.](http://shopify.com/partners) If you don't have a Shopify Partner account, head to http://shopify.com/partners to create one before you start.
45
+ To become a Shopify App Developer, you'll need a [Shopify Partner account.](http://shopify.com/partners) If you don't have a Shopify Partner account, head to http://shopify.com/partners to create one before you start.
46
46
 
47
47
  Once you have a Partner account, [create a new application in the Partner Dashboard](https://help.shopify.com/en/api/tools/partner-dashboard/your-apps) to get an API key and other API credentials.
48
48
 
@@ -50,7 +50,7 @@ To create an application for development set your new app's `App URL` to the URL
50
50
 
51
51
  Installation
52
52
  ------------
53
- To get started add `shopify_app` to your Gemfile and run `bundle install`:
53
+ To get started, add `shopify_app` to your Gemfile and run `bundle install`:
54
54
 
55
55
  ``` sh
56
56
  # Create a new rails app
@@ -58,8 +58,7 @@ $ rails new my_shopify_app
58
58
  $ cd my_shopify_app
59
59
 
60
60
  # Add the gem shopify_app to your Gemfile
61
- $ echo "gem 'shopify_app'" >> Gemfile
62
- $ bundle install
61
+ $ bundle add shopify_app
63
62
  ```
64
63
 
65
64
  Now we are ready to run any of the [generators](#generators) included with `shopify_app`. The following section explains the generators and what you can do with them.
@@ -67,7 +66,7 @@ Now we are ready to run any of the [generators](#generators) included with `shop
67
66
 
68
67
  #### Rails Compatibility
69
68
 
70
- The lastest version of shopify_app is compatible with Rails `>= 5`. Use version `<= v7.2.8` if you need to work with Rails 4.
69
+ The latest version of shopify_app is compatible with Rails `>= 5`. Use version `<= v7.2.8` if you need to work with Rails 4.
71
70
 
72
71
 
73
72
  Generators
@@ -94,26 +93,22 @@ SHOPIFY_API_SECRET=your api secret
94
93
 
95
94
  These values can be found on the "App Setup" page in the [Shopify Partners Dashboard][dashboard]. If you are checking your code into a code repository, ensure your `.gitignore` prevents your `.env` file from being checked into any publicly accessible code.
96
95
 
97
- **You will need to load the ENV variables into your enviroment, you can do this with the [dot-env](https://github.com/bkeepers/dotenv) gem or any other method you wish to.**
96
+ **You will need to load the ENV variables into your environment, you can do this with the [dot-env](https://github.com/bkeepers/dotenv) gem or any other method you wish to.**
98
97
 
99
98
  ### Install Generator
100
99
 
101
100
  ```sh
102
- $ rails generate shopify_app:install
103
-
104
- # or optionally with arguments:
105
-
106
101
  $ rails generate shopify_app:install
107
102
  ```
108
103
 
109
- Other options include:
104
+ Options include:
110
105
  * `application_name` - the name of your app, it can be supplied with or without double-quotes if a whitespace is present. (e.g. `--application_name Example App` or `--application_name "Example App"`)
111
- * `scope` - the Oauth access scope required for your app, eg **read_products, write_orders**. *Multiple options* need to be delimited by a comma-space, and can be supplied with or without double-quotes
106
+ * `scope` - the OAuth access scope required for your app, e.g. **read_products, write_orders**. *Multiple options* need to be delimited by a comma-space and can be supplied with or without double-quotes
112
107
  (e.g. `--scope read_products, write_orders, write_products` or `--scope "read_products, write_orders, write_products"`)
113
108
  For more information, refer the [docs](http://docs.shopify.com/api/tutorials/oauth).
114
109
  * `embedded` - the default is to generate an [embedded app](http://docs.shopify.com/embedded-app-sdk), if you want a legacy non-embedded app then set this to false, `--embedded false`
115
110
 
116
- You can update any of these settings later on easily, the arguments are simply for convenience.
111
+ You can update any of these settings later on easily; the arguments are simply for convenience.
117
112
 
118
113
  The generator adds ShopifyApp and the required initializers to the host Rails application.
119
114
 
@@ -126,7 +121,7 @@ After running the `install` generator, you can start your app with `bundle exec
126
121
  $ rails generate shopify_app:home_controller
127
122
  ```
128
123
 
129
- This generator creates an example home controller and view which fetches and displays products using the Shopify API
124
+ This generator creates an example home controller and view which fetches and displays products using the Shopify API.
130
125
 
131
126
 
132
127
  ### App Proxy Controller Generator
@@ -135,7 +130,7 @@ This generator creates an example home controller and view which fetches and dis
135
130
  $ rails generate shopify_app:app_proxy_controller
136
131
  ```
137
132
 
138
- This optional generator, not included with the default generator, creates the app proxy controller to handle proxy requests to the app from your shop storefront, modifies 'config/routes.rb' with a namespace route, and an example view which displays current shop information using the LiquidAPI
133
+ This optional generator, not included with the default generator, creates the app proxy controller to handle proxy requests to the app from your shop storefront, modifies 'config/routes.rb' with a namespace route, and an example view which displays current shop information using the LiquidAPI.
139
134
 
140
135
  ### Marketing Extension Generator
141
136
 
@@ -143,11 +138,11 @@ This optional generator, not included with the default generator, creates the ap
143
138
  $ rails generate shopify_app:add_marketing_activity_extension
144
139
  ```
145
140
 
146
- This will create a controller with the endpoints required to build a [marketing activities extension](https://help.shopify.com/en/api/embedded-apps/app-extensions/shopify-admin/marketing-activities). The extension will be generated with a base url at `/marketing_activities`, which should also be configured in partners.
141
+ This will create a controller with the endpoints required to build a [marketing activities extension](https://help.shopify.com/en/api/embedded-apps/app-extensions/shopify-admin/marketing-activities). The extension will be generated with a base URL at `/marketing_activities`, which should also be configured in partners.
147
142
 
148
143
  ### Controllers, Routes and Views
149
144
 
150
- The last group of generators are for your convenience if you want to start overriding code included as part of the Rails engine. For example by default the engine provides a simple SessionController, if you run the `rails generate shopify_app:controllers` generator then this code gets copied out into your app so you can start adding to it. Routes and views follow the exact same pattern.
145
+ The last group of generators are for your convenience if you want to start overriding code included as part of the Rails engine. For example, by default the engine provides a simple SessionController, if you run the `rails generate shopify_app:controllers` generator then this code gets copied out into your app so you can start adding to it. Routes and views follow the exact same pattern.
151
146
 
152
147
  Mounting the Engine
153
148
  -------------------
@@ -170,7 +165,7 @@ The engine may also be mounted at a nested route, for example:
170
165
  mount ShopifyApp::Engine, at: '/nested'
171
166
  ```
172
167
 
173
- This will create the Shopify engine routes under the specified subpath. You'll also need to make some updates to your `shopify_app.rb` and `omniauth.rb` initializers. First update the shopify_app initializer to include a custom `root_url` e.g.:
168
+ This will create the Shopify engine routes under the specified subpath. You'll also need to make some updates to your `shopify_app.rb` and `omniauth.rb` initializers. First, update the shopify_app initializer to include a custom `root_url` e.g.:
174
169
 
175
170
  ```ruby
176
171
  ShopifyApp.configure do |config|
@@ -216,7 +211,7 @@ Authentication
216
211
 
217
212
  ### Callback
218
213
 
219
- Upon completing the authentication flow Shopify calls the app at the `callback_path` mentioned before. If the app needs to do some extra work it can define and configure the route to a custom callback controller, inheriting from `ShopifyApp::CallbackController` and hook into or override any of the defined helper methods. The default callback controller already provides the following behaviour:
214
+ Upon completing the authentication flow, Shopify calls the app at the `callback_path` mentioned before. If the app needs to do some extra work, it can define and configure the route to a custom callback controller, inheriting from `ShopifyApp::CallbackController` and hook into or override any of the defined helper methods. The default callback controller already provides the following behaviour:
220
215
  * Logging into the shop and resetting the session
221
216
  * [Installing Webhooks](https://github.com/Shopify/shopify_app#webhooksmanager)
222
217
  * [Setting Scripttags](https://github.com/Shopify/shopify_app#scripttagsmanager)
@@ -227,22 +222,22 @@ Upon completing the authentication flow Shopify calls the app at the `callback_p
227
222
 
228
223
  ### ShopifyApp::SessionRepository
229
224
 
230
- `ShopifyApp::SessionRepository` allows you as a developer to define how your sessions are stored and retrieved for shops. The `SessionRepository` is configured in the `config/initializers/shopify_app.rb` file and can be set to any object that implements `self.store(auth_session, *args)` which stores the session and returns a unique identifier and `self.retrieve(id)` which returns a `ShopifyAPI::Session` for the passed id. These methods are already implemented as part of the `ShopifyApp::SessionStorage` concern, but can be overridden for custom implementation.
225
+ `ShopifyApp::SessionRepository` allows you as a developer to define how your sessions are stored and retrieved for shops. The `SessionRepository` is configured in the `config/initializers/shopify_app.rb` file and can be set to any object that implements `self.store(auth_session, *args)` which stores the session and returns a unique identifier and `self.retrieve(id)` which returns a `ShopifyAPI::Session` for the passed id. These methods are already implemented as part of the `ShopifyApp::SessionStorage` concern but can be overridden for custom implementation.
231
226
 
232
227
  #### Shop-based token storage
233
- Storing tokens on the store model means that any user login associated to the store will have equal access levels to whatever the original user granted the app.
228
+ Storing tokens on the store model means that any user login associated with the store will have equal access levels to whatever the original user granted the app.
234
229
  ```sh
235
230
  $ rails generate shopify_app:shop_model
236
231
  ```
237
232
  This will generate a shop model which will be the storage for the tokens necessary for authentication.
238
233
 
239
234
  #### User-based token storage
240
- A more granular control over level of access per user on an app might be necessary, to which the shop-based token strategy is not sufficient. Shopify supports a user-based token storage strategy where a unique token to each user can be managed. Shop tokens must still be maintained if you are running background jobs so that you can make use of them when necessary.
235
+ A more granular control over the level of access per user on an app might be necessary, to which the shop-based token strategy is not sufficient. Shopify supports a user-based token storage strategy where a unique token to each user can be managed. Shop tokens must still be maintained if you are running background jobs so that you can make use of them when necessary.
241
236
  ```sh
242
237
  $ rails generate shopify_app:shop_model
243
238
  $ rails generate shopify_app:user_model
244
239
  ```
245
- This will generate a shop model and user model which will be the storage for the tokens necessary for authentication.
240
+ This will generate a shop model and user model, which will be the storage for the tokens necessary for authentication.
246
241
 
247
242
  The current Shopify user will be stored in the rails session at `session[:shopify_user]`
248
243
 
@@ -276,7 +271,7 @@ For backwards compatibility, the engine still provides a controller called `Shop
276
271
 
277
272
  ### AfterAuthenticate Job
278
273
 
279
- If your app needs to perform specific actions after the user is authenticated successfully (i.e. every time a new session is created), ShopifyApp can queue or run a job of your choosing (note that we already provide support for automatically creating Webhooks and Scripttags). To configure the after authenticate job update your initializer as follows:
274
+ If your app needs to perform specific actions after the user is authenticated successfully (i.e. every time a new session is created), ShopifyApp can queue or run a job of your choosing (note that we already provide support for automatically creating Webhooks and Scripttags). To configure the after authenticate job, update your initializer as follows:
280
275
 
281
276
  ```ruby
282
277
  ShopifyApp.configure do |config|
@@ -324,11 +319,11 @@ ShopifyApp.configure do |config|
324
319
  end
325
320
  ```
326
321
 
327
- When the oauth callback is completed successfully ShopifyApp will queue a background job which will ensure all the specified webhooks exist for that shop. Because this runs on every oauth callback it means your app will always have the webhooks it needs even if the user uninstalls and re-installs the app.
322
+ When the OAuth callback is completed successfully, ShopifyApp will queue a background job which will ensure all the specified webhooks exist for that shop. Because this runs on every OAuth callback, it means your app will always have the webhooks it needs even if the user uninstalls and re-installs the app.
328
323
 
329
- ShopifyApp also provides a WebhooksController that receives webhooks and queues a job based on the received topic. For example if you register the webhook from above then all you need to do is create a job called `CartsUpdateJob`. The job will be queued with 2 params: `shop_domain` and `webhook` (which is the webhook body).
324
+ ShopifyApp also provides a WebhooksController that receives webhooks and queues a job based on the received topic. For example, if you register the webhook from above, then all you need to do is create a job called `CartsUpdateJob`. The job will be queued with 2 params: `shop_domain` and `webhook` (which is the webhook body).
330
325
 
331
- If you would like to namespace your jobs you may set `webhook_jobs_namespace` in the config. For example if your app handles webhooks from other ecommerce applications as well, and you want Shopify cart update webhooks to be processed by a job living in `jobs/shopify/webhooks/carts_update_job.rb` rather than `jobs/carts_update_job.rb`):
326
+ If you would like to namespace your jobs, you may set `webhook_jobs_namespace` in the config. For example, if your app handles webhooks from other ecommerce applications as well, and you want Shopify cart update webhooks to be processed by a job living in `jobs/shopify/webhooks/carts_update_job.rb` rather than `jobs/carts_update_job.rb`):
332
327
 
333
328
  ```ruby
334
329
  ShopifyApp.configure do |config|
@@ -366,9 +361,9 @@ class CustomWebhooksController < ApplicationController
366
361
  end
367
362
  ```
368
363
 
369
- The module skips the `verify_authenticity_token` before_action and adds an action to verify that the webhook came from Shopify. You can now add a post route to your application pointing to the controller and action to accept the webhook data from Shopify.
364
+ The module skips the `verify_authenticity_token` before_action and adds an action to verify that the webhook came from Shopify. You can now add a post route to your application, pointing to the controller and action to accept the webhook data from Shopify.
370
365
 
371
- The WebhooksManager uses ActiveJob, if ActiveJob is not configured then by default Rails will run the jobs inline. However it is highly recommended to configure a proper background processing queue like sidekiq or resque in production.
366
+ The WebhooksManager uses ActiveJob. If ActiveJob is not configured then by default Rails will run the jobs inline. However, it is highly recommended to configure a proper background processing queue like Sidekiq or Resque in production.
372
367
 
373
368
  ShopifyApp can create webhooks for you using the `add_webhook` generator. This will add the new webhook to your config and create the required job class for you.
374
369
 
@@ -376,7 +371,7 @@ ShopifyApp can create webhooks for you using the `add_webhook` generator. This w
376
371
  rails g shopify_app:add_webhook -t carts/update -a https://example.com/webhooks/carts_update
377
372
  ```
378
373
 
379
- where `-t` is the topic and `-a` is the address the webhook should be sent to.
374
+ Where `-t` is the topic and `-a` is the address the webhook should be sent to.
380
375
 
381
376
  ScripttagsManager
382
377
  -----------------
@@ -459,7 +454,7 @@ class ReviewsController < ApplicationController
459
454
  end
460
455
  ```
461
456
 
462
- Create your app proxy url in the [Shopify Partners' Dashboard][dashboard], making sure to point it to `https://your_app_website.com/app_proxy`.
457
+ Create your app proxy URL in the [Shopify Partners' Dashboard][dashboard], making sure to point it to `https://your_app_website.com/app_proxy`.
463
458
  ![Creating an App Proxy](/images/app-proxy-screenshot.png)
464
459
 
465
460
  App Bridge
@@ -475,7 +470,7 @@ see [TROUBLESHOOTING.md](https://github.com/Shopify/shopify_app/blob/master/docs
475
470
  Using Test Helpers inside your Application
476
471
  -----------------------------------------
477
472
 
478
- A test helper that will allow you to test `ShopifyApp::WebhookVerification` in the controller from your app, to use this test, you need to `require` it directly in side you app `test/controllers/webhook_verification_test.rb`.
473
+ A test helper that will allow you to test `ShopifyApp::WebhookVerification` in the controller from your app, to use this test, you need to `require` it directly inside your app `test/controllers/webhook_verification_test.rb`.
479
474
 
480
475
  ```ruby
481
476
  require 'test_helper'
@@ -484,7 +479,7 @@ A test helper that will allow you to test `ShopifyApp::WebhookVerification` in t
484
479
  require 'shopify_app/test_helpers/webhook_verification_helper'
485
480
  ```
486
481
 
487
- or you can require in your `test/test_helper.rb`
482
+ Or you can require in your `test/test_helper.rb`.
488
483
 
489
484
  ```ruby
490
485
  ENV['RAILS_ENV'] ||= 'test'
@@ -521,7 +516,7 @@ change to how session stores work. Here are the steps to migrate to 13.x
521
516
  - *CHANGE* `include ShopifyApp::SessionStorage` to `include ShopifyApp::ShopSessionStorage`
522
517
 
523
518
  ### Changes to the @shop_session instance variable (normally in `app/controllers/*.rb`)
524
- - *CHANGE* if you are using shop sessions, `@shop_session` will need to be changed to `@current_shopify_session`
519
+ - *CHANGE* if you are using shop sessions, `@shop_session` will need to be changed to `@current_shopify_session`.
525
520
 
526
521
  ### Changes to Rails `session`
527
522
  - *CHANGE* `session[:shopify]` is no longer set. Use `session[:user_id]` if your app uses user based tokens, or `session[:shop_id]` if your app uses shop based tokens.
@@ -529,11 +524,13 @@ change to how session stores work. Here are the steps to migrate to 13.x
529
524
  ### Changes to `ShopifyApp::LoginProtection`
530
525
  `ShopifyApp::LoginProtection`
531
526
 
532
- if you are using `ShopifyApp::LoginProtection#shop_session` in your code, it will need to be
527
+ - CHANGE if you are using `ShopifyApp::LoginProtection#shopify_session` in your code, it will need to be
533
528
  changed to `ShopifyApp::LoginProtection#activate_shopify_session`
529
+ - CHANGE if you are using `ShopifyApp::LoginProtection#clear_shop_session` in your code, it will need to be
530
+ changed to `ShopifyApp::LoginProtection#clear_shopify_session`
534
531
 
535
532
  ### Notes
536
- You do not need a user model, a shop session is fine for most applications.
533
+ You do not need a user model; a shop session is fine for most applications.
537
534
 
538
535
  Questions or problems?
539
536
  ----------------------
@@ -571,7 +568,7 @@ Upgrading from 8.6 to 9.0.0
571
568
 
572
569
  ### Configuration change
573
570
 
574
- Add an api version configuration in `config/initializers/shopify_app.rb`
571
+ Add an API version configuration in `config/initializers/shopify_app.rb`
575
572
  Set this to the version you want to run against by default. See [Shopify API docs](https://help.shopify.com/en/api/versioning) for versions available.
576
573
  ```ruby
577
574
  config.api_version = '2019-04'
@@ -579,7 +576,7 @@ config.api_version = '2019-04'
579
576
 
580
577
  ### Session storage change
581
578
 
582
- You will need to add an `api_version` method to you session storage object. The default implementation for this is.
579
+ You will need to add an `api_version` method to your session storage object. The default implementation for this is.
583
580
  ```ruby
584
581
  def api_version
585
582
  ShopifyApp.configuration.api_version
@@ -617,7 +614,7 @@ is changed to
617
614
 
618
615
  ### ShopifyAPI changes
619
616
 
620
- You will need to also follow the ShopifyAPI [upgrade guide](https://github.com/Shopify/shopify_api/blob/master/README.md#-breaking-change-notice-for-version-700-) to ensure your app is ready to work with api versioning.
617
+ You will need to also follow the ShopifyAPI [upgrade guide](https://github.com/Shopify/shopify_api/blob/master/README.md#-breaking-change-notice-for-version-700-) to ensure your app is ready to work with API versioning.
621
618
 
622
619
  [dashboard]:https://partners.shopify.com
623
620
  [app-bridge]:https://help.shopify.com/en/api/embedded-apps/app-bridge
@@ -0,0 +1,59 @@
1
+ # Security Policy
2
+
3
+ ## Supported versions
4
+
5
+ ### New features
6
+
7
+ New features will only be added to the master branch and will not be made available in point releases.
8
+
9
+ ### Bug fixes
10
+
11
+ Only the latest release series will receive bug fixes. When enough bugs are fixed and its deemed worthy to release a new gem, this is the branch it happens from.
12
+
13
+ ### Security issues
14
+
15
+ Only the latest release series will receive patches and new versions in case of a security issue.
16
+
17
+ ### Severe security issues
18
+
19
+ For severe security issues we will provide new versions as above, and also the last major release series will receive patches and new versions. The classification of the security issue is judged by the core team.
20
+
21
+ ### Unsupported Release Series
22
+
23
+ When a release series is no longer supported, it's your own responsibility to deal with bugs and security issues. If you are not comfortable maintaining your own versions, you should upgrade to a supported version.
24
+
25
+ ## Reporting a bug
26
+
27
+ All security bugs in shopify repositories should be reported to [our hackerone program](https://hackerone.com/shopify)
28
+ Shopify's whitehat program is our way to reward security researchers for finding serious security vulnerabilities in the In Scope properties listed at the bottom of this page, including our core application (all functionality associated with a Shopify store, particularly your-store.myshopify.com/admin) and certain ancillary applications.
29
+
30
+ ## Disclosure Policy
31
+
32
+ We look forward to working with all security researchers and strive to be respectful, always assume the best and treat others as peers. We expect the same in return from all participants. To achieve this, our team strives to:
33
+
34
+ - Reply to all reports within one business day and triage within two business days (if applicable)
35
+ - Be as transparent as possible, answering all inquires about our report decisions and adding hackers to duplicate HackerOne reports
36
+ - Award bounties within a week of resolution (excluding extenuating circumstances)
37
+ - Only close reports as N/A when the issue reported is included in Known Issues, Ineligible Vulnerabilities Types or lacks evidence of a vulnerability
38
+
39
+ **The following rules must be followed in order for any rewards to be paid:**
40
+
41
+ - You may only test against shops you have created which include your HackerOne YOURHANDLE @ wearehackerone.com registered email address.
42
+ - You must not attempt to gain access to, or interact with, any shops other than those created by you.
43
+ - The use of commercial scanners is prohibited (e.g., Nessus).
44
+ - Rules for reporting must be followed.
45
+ - Do not disclose any issues publicly before they have been resolved.
46
+ - Shopify reserves the right to modify the rules for this program or deem any submissions invalid at any time. Shopify may cancel the whitehat program without notice at any time.
47
+ - Contacting Shopify Support over chat, email or phone about your HackerOne report is not allowed. We may disqualify you from receiving a reward, or from participating in the program altogether.
48
+ - You are not an employee of Shopify; employees should report bugs to the internal bug bounty program.
49
+ - You hereby represent, warrant and covenant that any content you submit to Shopify is an original work of authorship and that you are legally entitled to grant the rights and privileges conveyed by these terms. You further represent, warrant and covenant that the consent of no other person or entity is or will be necessary for Shopify to use the submitted content.
50
+ - By submitting content to Shopify, you irrevocably waive all moral rights which you may have in the content.
51
+ - All content submitted by you to Shopify under this program is licensed under the MIT License.
52
+ - You must report any discovered vulnerability to Shopify as soon as you have validated the vulnerability.
53
+ - Failure to follow any of the foregoing rules will disqualify you from participating in this program.
54
+
55
+ ** Please see our [Hackerone Profile](https://hackerone.com/shopify) for full details
56
+
57
+ ## Receiving Security Updates
58
+
59
+ To recieve all general updates to vulnerabilities, please subscribe to our hackerone [Hacktivity](https://hackerone.com/shopify/hacktivity)