shopify_app 13.2.0 → 14.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/PULL_REQUEST_TEMPLATE.md +6 -0
- data/.github/workflows/rubocop.yml +28 -0
- data/.rubocop.yml +1 -0
- data/.travis.yml +0 -1
- data/CHANGELOG.md +23 -0
- data/Gemfile +3 -1
- data/README.md +24 -17
- data/SECURITY.md +59 -0
- data/app/controllers/concerns/shopify_app/authenticated.rb +1 -0
- data/app/controllers/concerns/shopify_app/require_known_shop.rb +39 -0
- data/app/controllers/shopify_app/callback_controller.rb +4 -2
- data/app/controllers/shopify_app/extension_verification_controller.rb +2 -7
- data/config/locales/nl.yml +1 -1
- data/docs/Quickstart.md +7 -17
- data/lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator.rb +1 -1
- data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +20 -2
- data/lib/generators/shopify_app/home_controller/templates/index.html.erb +67 -17
- data/lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb +10 -0
- data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +1 -1
- data/lib/generators/shopify_app/install/templates/flash_messages.js +0 -2
- data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +1 -0
- data/lib/generators/shopify_app/products_controller/products_controller_generator.rb +19 -0
- data/lib/generators/shopify_app/products_controller/templates/products_controller.rb +8 -0
- data/lib/generators/shopify_app/shopify_app_generator.rb +1 -1
- data/lib/shopify_app.rb +3 -1
- data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +0 -1
- data/lib/shopify_app/controller_concerns/csrf_protection.rb +15 -0
- data/lib/shopify_app/controller_concerns/login_protection.rb +8 -0
- data/lib/shopify_app/controller_concerns/payload_verification.rb +24 -0
- data/lib/shopify_app/controller_concerns/webhook_verification.rb +1 -17
- data/lib/shopify_app/middleware/jwt_middleware.rb +1 -0
- data/lib/shopify_app/version.rb +1 -1
- data/package-lock.json +7 -75
- data/package.json +1 -1
- data/shopify_app.gemspec +2 -2
- data/yarn.lock +9 -9
- metadata +14 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb6669e0b864299f689103042e4c59cb4ddc7e53481b559275b64accc6e390b9
|
4
|
+
data.tar.gz: 9e3481e24e1e44ef799ac573025e532814acff362d0c9ea3f44b3e4000a68037
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13f7898748c764d9093d8479ce61a3b1f2d5e9d3ebf7b04a952af7587ef243f9c785c3573c45a915a909a6b9d6cb15ea0d63ab34ed424c45401419f331aa141d
|
7
|
+
data.tar.gz: ba8649d90387c3c5c8050ad69923a9e56509955016c5d8bfd955e8870bf0d55f6ed3956dc1643e2f11aa655730e82504e7c28a472a7fcc542a4977b76169ebf4
|
@@ -0,0 +1,6 @@
|
|
1
|
+
Before submitting the PR, please consider if any of the following are needed:
|
2
|
+
|
3
|
+
- [ ] Update `CHANGELOG.md` if the changes would impact users
|
4
|
+
- [ ] Update `README.md`, if appropriate.
|
5
|
+
- [ ] Update any relevant pages in `docs/`, if necessary
|
6
|
+
- [ ] For security fixes, the [Disclosure Policy](https://github.com/Shopify/shopify_app/blob/master/SECURITY.md#disclosure-policy) must be followed.
|
@@ -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
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
14.0.0
|
2
|
+
------
|
3
|
+
* Ruby 2.4 is no longer supported by this gem
|
4
|
+
* Bump gemspec ruby dependency to 2.5
|
5
|
+
* (Beta) Add `--with-session-token` flag to the Shopify App generator to create an app that is compatible with App Bridge Authentication
|
6
|
+
|
7
|
+
13.5.0
|
8
|
+
------
|
9
|
+
* Add `signal_access_token_required` helper method for apps to indicate access token has expired and that a new one is required
|
10
|
+
|
11
|
+
13.4.1
|
12
|
+
------
|
13
|
+
* Fix the version checks for the dependency on `shopify_api` to allow all of v9.X
|
14
|
+
|
15
|
+
13.4.0
|
16
|
+
------
|
17
|
+
* 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)
|
18
|
+
|
19
|
+
13.3.0
|
20
|
+
------
|
21
|
+
* Added Payload Verification module [#992](https://github.com/Shopify/shopify_app/pull/992)
|
22
|
+
* Add concern to check for valid shop domains in the unauthenticated controller
|
23
|
+
|
1
24
|
13.2.0
|
2
25
|
------
|
3
26
|
* Get current shop domain from JWT header
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -32,7 +32,7 @@ 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
|
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
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
|
|
@@ -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
|
-
$
|
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.
|
@@ -75,7 +74,7 @@ Generators
|
|
75
74
|
|
76
75
|
### Default Generator
|
77
76
|
|
78
|
-
The default generator will run the `install`, `shop`, and `home_controller` generators. This is the recommended way to start a new app from scratch:
|
77
|
+
The default generator will run the `install`, `shop`, `authenticated_controller`, and `home_controller` generators. This is the recommended way to start a new app from scratch:
|
79
78
|
|
80
79
|
```sh
|
81
80
|
$ rails generate shopify_app
|
@@ -99,16 +98,12 @@ These values can be found on the "App Setup" page in the [Shopify Partners Dashb
|
|
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
|
-
|
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
|
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`
|
@@ -128,6 +123,16 @@ $ rails generate shopify_app:home_controller
|
|
128
123
|
|
129
124
|
This generator creates an example home controller and view which fetches and displays products using the Shopify API.
|
130
125
|
|
126
|
+
Options include:
|
127
|
+
* __[beta]__ `with-session-token`: This flag generates an unauthenticated home_controller and a protected sample products_controller. It also creates a home view that leverages a session token to fetch products from your products_controller. Use this flag if you plan to build a single-page application or to secure your app using JWT session tokens (e.g. `--with-session-token` or `--with-session-token true`).
|
128
|
+
|
129
|
+
### Products Controller Generator
|
130
|
+
|
131
|
+
```sh
|
132
|
+
$ rails generate shopify_app:products_controller
|
133
|
+
```
|
134
|
+
|
135
|
+
This generator creates an example products API controller to fetch products using the Shopify API.
|
131
136
|
|
132
137
|
### App Proxy Controller Generator
|
133
138
|
|
@@ -143,7 +148,7 @@ This optional generator, not included with the default generator, creates the ap
|
|
143
148
|
$ rails generate shopify_app:add_marketing_activity_extension
|
144
149
|
```
|
145
150
|
|
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
|
151
|
+
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
152
|
|
148
153
|
### Controllers, Routes and Views
|
149
154
|
|
@@ -324,7 +329,7 @@ ShopifyApp.configure do |config|
|
|
324
329
|
end
|
325
330
|
```
|
326
331
|
|
327
|
-
When the
|
332
|
+
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
333
|
|
329
334
|
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
335
|
|
@@ -368,7 +373,7 @@ end
|
|
368
373
|
|
369
374
|
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
375
|
|
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
|
376
|
+
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
377
|
|
373
378
|
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
379
|
|
@@ -459,7 +464,7 @@ class ReviewsController < ApplicationController
|
|
459
464
|
end
|
460
465
|
```
|
461
466
|
|
462
|
-
Create your app proxy
|
467
|
+
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
468
|
![Creating an App Proxy](/images/app-proxy-screenshot.png)
|
464
469
|
|
465
470
|
App Bridge
|
@@ -529,8 +534,10 @@ change to how session stores work. Here are the steps to migrate to 13.x
|
|
529
534
|
### Changes to `ShopifyApp::LoginProtection`
|
530
535
|
`ShopifyApp::LoginProtection`
|
531
536
|
|
532
|
-
if you are using `ShopifyApp::LoginProtection#
|
537
|
+
- CHANGE if you are using `ShopifyApp::LoginProtection#shopify_session` in your code, it will need to be
|
533
538
|
changed to `ShopifyApp::LoginProtection#activate_shopify_session`
|
539
|
+
- CHANGE if you are using `ShopifyApp::LoginProtection#clear_shop_session` in your code, it will need to be
|
540
|
+
changed to `ShopifyApp::LoginProtection#clear_shopify_session`
|
534
541
|
|
535
542
|
### Notes
|
536
543
|
You do not need a user model; a shop session is fine for most applications.
|
@@ -571,7 +578,7 @@ Upgrading from 8.6 to 9.0.0
|
|
571
578
|
|
572
579
|
### Configuration change
|
573
580
|
|
574
|
-
Add an
|
581
|
+
Add an API version configuration in `config/initializers/shopify_app.rb`
|
575
582
|
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
583
|
```ruby
|
577
584
|
config.api_version = '2019-04'
|
@@ -617,7 +624,7 @@ is changed to
|
|
617
624
|
|
618
625
|
### ShopifyAPI changes
|
619
626
|
|
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
|
627
|
+
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
628
|
|
622
629
|
[dashboard]:https://partners.shopify.com
|
623
630
|
[app-bridge]:https://help.shopify.com/en/api/embedded-apps/app-bridge
|
data/SECURITY.md
ADDED
@@ -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)
|
@@ -7,6 +7,7 @@ module ShopifyApp
|
|
7
7
|
included do
|
8
8
|
include ShopifyApp::Localization
|
9
9
|
include ShopifyApp::LoginProtection
|
10
|
+
include ShopifyApp::CsrfProtection
|
10
11
|
include ShopifyApp::EmbeddedApp
|
11
12
|
before_action :login_again_if_different_user_or_shop
|
12
13
|
around_action :activate_shopify_session
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ShopifyApp
|
4
|
+
module RequireKnownShop
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
before_action :check_shop_domain
|
9
|
+
before_action :check_shop_known
|
10
|
+
end
|
11
|
+
|
12
|
+
def current_shopify_domain
|
13
|
+
return if params[:shop].blank?
|
14
|
+
@shopify_domain ||= ShopifyApp::Utils.sanitize_shop_domain(params[:shop])
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def check_shop_domain
|
20
|
+
redirect_to(ShopifyApp.configuration.login_url) unless current_shopify_domain
|
21
|
+
end
|
22
|
+
|
23
|
+
def check_shop_known
|
24
|
+
@shop = SessionRepository.retrieve_shop_session_by_shopify_domain(current_shopify_domain)
|
25
|
+
redirect_to(shop_login) unless @shop
|
26
|
+
end
|
27
|
+
|
28
|
+
def shop_login
|
29
|
+
url = URI(ShopifyApp.configuration.login_url)
|
30
|
+
|
31
|
+
url.query = URI.encode_www_form(
|
32
|
+
shop: params[:shop],
|
33
|
+
return_to: request.fullpath,
|
34
|
+
)
|
35
|
+
|
36
|
+
url.to_s
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -65,9 +65,9 @@ module ShopifyApp
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def associated_user
|
68
|
-
return unless auth_hash
|
68
|
+
return unless auth_hash.dig('extra', 'associated_user').present?
|
69
69
|
|
70
|
-
auth_hash['extra']['associated_user']
|
70
|
+
auth_hash['extra']['associated_user'].merge('scope' => auth_hash['extra']['associated_user_scope'])
|
71
71
|
end
|
72
72
|
|
73
73
|
def associated_user_id
|
@@ -92,9 +92,11 @@ module ShopifyApp
|
|
92
92
|
|
93
93
|
session[:shopify_user] = associated_user
|
94
94
|
if session[:shopify_user].present?
|
95
|
+
session[:shop_id] = nil if shop_session && shop_session.domain != shop_name
|
95
96
|
session[:user_id] = ShopifyApp::SessionRepository.store_user_session(session_store, associated_user)
|
96
97
|
else
|
97
98
|
session[:shop_id] = ShopifyApp::SessionRepository.store_shop_session(session_store)
|
99
|
+
session[:user_id] = nil if user_session && user_session.domain != shop_name
|
98
100
|
end
|
99
101
|
session[:shopify_domain] = shop_name
|
100
102
|
session[:user_session] = auth_hash&.extra&.session
|
@@ -2,19 +2,14 @@
|
|
2
2
|
|
3
3
|
module ShopifyApp
|
4
4
|
class ExtensionVerificationController < ActionController::Base
|
5
|
+
include ShopifyApp::PayloadVerification
|
5
6
|
protect_from_forgery with: :null_session
|
6
7
|
before_action :verify_request
|
7
8
|
|
8
9
|
private
|
9
10
|
|
10
11
|
def verify_request
|
11
|
-
|
12
|
-
request_body = request.body.read
|
13
|
-
secret = ShopifyApp.configuration.secret
|
14
|
-
digest = OpenSSL::Digest.new('sha256')
|
15
|
-
|
16
|
-
expected_hmac = Base64.strict_encode64(OpenSSL::HMAC.digest(digest, secret, request_body))
|
17
|
-
head(:unauthorized) unless ActiveSupport::SecurityUtils.secure_compare(expected_hmac, hmac_header)
|
12
|
+
head(:unauthorized) unless hmac_valid?(request.body.read)
|
18
13
|
end
|
19
14
|
end
|
20
15
|
end
|
data/config/locales/nl.yml
CHANGED
data/docs/Quickstart.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
Quickstart
|
2
2
|
==========
|
3
3
|
|
4
|
-
Get started building and deploying a new Shopify App to Heroku in just a few minutes.
|
4
|
+
Get started building and deploying a new Shopify App to Heroku in just a few minutes.
|
5
|
+
This guide assumes you have Ruby, Rails and PostgreSQL installed on your computer already; if you haven't done that already start with [this guide.](https://guides.rubyonrails.org/v5.0/getting_started.html#installing-rails)
|
5
6
|
|
6
7
|
1. New Rails App (with postgres)
|
7
8
|
--------------------------------
|
@@ -26,15 +27,6 @@ Head to the Heroku dashboard and create a new app, or run the following commands
|
|
26
27
|
CLI:
|
27
28
|
```sh
|
28
29
|
$ heroku create name
|
29
|
-
$ heroku git:remote -a name
|
30
|
-
```
|
31
|
-
|
32
|
-
Once you have created an app on Heroku, we need to let Git know where the Heroku server is so we can deploy to it later. Copy the app's name from your Heroku dashboard and substitute `appname.git` with the name you chose earlier:
|
33
|
-
|
34
|
-
web:
|
35
|
-
```sh
|
36
|
-
# https://dashboard.heroku.com/new
|
37
|
-
$ git remote add heroku git@heroku.com:appname.git
|
38
30
|
```
|
39
31
|
|
40
32
|
3. Create a new App in the Shopify Partner dashboard
|
@@ -48,11 +40,10 @@ $ git remote add heroku git@heroku.com:appname.git
|
|
48
40
|
4. Add ShopifyApp to Gemfile
|
49
41
|
----------------------------
|
50
42
|
|
51
|
-
Run
|
43
|
+
Run this command to add the `shopify_app` Gem to your app:
|
52
44
|
|
53
45
|
```sh
|
54
|
-
$
|
55
|
-
$ bundle install
|
46
|
+
$ bundle add shopify_app
|
56
47
|
```
|
57
48
|
|
58
49
|
**Note:** we recommend using the latest version of Shopify Gem. Check the [Git tags](https://github.com/Shopify/shopify_app/tags) to see the latest release version and then add it to your Gemfile e.g `gem 'shopify_app', '~> 7.0.0'`
|
@@ -64,14 +55,13 @@ Generate the code for your app by running these commands:
|
|
64
55
|
|
65
56
|
```sh
|
66
57
|
# Use the keys from your app you created in the partners area
|
67
|
-
$ rails generate shopify_app
|
58
|
+
$ rails generate shopify_app
|
68
59
|
$ git add .
|
69
60
|
$ git commit -m 'generated shopify app'
|
70
61
|
```
|
71
62
|
|
72
|
-
|
73
|
-
|
74
|
-
We recommend adding a gem or utilizing environment variables (`.env`) to handle your keys before releasing your app. [Learn more about using environment variables.](https://www.honeybadger.io/blog/ruby-guide-environment-variables/)
|
63
|
+
Your API key and secret are read from environment variables. Refer to the main
|
64
|
+
README for further details on how to set this up.
|
75
65
|
|
76
66
|
6. Deploy your app
|
77
67
|
---------
|
data/lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator.rb
CHANGED
@@ -7,7 +7,7 @@ module ShopifyApp
|
|
7
7
|
class AuthenticatedControllerGenerator < Rails::Generators::Base
|
8
8
|
source_root File.expand_path('../templates', __FILE__)
|
9
9
|
|
10
|
-
def
|
10
|
+
def create_authenticated_controller
|
11
11
|
template('authenticated_controller.rb', 'app/controllers/authenticated_controller.rb')
|
12
12
|
end
|
13
13
|
end
|
@@ -6,21 +6,39 @@ module ShopifyApp
|
|
6
6
|
class HomeControllerGenerator < Rails::Generators::Base
|
7
7
|
source_root File.expand_path('../templates', __FILE__)
|
8
8
|
|
9
|
+
class_option :with_session_token, type: :boolean, default: false
|
10
|
+
|
9
11
|
def create_home_controller
|
10
|
-
|
12
|
+
@with_session_token = options['with_session_token']
|
13
|
+
|
14
|
+
template(home_controller_template, 'app/controllers/home_controller.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_products_controller
|
18
|
+
generate("shopify_app:products_controller") if with_session_token?
|
11
19
|
end
|
12
20
|
|
13
21
|
def create_home_index_view
|
14
|
-
|
22
|
+
template('index.html.erb', 'app/views/home/index.html.erb')
|
15
23
|
end
|
16
24
|
|
17
25
|
def add_home_index_route
|
18
26
|
route("root :to => 'home#index'")
|
19
27
|
end
|
20
28
|
|
29
|
+
private
|
30
|
+
|
21
31
|
def embedded_app?
|
22
32
|
ShopifyApp.configuration.embedded_app?
|
23
33
|
end
|
34
|
+
|
35
|
+
def with_session_token?
|
36
|
+
@with_session_token
|
37
|
+
end
|
38
|
+
|
39
|
+
def home_controller_template
|
40
|
+
with_session_token? ? 'unauthenticated_home_controller.rb' : 'home_controller.rb'
|
41
|
+
end
|
24
42
|
end
|
25
43
|
end
|
26
44
|
end
|
@@ -1,21 +1,71 @@
|
|
1
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="<%= I18n.locale %>">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
6
|
+
<link
|
7
|
+
rel="stylesheet"
|
8
|
+
href="https://unpkg.com/@shopify/polaris@4.25.0/styles.min.css"
|
9
|
+
/>
|
10
|
+
<% if @with_session_token %> <script>
|
11
|
+
document.addEventListener("DOMContentLoaded", async function() {
|
12
|
+
var SessionToken = window["app-bridge"].actions.SessionToken
|
13
|
+
var app = window.app;
|
2
14
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
<% end %>
|
7
|
-
</ul>
|
15
|
+
app.dispatch(
|
16
|
+
SessionToken.request(),
|
17
|
+
);
|
8
18
|
|
9
|
-
|
19
|
+
// Save a session token for future requests
|
20
|
+
window.sessionToken = await new Promise((resolve) => {
|
21
|
+
app.subscribe(SessionToken.ActionType.RESPOND, (data) => {
|
22
|
+
resolve(data.sessionToken || "");
|
23
|
+
});
|
24
|
+
});
|
10
25
|
|
11
|
-
|
26
|
+
var fetchProducts = function() {
|
27
|
+
var headers = new Headers({ "Authorization": "Bearer " + window.sessionToken });
|
28
|
+
return fetch("/products", { headers })
|
29
|
+
.then(response => response.json())
|
30
|
+
.then(data => {
|
31
|
+
var products = data.products;
|
12
32
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
33
|
+
if (products === undefined || products.length == 0) {
|
34
|
+
document.getElementById("products").innerHTML = "<br>No products to display.";
|
35
|
+
} else {
|
36
|
+
var list = "";
|
37
|
+
products.forEach((product) => {
|
38
|
+
var link = `<a target="_top" href="https://<%%= @shop_origin %>/admin/products/${product.id}">`
|
39
|
+
list += "<li>" + link + product.title + "</a></li>";
|
40
|
+
});
|
41
|
+
document.getElementById("products").innerHTML = "<ul>" + list + "</ul>";
|
42
|
+
}
|
43
|
+
});
|
44
|
+
}();
|
45
|
+
});
|
46
|
+
</script>
|
47
|
+
<% end %> </head>
|
48
|
+
<body>
|
49
|
+
<h2>Products</h2>
|
50
|
+
<% if @with_session_token %> <div id="products"><br>Loading...</div><% else %>
|
51
|
+
<ul>
|
52
|
+
<%% @products.each do |product| %>
|
53
|
+
<li><%%= link_to product.title, "https://#{@current_shopify_session.domain}/admin/products/#{product.id}", target: "_top" %></li>
|
54
|
+
<%% end %>
|
55
|
+
</ul>
|
56
|
+
|
57
|
+
<hr>
|
58
|
+
|
59
|
+
<h2>Webhooks</h2>
|
60
|
+
|
61
|
+
<%% if @webhooks.present? %>
|
62
|
+
<ul>
|
63
|
+
<%% @webhooks.each do |webhook| %>
|
64
|
+
<li><%%= webhook.topic %> : <%%= webhook.address %></li>
|
65
|
+
<%% end %>
|
66
|
+
</ul>
|
67
|
+
<%% else %>
|
68
|
+
<p>This app has not created any webhooks for this Shop. Add webhooks to your ShopifyApp initializer if you need webhooks</p>
|
69
|
+
<%% end %><% end %>
|
70
|
+
</body>
|
71
|
+
</html>
|
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
<%= content_tag(:div, nil, id: 'shopify-app-init', data: {
|
30
30
|
api_key: ShopifyApp.configuration.api_key,
|
31
|
-
shop_origin: (@current_shopify_session.domain if @current_shopify_session),
|
31
|
+
shop_origin: @shop_origin || (@current_shopify_session.domain if @current_shopify_session),
|
32
32
|
debug: Rails.env.development?
|
33
33
|
} ) %>
|
34
34
|
|
@@ -9,6 +9,7 @@ ShopifyApp.configure do |config|
|
|
9
9
|
config.after_authenticate_job = false
|
10
10
|
config.api_version = "<%= @api_version %>"
|
11
11
|
config.shop_session_repository = 'Shop'
|
12
|
+
config.allow_jwt_authentication = true
|
12
13
|
end
|
13
14
|
|
14
15
|
# ShopifyApp::Utils.fetch_known_api_versions # Uncomment to fetch known api versions from shopify servers on boot
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators/base'
|
4
|
+
|
5
|
+
module ShopifyApp
|
6
|
+
module Generators
|
7
|
+
class ProductsControllerGenerator < Rails::Generators::Base
|
8
|
+
source_root File.expand_path('../templates', __FILE__)
|
9
|
+
|
10
|
+
def create_products_controller
|
11
|
+
template('products_controller.rb', 'app/controllers/products_controller.rb')
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_products_route
|
15
|
+
route("get '/products', :to => 'products#index'")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -11,7 +11,7 @@ module ShopifyApp
|
|
11
11
|
generate("shopify_app:install #{@opts.join(' ')}")
|
12
12
|
generate("shopify_app:shop_model")
|
13
13
|
generate("shopify_app:authenticated_controller")
|
14
|
-
generate("shopify_app:home_controller")
|
14
|
+
generate("shopify_app:home_controller #{@opts.join(' ')}")
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
data/lib/shopify_app.rb
CHANGED
@@ -27,12 +27,14 @@ module ShopifyApp
|
|
27
27
|
require 'shopify_app/utils'
|
28
28
|
|
29
29
|
# controller concerns
|
30
|
+
require 'shopify_app/controller_concerns/csrf_protection'
|
30
31
|
require 'shopify_app/controller_concerns/localization'
|
31
32
|
require 'shopify_app/controller_concerns/itp'
|
32
33
|
require 'shopify_app/controller_concerns/login_protection'
|
33
34
|
require 'shopify_app/controller_concerns/embedded_app'
|
34
|
-
require 'shopify_app/controller_concerns/
|
35
|
+
require 'shopify_app/controller_concerns/payload_verification'
|
35
36
|
require 'shopify_app/controller_concerns/app_proxy_verification'
|
37
|
+
require 'shopify_app/controller_concerns/webhook_verification'
|
36
38
|
|
37
39
|
# jobs
|
38
40
|
require 'shopify_app/jobs/webhooks_manager_job'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module ShopifyApp
|
3
|
+
module CsrfProtection
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
included do
|
6
|
+
protect_from_forgery with: :exception, unless: :valid_session_token?
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def valid_session_token?
|
12
|
+
request.env['jwt.shopify_domain']
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -14,6 +14,8 @@ module ShopifyApp
|
|
14
14
|
rescue_from ActiveResource::UnauthorizedAccess, with: :close_session
|
15
15
|
end
|
16
16
|
|
17
|
+
ACCESS_TOKEN_REQUIRED_HEADER = 'X-Shopify-API-Request-Failure-Unauthorized'
|
18
|
+
|
17
19
|
def activate_shopify_session
|
18
20
|
return redirect_to_login if current_shopify_session.blank?
|
19
21
|
clear_top_level_oauth_cookie
|
@@ -80,6 +82,10 @@ module ShopifyApp
|
|
80
82
|
end
|
81
83
|
end
|
82
84
|
|
85
|
+
def signal_access_token_required
|
86
|
+
response.set_header(ACCESS_TOKEN_REQUIRED_HEADER, true)
|
87
|
+
end
|
88
|
+
|
83
89
|
protected
|
84
90
|
|
85
91
|
def jwt_shopify_domain
|
@@ -204,6 +210,8 @@ module ShopifyApp
|
|
204
210
|
def return_address
|
205
211
|
return base_return_address unless ShopifyApp.configuration.allow_jwt_authentication
|
206
212
|
return_address_with_params(shop: current_shopify_domain)
|
213
|
+
rescue ShopifyDomainNotFound
|
214
|
+
base_return_address
|
207
215
|
end
|
208
216
|
|
209
217
|
def base_return_address
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module ShopifyApp
|
3
|
+
module PayloadVerification
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
def shopify_hmac
|
9
|
+
request.headers['HTTP_X_SHOPIFY_HMAC_SHA256']
|
10
|
+
end
|
11
|
+
|
12
|
+
def hmac_valid?(data)
|
13
|
+
secrets = [ShopifyApp.configuration.secret, ShopifyApp.configuration.old_secret].reject(&:blank?)
|
14
|
+
|
15
|
+
secrets.any? do |secret|
|
16
|
+
digest = OpenSSL::Digest.new('sha256')
|
17
|
+
ActiveSupport::SecurityUtils.secure_compare(
|
18
|
+
shopify_hmac,
|
19
|
+
Base64.strict_encode64(OpenSSL::HMAC.digest(digest, secret, data))
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
module ShopifyApp
|
3
3
|
module WebhookVerification
|
4
4
|
extend ActiveSupport::Concern
|
5
|
+
include ShopifyApp::PayloadVerification
|
5
6
|
|
6
7
|
included do
|
7
8
|
skip_before_action :verify_authenticity_token, raise: false
|
@@ -15,25 +16,8 @@ module ShopifyApp
|
|
15
16
|
return head(:unauthorized) unless hmac_valid?(data)
|
16
17
|
end
|
17
18
|
|
18
|
-
def hmac_valid?(data)
|
19
|
-
secrets = [ShopifyApp.configuration.secret, ShopifyApp.configuration.old_secret].reject(&:blank?)
|
20
|
-
|
21
|
-
secrets.any? do |secret|
|
22
|
-
digest = OpenSSL::Digest.new('sha256')
|
23
|
-
|
24
|
-
ActiveSupport::SecurityUtils.secure_compare(
|
25
|
-
shopify_hmac,
|
26
|
-
Base64.strict_encode64(OpenSSL::HMAC.digest(digest, secret, data))
|
27
|
-
)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
19
|
def shop_domain
|
32
20
|
request.headers['HTTP_X_SHOPIFY_SHOP_DOMAIN']
|
33
21
|
end
|
34
|
-
|
35
|
-
def shopify_hmac
|
36
|
-
request.headers['HTTP_X_SHOPIFY_HMAC_SHA256']
|
37
|
-
end
|
38
22
|
end
|
39
23
|
end
|
data/lib/shopify_app/version.rb
CHANGED
data/package-lock.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "shopify_app",
|
3
|
-
"version": "13.
|
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": {
|
@@ -2600,9 +2532,9 @@
|
|
2600
2532
|
"dev": true
|
2601
2533
|
},
|
2602
2534
|
"elliptic": {
|
2603
|
-
"version": "6.5.
|
2604
|
-
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.
|
2605
|
-
"integrity": "sha512-
|
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.
|
4583
|
-
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.
|
4584
|
-
"integrity": "sha512-
|
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
data/shopify_app.gemspec
CHANGED
@@ -9,13 +9,13 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.author = "Shopify"
|
10
10
|
s.summary = 'This gem is used to get quickly started with the Shopify API'
|
11
11
|
|
12
|
-
s.required_ruby_version = ">= 2.
|
12
|
+
s.required_ruby_version = ">= 2.5"
|
13
13
|
|
14
14
|
s.metadata['allowed_push_host'] = 'https://rubygems.org'
|
15
15
|
|
16
16
|
s.add_runtime_dependency('browser_sniffer', '~> 1.2.2')
|
17
17
|
s.add_runtime_dependency('rails', '> 5.2.1')
|
18
|
-
s.add_runtime_dependency('shopify_api', '~> 9.1
|
18
|
+
s.add_runtime_dependency('shopify_api', '~> 9.1')
|
19
19
|
s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 2.2.2')
|
20
20
|
s.add_runtime_dependency('jwt', '~> 2.2.1')
|
21
21
|
s.add_runtime_dependency('redirect_safely', '~> 1.0')
|
data/yarn.lock
CHANGED
@@ -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.
|
1297
|
-
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.
|
1298
|
-
integrity sha512-
|
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.
|
2043
|
-
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.
|
2044
|
-
integrity sha512-
|
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.
|
3206
|
-
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.
|
3207
|
-
integrity sha512-
|
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:
|
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-05
|
11
|
+
date: 2020-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: browser_sniffer
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 9.1
|
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.1
|
54
|
+
version: '9.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: omniauth-shopify-oauth2
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -243,7 +243,9 @@ files:
|
|
243
243
|
- ".babelrc"
|
244
244
|
- ".github/CODEOWNERS"
|
245
245
|
- ".github/ISSUE_TEMPLATE.md"
|
246
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
246
247
|
- ".github/probots.yml"
|
248
|
+
- ".github/workflows/rubocop.yml"
|
247
249
|
- ".gitignore"
|
248
250
|
- ".nvmrc"
|
249
251
|
- ".rubocop.yml"
|
@@ -254,6 +256,7 @@ files:
|
|
254
256
|
- LICENSE
|
255
257
|
- README.md
|
256
258
|
- Rakefile
|
259
|
+
- SECURITY.md
|
257
260
|
- app/assets/images/storage_access.svg
|
258
261
|
- app/assets/javascripts/shopify_app/enable_cookies.js
|
259
262
|
- app/assets/javascripts/shopify_app/itp_helper.js
|
@@ -265,6 +268,7 @@ files:
|
|
265
268
|
- app/assets/javascripts/shopify_app/top_level.js
|
266
269
|
- app/assets/javascripts/shopify_app/top_level_interaction.js
|
267
270
|
- app/controllers/concerns/shopify_app/authenticated.rb
|
271
|
+
- app/controllers/concerns/shopify_app/require_known_shop.rb
|
268
272
|
- app/controllers/shopify_app/authenticated_controller.rb
|
269
273
|
- app/controllers/shopify_app/callback_controller.rb
|
270
274
|
- app/controllers/shopify_app/extension_verification_controller.rb
|
@@ -326,6 +330,7 @@ files:
|
|
326
330
|
- lib/generators/shopify_app/home_controller/home_controller_generator.rb
|
327
331
|
- lib/generators/shopify_app/home_controller/templates/home_controller.rb
|
328
332
|
- lib/generators/shopify_app/home_controller/templates/index.html.erb
|
333
|
+
- lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb
|
329
334
|
- lib/generators/shopify_app/install/install_generator.rb
|
330
335
|
- lib/generators/shopify_app/install/templates/_flash_messages.html.erb
|
331
336
|
- lib/generators/shopify_app/install/templates/embedded_app.html.erb
|
@@ -337,6 +342,8 @@ files:
|
|
337
342
|
- lib/generators/shopify_app/install/templates/shopify_app_index.js
|
338
343
|
- lib/generators/shopify_app/install/templates/shopify_provider.rb
|
339
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
|
340
347
|
- lib/generators/shopify_app/rotate_shopify_token_job/rotate_shopify_token_job_generator.rb
|
341
348
|
- lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token.rake
|
342
349
|
- lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token_job.rb
|
@@ -355,10 +362,12 @@ files:
|
|
355
362
|
- lib/shopify_app.rb
|
356
363
|
- lib/shopify_app/configuration.rb
|
357
364
|
- lib/shopify_app/controller_concerns/app_proxy_verification.rb
|
365
|
+
- lib/shopify_app/controller_concerns/csrf_protection.rb
|
358
366
|
- lib/shopify_app/controller_concerns/embedded_app.rb
|
359
367
|
- lib/shopify_app/controller_concerns/itp.rb
|
360
368
|
- lib/shopify_app/controller_concerns/localization.rb
|
361
369
|
- lib/shopify_app/controller_concerns/login_protection.rb
|
370
|
+
- lib/shopify_app/controller_concerns/payload_verification.rb
|
362
371
|
- lib/shopify_app/controller_concerns/webhook_verification.rb
|
363
372
|
- lib/shopify_app/engine.rb
|
364
373
|
- lib/shopify_app/jobs/scripttags_manager_job.rb
|
@@ -400,7 +409,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
400
409
|
requirements:
|
401
410
|
- - ">="
|
402
411
|
- !ruby/object:Gem::Version
|
403
|
-
version: '2.
|
412
|
+
version: '2.5'
|
404
413
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
405
414
|
requirements:
|
406
415
|
- - ">="
|