shopify_app 21.0.0 → 22.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -0
- data/.github/ISSUE_TEMPLATE/ENHANCEMENT.md +9 -0
- data/.github/ISSUE_TEMPLATE/bug-report.md +30 -47
- data/.github/ISSUE_TEMPLATE/feature-request.md +5 -29
- data/.github/workflows/build.yml +11 -12
- data/.github/workflows/release.yml +2 -2
- data/.github/workflows/remove-labels-on-activity.yml +1 -1
- data/.github/workflows/rubocop.yml +2 -3
- data/.nvmrc +1 -1
- data/.rubocop.yml +2 -1
- data/.ruby-version +1 -1
- data/.spin/rails/prepare-application +8 -0
- data/CHANGELOG.md +173 -7
- data/CODE_OF_CONDUCT.md +46 -0
- data/CONTRIBUTING.md +16 -6
- data/Gemfile +1 -0
- data/Gemfile.lock +160 -121
- data/README.md +67 -19
- data/SECURITY.md +1 -1
- data/app/assets/javascripts/shopify_app/redirect.js +3 -10
- data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +9 -4
- data/app/controllers/concerns/shopify_app/ensure_has_session.rb +25 -0
- data/app/controllers/concerns/shopify_app/ensure_installed.rb +84 -0
- data/app/controllers/concerns/shopify_app/shop_access_scopes_verification.rb +5 -1
- data/app/controllers/shopify_app/authenticated_controller.rb +1 -1
- data/app/controllers/shopify_app/callback_controller.rb +101 -39
- data/app/controllers/shopify_app/extension_verification_controller.rb +4 -1
- data/app/controllers/shopify_app/sessions_controller.rb +37 -7
- data/app/controllers/shopify_app/webhooks_controller.rb +1 -1
- data/app/views/shopify_app/layouts/app_bridge.html.erb +17 -0
- data/app/views/shopify_app/sessions/patch_shopify_id_token.html.erb +0 -0
- data/app/views/shopify_app/shared/redirect.html.erb +10 -1
- data/config/locales/cs.yml +0 -18
- data/config/locales/da.yml +0 -15
- data/config/locales/de.yml +0 -17
- data/config/locales/en.yml +0 -11
- data/config/locales/es.yml +0 -17
- data/config/locales/fi.yml +0 -15
- data/config/locales/fr.yml +0 -18
- data/config/locales/it.yml +0 -16
- data/config/locales/ja.yml +0 -12
- data/config/locales/ko.yml +0 -14
- data/config/locales/nb.yml +0 -16
- data/config/locales/nl.yml +0 -16
- data/config/locales/pl.yml +0 -16
- data/config/locales/pt-BR.yml +0 -16
- data/config/locales/pt-PT.yml +0 -17
- data/config/locales/sv.yml +0 -16
- data/config/locales/th.yml +0 -15
- data/config/locales/tr.yml +0 -17
- data/config/locales/vi.yml +0 -17
- data/config/locales/zh-CN.yml +0 -11
- data/config/locales/zh-TW.yml +0 -11
- data/config/routes.rb +2 -1
- data/docs/Quickstart.md +14 -5
- data/docs/Troubleshooting.md +38 -25
- data/docs/Upgrading.md +103 -32
- data/docs/shopify_app/authentication.md +179 -58
- data/docs/shopify_app/controller-concerns.md +89 -0
- data/docs/shopify_app/engine.md +2 -11
- data/docs/shopify_app/generators.md +2 -2
- data/docs/shopify_app/logging.md +21 -0
- data/docs/shopify_app/sessions.md +358 -0
- data/docs/shopify_app/testing.md +32 -10
- data/docs/shopify_app/webhooks.md +97 -7
- data/karma.conf.js +6 -4
- data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +6 -3
- data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +1 -1
- data/lib/generators/shopify_app/add_app_uninstalled_job/add_app_uninstalled_job_generator.rb +15 -0
- data/lib/generators/shopify_app/add_app_uninstalled_job/templates/app_uninstalled_job.rb.tt +22 -0
- data/lib/generators/shopify_app/add_declarative_webhook/add_declarative_webhook_generator.rb +53 -0
- data/lib/generators/shopify_app/add_declarative_webhook/templates/webhook_controller.rb.tt +13 -0
- data/lib/generators/shopify_app/add_declarative_webhook/templates/webhook_job.rb.tt +15 -0
- data/lib/generators/shopify_app/add_privacy_jobs/add_privacy_jobs_generator.rb +23 -0
- data/lib/generators/shopify_app/add_privacy_jobs/templates/customers_data_request_job.rb.tt +22 -0
- data/lib/generators/shopify_app/add_privacy_jobs/templates/customers_redact_job.rb.tt +22 -0
- data/lib/generators/shopify_app/add_privacy_jobs/templates/shop_redact_job.rb.tt +22 -0
- data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +8 -3
- data/lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt +4 -2
- data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +1 -1
- data/lib/generators/shopify_app/authenticated_controller/templates/authenticated_controller.rb +1 -1
- data/lib/generators/shopify_app/home_controller/templates/index.html.erb +1 -1
- data/lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb +1 -1
- data/lib/generators/shopify_app/install/install_generator.rb +4 -4
- data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +13 -3
- data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token.rake +1 -1
- data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token_job.rb +1 -1
- data/lib/generators/shopify_app/routes/routes_generator.rb +1 -1
- data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +1 -1
- data/lib/generators/shopify_app/shop_model/templates/db/migrate/add_shop_access_scopes_column.erb +1 -1
- data/lib/generators/shopify_app/shopify_app_generator.rb +2 -0
- data/lib/generators/shopify_app/user_model/templates/db/migrate/add_user_access_scopes_column.erb +1 -1
- data/lib/generators/shopify_app/user_model/templates/db/migrate/add_user_expires_at_column.erb +5 -0
- data/lib/generators/shopify_app/user_model/user_model_generator.rb +21 -1
- data/lib/shopify_app/access_scopes/noop_strategy.rb +4 -0
- data/lib/shopify_app/access_scopes/user_strategy.rb +9 -2
- data/lib/shopify_app/admin_api/with_token_refetch.rb +27 -0
- data/lib/shopify_app/auth/post_authenticate_tasks.rb +48 -0
- data/lib/shopify_app/auth/token_exchange.rb +73 -0
- data/lib/shopify_app/configuration.rb +82 -1
- data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +3 -3
- data/lib/shopify_app/controller_concerns/csrf_protection.rb +2 -1
- data/lib/shopify_app/controller_concerns/embedded_app.rb +42 -3
- data/lib/shopify_app/controller_concerns/ensure_billing.rb +28 -12
- data/lib/shopify_app/controller_concerns/frame_ancestors.rb +1 -1
- data/lib/shopify_app/controller_concerns/localization.rb +11 -8
- data/lib/shopify_app/controller_concerns/login_protection.rb +83 -38
- data/lib/shopify_app/controller_concerns/payload_verification.rb +1 -1
- data/lib/shopify_app/controller_concerns/redirect_for_embedded.rb +15 -3
- data/lib/shopify_app/controller_concerns/sanitized_params.rb +5 -0
- data/lib/shopify_app/controller_concerns/token_exchange.rb +111 -0
- data/lib/shopify_app/controller_concerns/webhook_verification.rb +4 -1
- data/lib/shopify_app/controller_concerns/with_shopify_id_token.rb +48 -0
- data/lib/shopify_app/engine.rb +7 -8
- data/lib/shopify_app/logger.rb +28 -0
- data/lib/shopify_app/managers/webhooks_manager.rb +20 -10
- data/lib/shopify_app/middleware/jwt_middleware.rb +13 -9
- data/lib/shopify_app/session/in_memory_user_session_store.rb +1 -1
- data/lib/shopify_app/session/jwt.rb +11 -2
- data/lib/shopify_app/session/session_repository.rb +66 -14
- data/lib/shopify_app/session/session_storage.rb +2 -2
- data/lib/shopify_app/session/shop_session_storage.rb +5 -1
- data/lib/shopify_app/session/shop_session_storage_with_scopes.rb +5 -1
- data/lib/shopify_app/session/user_session_storage.rb +6 -2
- data/lib/shopify_app/session/user_session_storage_with_scopes.rb +27 -2
- data/lib/shopify_app/test_helpers/all.rb +1 -0
- data/lib/shopify_app/test_helpers/shopify_session_helper.rb +16 -0
- data/lib/shopify_app/utils.rb +82 -20
- data/lib/shopify_app/version.rb +1 -1
- data/lib/shopify_app.rb +12 -3
- data/package.json +5 -6
- data/service.yml +0 -2
- data/shopify_app.gemspec +6 -5
- data/translation.yml +1 -0
- data/yarn.lock +2139 -3910
- metadata +78 -58
- data/.github/workflows/stale.yml +0 -31
- data/app/assets/images/storage_access.svg +0 -1
- data/app/assets/javascripts/shopify_app/app_bridge_3.1.1.js +0 -10
- data/app/assets/javascripts/shopify_app/app_bridge_redirect.js +0 -22
- data/app/assets/javascripts/shopify_app/app_bridge_utils_3.1.1.js +0 -1
- data/app/assets/javascripts/shopify_app/enable_cookies.js +0 -3
- data/app/assets/javascripts/shopify_app/itp_helper.js +0 -40
- data/app/assets/javascripts/shopify_app/partition_cookies.js +0 -8
- data/app/assets/javascripts/shopify_app/post_redirect.js +0 -9
- data/app/assets/javascripts/shopify_app/request_storage_access.js +0 -3
- data/app/assets/javascripts/shopify_app/storage_access.js +0 -148
- data/app/assets/javascripts/shopify_app/storage_access_redirect.js +0 -17
- data/app/assets/javascripts/shopify_app/top_level.js +0 -2
- data/app/assets/javascripts/shopify_app/top_level_interaction.js +0 -11
- data/app/controllers/concerns/shopify_app/authenticated.rb +0 -19
- data/app/controllers/concerns/shopify_app/require_known_shop.rb +0 -48
- data/app/views/shopify_app/sessions/enable_cookies.html.erb +0 -70
- data/app/views/shopify_app/sessions/request_storage_access.html.erb +0 -68
- data/app/views/shopify_app/sessions/top_level_interaction.html.erb +0 -63
- data/app/views/shopify_app/shared/post_redirect_to_auth_shopify.html.erb +0 -13
- data/docs/shopify_app/script-tags.md +0 -28
- data/docs/shopify_app/session-repository.md +0 -88
- data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +0 -41
- data/lib/generators/shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb +0 -62
- data/lib/shopify_app/controller_concerns/itp.rb +0 -45
- data/lib/shopify_app/jobs/scripttags_manager_job.rb +0 -16
- data/lib/shopify_app/managers/scripttags_manager.rb +0 -84
data/Gemfile.lock
CHANGED
@@ -1,135 +1,151 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
shopify_app (
|
4
|
+
shopify_app (22.5.0)
|
5
5
|
activeresource
|
6
|
-
|
6
|
+
addressable (~> 2.7)
|
7
7
|
jwt (>= 2.2.3)
|
8
8
|
rails (> 5.2.1)
|
9
9
|
redirect_safely (~> 1.0)
|
10
|
-
shopify_api (
|
10
|
+
shopify_api (>= 14.7.0, < 15.0)
|
11
11
|
sprockets-rails (>= 2.0.0)
|
12
12
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
15
15
|
specs:
|
16
|
-
actioncable (6.1.
|
17
|
-
actionpack (= 6.1.
|
18
|
-
activesupport (= 6.1.
|
16
|
+
actioncable (6.1.7.9)
|
17
|
+
actionpack (= 6.1.7.9)
|
18
|
+
activesupport (= 6.1.7.9)
|
19
19
|
nio4r (~> 2.0)
|
20
20
|
websocket-driver (>= 0.6.1)
|
21
|
-
actionmailbox (6.1.
|
22
|
-
actionpack (= 6.1.
|
23
|
-
activejob (= 6.1.
|
24
|
-
activerecord (= 6.1.
|
25
|
-
activestorage (= 6.1.
|
26
|
-
activesupport (= 6.1.
|
21
|
+
actionmailbox (6.1.7.9)
|
22
|
+
actionpack (= 6.1.7.9)
|
23
|
+
activejob (= 6.1.7.9)
|
24
|
+
activerecord (= 6.1.7.9)
|
25
|
+
activestorage (= 6.1.7.9)
|
26
|
+
activesupport (= 6.1.7.9)
|
27
27
|
mail (>= 2.7.1)
|
28
|
-
actionmailer (6.1.
|
29
|
-
actionpack (= 6.1.
|
30
|
-
actionview (= 6.1.
|
31
|
-
activejob (= 6.1.
|
32
|
-
activesupport (= 6.1.
|
28
|
+
actionmailer (6.1.7.9)
|
29
|
+
actionpack (= 6.1.7.9)
|
30
|
+
actionview (= 6.1.7.9)
|
31
|
+
activejob (= 6.1.7.9)
|
32
|
+
activesupport (= 6.1.7.9)
|
33
33
|
mail (~> 2.5, >= 2.5.4)
|
34
34
|
rails-dom-testing (~> 2.0)
|
35
|
-
actionpack (6.1.
|
36
|
-
actionview (= 6.1.
|
37
|
-
activesupport (= 6.1.
|
35
|
+
actionpack (6.1.7.9)
|
36
|
+
actionview (= 6.1.7.9)
|
37
|
+
activesupport (= 6.1.7.9)
|
38
38
|
rack (~> 2.0, >= 2.0.9)
|
39
39
|
rack-test (>= 0.6.3)
|
40
40
|
rails-dom-testing (~> 2.0)
|
41
41
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
42
|
-
actiontext (6.1.
|
43
|
-
actionpack (= 6.1.
|
44
|
-
activerecord (= 6.1.
|
45
|
-
activestorage (= 6.1.
|
46
|
-
activesupport (= 6.1.
|
42
|
+
actiontext (6.1.7.9)
|
43
|
+
actionpack (= 6.1.7.9)
|
44
|
+
activerecord (= 6.1.7.9)
|
45
|
+
activestorage (= 6.1.7.9)
|
46
|
+
activesupport (= 6.1.7.9)
|
47
47
|
nokogiri (>= 1.8.5)
|
48
|
-
actionview (6.1.
|
49
|
-
activesupport (= 6.1.
|
48
|
+
actionview (6.1.7.9)
|
49
|
+
activesupport (= 6.1.7.9)
|
50
50
|
builder (~> 3.1)
|
51
51
|
erubi (~> 1.4)
|
52
52
|
rails-dom-testing (~> 2.0)
|
53
53
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
54
|
-
activejob (6.1.
|
55
|
-
activesupport (= 6.1.
|
54
|
+
activejob (6.1.7.9)
|
55
|
+
activesupport (= 6.1.7.9)
|
56
56
|
globalid (>= 0.3.6)
|
57
|
-
activemodel (6.1.
|
58
|
-
activesupport (= 6.1.
|
57
|
+
activemodel (6.1.7.9)
|
58
|
+
activesupport (= 6.1.7.9)
|
59
59
|
activemodel-serializers-xml (1.0.2)
|
60
60
|
activemodel (> 5.x)
|
61
61
|
activesupport (> 5.x)
|
62
62
|
builder (~> 3.1)
|
63
|
-
activerecord (6.1.
|
64
|
-
activemodel (= 6.1.
|
65
|
-
activesupport (= 6.1.
|
66
|
-
activeresource (6.
|
63
|
+
activerecord (6.1.7.9)
|
64
|
+
activemodel (= 6.1.7.9)
|
65
|
+
activesupport (= 6.1.7.9)
|
66
|
+
activeresource (6.1.3)
|
67
67
|
activemodel (>= 6.0)
|
68
68
|
activemodel-serializers-xml (~> 1.0)
|
69
69
|
activesupport (>= 6.0)
|
70
|
-
activestorage (6.1.
|
71
|
-
actionpack (= 6.1.
|
72
|
-
activejob (= 6.1.
|
73
|
-
activerecord (= 6.1.
|
74
|
-
activesupport (= 6.1.
|
70
|
+
activestorage (6.1.7.9)
|
71
|
+
actionpack (= 6.1.7.9)
|
72
|
+
activejob (= 6.1.7.9)
|
73
|
+
activerecord (= 6.1.7.9)
|
74
|
+
activesupport (= 6.1.7.9)
|
75
75
|
marcel (~> 1.0)
|
76
76
|
mini_mime (>= 1.1.0)
|
77
|
-
activesupport (6.1.
|
77
|
+
activesupport (6.1.7.9)
|
78
78
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
79
79
|
i18n (>= 1.6, < 2)
|
80
80
|
minitest (>= 5.1)
|
81
81
|
tzinfo (~> 2.0)
|
82
82
|
zeitwerk (~> 2.3)
|
83
|
-
addressable (2.8.
|
84
|
-
public_suffix (>= 2.0.2, <
|
83
|
+
addressable (2.8.4)
|
84
|
+
public_suffix (>= 2.0.2, < 6.0)
|
85
85
|
ast (2.4.2)
|
86
86
|
binding_of_caller (1.0.0)
|
87
87
|
debug_inspector (>= 0.0.1)
|
88
|
-
|
89
|
-
builder (3.2.4)
|
88
|
+
builder (3.3.0)
|
90
89
|
byebug (11.1.3)
|
91
90
|
coderay (1.1.3)
|
92
|
-
concurrent-ruby (1.
|
91
|
+
concurrent-ruby (1.3.4)
|
93
92
|
crack (0.4.5)
|
94
93
|
rexml
|
95
94
|
crass (1.0.6)
|
95
|
+
date (3.3.4)
|
96
96
|
debug_inspector (1.1.0)
|
97
|
-
erubi (1.
|
98
|
-
globalid (1.
|
99
|
-
activesupport (>=
|
97
|
+
erubi (1.13.0)
|
98
|
+
globalid (1.2.1)
|
99
|
+
activesupport (>= 6.1)
|
100
100
|
hash_diff (1.1.1)
|
101
101
|
hashdiff (1.0.1)
|
102
|
-
httparty (0.
|
103
|
-
|
102
|
+
httparty (0.21.0)
|
103
|
+
mini_mime (>= 1.0.0)
|
104
104
|
multi_xml (>= 0.5.2)
|
105
|
-
i18n (1.
|
105
|
+
i18n (1.14.6)
|
106
106
|
concurrent-ruby (~> 1.0)
|
107
|
-
|
108
|
-
|
107
|
+
json (2.7.2)
|
108
|
+
jwt (2.7.0)
|
109
|
+
language_server-protocol (3.17.0.3)
|
110
|
+
loofah (2.22.0)
|
109
111
|
crass (~> 1.0.2)
|
110
|
-
nokogiri (>= 1.
|
111
|
-
mail (2.
|
112
|
+
nokogiri (>= 1.12.0)
|
113
|
+
mail (2.8.1)
|
112
114
|
mini_mime (>= 0.1.1)
|
115
|
+
net-imap
|
116
|
+
net-pop
|
117
|
+
net-smtp
|
113
118
|
marcel (1.0.2)
|
114
119
|
method_source (1.0.0)
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
mini_portile2 (2.8.0)
|
120
|
-
minitest (5.15.0)
|
121
|
-
mocha (1.13.0)
|
120
|
+
mini_mime (1.1.5)
|
121
|
+
minitest (5.18.0)
|
122
|
+
mocha (2.0.2)
|
123
|
+
ruby2_keywords (>= 0.0.5)
|
122
124
|
multi_xml (0.6.0)
|
123
|
-
|
124
|
-
|
125
|
-
|
125
|
+
net-imap (0.4.17)
|
126
|
+
date
|
127
|
+
net-protocol
|
128
|
+
net-pop (0.1.2)
|
129
|
+
net-protocol
|
130
|
+
net-protocol (0.2.2)
|
131
|
+
timeout
|
132
|
+
net-smtp (0.5.0)
|
133
|
+
net-protocol
|
134
|
+
nio4r (2.5.9)
|
135
|
+
nokogiri (1.16.7-arm64-darwin)
|
126
136
|
racc (~> 1.4)
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
137
|
+
nokogiri (1.16.7-x86_64-darwin)
|
138
|
+
racc (~> 1.4)
|
139
|
+
nokogiri (1.16.7-x86_64-linux)
|
140
|
+
racc (~> 1.4)
|
141
|
+
oj (3.14.3)
|
142
|
+
openssl (3.1.0)
|
143
|
+
parallel (1.24.0)
|
144
|
+
parser (3.3.0.5)
|
131
145
|
ast (~> 2.4.1)
|
132
|
-
|
146
|
+
racc
|
147
|
+
prettier_print (1.2.1)
|
148
|
+
pry (0.14.2)
|
133
149
|
coderay (~> 1.1)
|
134
150
|
method_source (~> 1.0)
|
135
151
|
pry-nav (1.0.0)
|
@@ -137,38 +153,40 @@ GEM
|
|
137
153
|
pry-stack_explorer (0.6.1)
|
138
154
|
binding_of_caller (~> 1.0)
|
139
155
|
pry (~> 0.13)
|
140
|
-
public_suffix (
|
141
|
-
racc (1.
|
142
|
-
rack (2.2.
|
143
|
-
rack-test (
|
144
|
-
rack (>= 1.
|
145
|
-
rails (6.1.
|
146
|
-
actioncable (= 6.1.
|
147
|
-
actionmailbox (= 6.1.
|
148
|
-
actionmailer (= 6.1.
|
149
|
-
actionpack (= 6.1.
|
150
|
-
actiontext (= 6.1.
|
151
|
-
actionview (= 6.1.
|
152
|
-
activejob (= 6.1.
|
153
|
-
activemodel (= 6.1.
|
154
|
-
activerecord (= 6.1.
|
155
|
-
activestorage (= 6.1.
|
156
|
-
activesupport (= 6.1.
|
156
|
+
public_suffix (5.0.1)
|
157
|
+
racc (1.8.1)
|
158
|
+
rack (2.2.10)
|
159
|
+
rack-test (2.1.0)
|
160
|
+
rack (>= 1.3)
|
161
|
+
rails (6.1.7.9)
|
162
|
+
actioncable (= 6.1.7.9)
|
163
|
+
actionmailbox (= 6.1.7.9)
|
164
|
+
actionmailer (= 6.1.7.9)
|
165
|
+
actionpack (= 6.1.7.9)
|
166
|
+
actiontext (= 6.1.7.9)
|
167
|
+
actionview (= 6.1.7.9)
|
168
|
+
activejob (= 6.1.7.9)
|
169
|
+
activemodel (= 6.1.7.9)
|
170
|
+
activerecord (= 6.1.7.9)
|
171
|
+
activestorage (= 6.1.7.9)
|
172
|
+
activesupport (= 6.1.7.9)
|
157
173
|
bundler (>= 1.15.0)
|
158
|
-
railties (= 6.1.
|
174
|
+
railties (= 6.1.7.9)
|
159
175
|
sprockets-rails (>= 2.0.0)
|
160
176
|
rails-controller-testing (1.0.5)
|
161
177
|
actionpack (>= 5.0.1.rc1)
|
162
178
|
actionview (>= 5.0.1.rc1)
|
163
179
|
activesupport (>= 5.0.1.rc1)
|
164
|
-
rails-dom-testing (2.0
|
165
|
-
activesupport (>=
|
180
|
+
rails-dom-testing (2.2.0)
|
181
|
+
activesupport (>= 5.0.0)
|
182
|
+
minitest
|
166
183
|
nokogiri (>= 1.6)
|
167
|
-
rails-html-sanitizer (1.
|
168
|
-
loofah (~> 2.
|
169
|
-
|
170
|
-
|
171
|
-
|
184
|
+
rails-html-sanitizer (1.6.0)
|
185
|
+
loofah (~> 2.21)
|
186
|
+
nokogiri (~> 1.14)
|
187
|
+
railties (6.1.7.9)
|
188
|
+
actionpack (= 6.1.7.9)
|
189
|
+
activesupport (= 6.1.7.9)
|
172
190
|
method_source
|
173
191
|
rake (>= 12.2)
|
174
192
|
thor (~> 1.0)
|
@@ -177,24 +195,32 @@ GEM
|
|
177
195
|
rb-readline (0.5.5)
|
178
196
|
redirect_safely (1.0.0)
|
179
197
|
activemodel
|
180
|
-
regexp_parser (2.
|
181
|
-
rexml (3.
|
182
|
-
rubocop (1.
|
198
|
+
regexp_parser (2.9.0)
|
199
|
+
rexml (3.3.9)
|
200
|
+
rubocop (1.62.1)
|
201
|
+
json (~> 2.3)
|
202
|
+
language_server-protocol (>= 3.17.0)
|
183
203
|
parallel (~> 1.10)
|
184
|
-
parser (>= 3.
|
204
|
+
parser (>= 3.3.0.2)
|
185
205
|
rainbow (>= 2.2.2, < 4.0)
|
186
206
|
regexp_parser (>= 1.8, < 3.0)
|
187
|
-
rexml
|
188
|
-
rubocop-ast (>= 1.
|
207
|
+
rexml (>= 3.2.5, < 4.0)
|
208
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
189
209
|
ruby-progressbar (~> 1.7)
|
190
|
-
unicode-display_width (>=
|
191
|
-
rubocop-ast (1.
|
192
|
-
parser (>= 3.0.
|
193
|
-
rubocop-shopify (2.
|
194
|
-
rubocop (~> 1.
|
195
|
-
ruby-
|
196
|
-
|
197
|
-
|
210
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
211
|
+
rubocop-ast (1.31.2)
|
212
|
+
parser (>= 3.3.0.4)
|
213
|
+
rubocop-shopify (2.13.0)
|
214
|
+
rubocop (~> 1.50)
|
215
|
+
ruby-lsp (0.5.1)
|
216
|
+
language_server-protocol (~> 3.17.0)
|
217
|
+
sorbet-runtime
|
218
|
+
syntax_tree (>= 6.1.1, < 7)
|
219
|
+
ruby-progressbar (1.13.0)
|
220
|
+
ruby2_keywords (0.0.5)
|
221
|
+
securerandom (0.2.2)
|
222
|
+
shopify_api (14.7.0)
|
223
|
+
activesupport
|
198
224
|
concurrent-ruby
|
199
225
|
hash_diff
|
200
226
|
httparty
|
@@ -204,30 +230,41 @@ GEM
|
|
204
230
|
securerandom
|
205
231
|
sorbet-runtime
|
206
232
|
zeitwerk (~> 2.5)
|
207
|
-
sorbet-runtime (0.5.
|
208
|
-
sprockets (4.
|
233
|
+
sorbet-runtime (0.5.10835)
|
234
|
+
sprockets (4.2.0)
|
209
235
|
concurrent-ruby (~> 1.0)
|
210
|
-
rack (
|
236
|
+
rack (>= 2.2.4, < 4)
|
211
237
|
sprockets-rails (3.4.2)
|
212
238
|
actionpack (>= 5.2)
|
213
239
|
activesupport (>= 5.2)
|
214
240
|
sprockets (>= 3.0.0)
|
215
|
-
sqlite3 (1.
|
216
|
-
|
217
|
-
|
241
|
+
sqlite3 (1.7.3-arm64-darwin)
|
242
|
+
sqlite3 (1.7.3-x86_64-darwin)
|
243
|
+
sqlite3 (1.7.3-x86_64-linux)
|
244
|
+
syntax_tree (6.1.1)
|
245
|
+
prettier_print (>= 1.2.0)
|
246
|
+
thor (1.2.2)
|
247
|
+
timeout (0.4.1)
|
248
|
+
tzinfo (2.0.6)
|
218
249
|
concurrent-ruby (~> 1.0)
|
219
|
-
unicode-display_width (2.
|
220
|
-
webmock (3.
|
250
|
+
unicode-display_width (2.5.0)
|
251
|
+
webmock (3.18.1)
|
221
252
|
addressable (>= 2.8.0)
|
222
253
|
crack (>= 0.3.2)
|
223
254
|
hashdiff (>= 0.4.0, < 2.0.0)
|
224
255
|
websocket-driver (0.7.5)
|
225
256
|
websocket-extensions (>= 0.1.0)
|
226
257
|
websocket-extensions (0.1.5)
|
227
|
-
zeitwerk (2.6.
|
258
|
+
zeitwerk (2.6.18)
|
228
259
|
|
229
260
|
PLATFORMS
|
230
|
-
|
261
|
+
arm64-darwin-21
|
262
|
+
arm64-darwin-22
|
263
|
+
arm64-darwin-23
|
264
|
+
x86_64-darwin-19
|
265
|
+
x86_64-darwin-20
|
266
|
+
x86_64-darwin-21
|
267
|
+
x86_64-linux
|
231
268
|
|
232
269
|
DEPENDENCIES
|
233
270
|
byebug
|
@@ -236,13 +273,15 @@ DEPENDENCIES
|
|
236
273
|
pry
|
237
274
|
pry-nav
|
238
275
|
pry-stack_explorer
|
276
|
+
rails (< 7)
|
239
277
|
rails-controller-testing
|
240
278
|
rake
|
241
279
|
rb-readline
|
242
280
|
rubocop-shopify
|
281
|
+
ruby-lsp
|
243
282
|
shopify_app!
|
244
283
|
sqlite3 (~> 1.4)
|
245
284
|
webmock
|
246
285
|
|
247
286
|
BUNDLED WITH
|
248
|
-
2.
|
287
|
+
2.4.10
|
data/README.md
CHANGED
@@ -7,10 +7,10 @@
|
|
7
7
|
|
8
8
|
This gem builds Rails applications that can be embedded in the Shopify Admin.
|
9
9
|
|
10
|
-
[Introduction](#introduction) |
|
11
|
-
[Requirements](#requirements) |
|
12
|
-
[Usage](#usage) |
|
13
|
-
[Documentation](#documentation) |
|
10
|
+
[Introduction](#introduction) |
|
11
|
+
[Requirements](#requirements) |
|
12
|
+
[Usage](#usage) |
|
13
|
+
[Documentation](#documentation) |
|
14
14
|
[Contributing](/CONTRIBUTING.md) |
|
15
15
|
[License](/LICENSE)
|
16
16
|
|
@@ -22,15 +22,12 @@ This gem includes a Rails engine, generators, modules, and mixins that help crea
|
|
22
22
|
<!-- This section is linked to in `templates/shopify_app.rb.tt`. Be careful renaming this heading. -->
|
23
23
|
## Requirements
|
24
24
|
|
25
|
-
> **Rails compatibility**
|
26
|
-
> * Use Shopify App `<= v7.2.8` if you need to work with Rails 4.
|
27
|
-
|
28
25
|
To become a Shopify app developer, you will need a [Shopify Partners](https://www.shopify.com/partners) account. Explore the [Shopify dev docs](https://shopify.dev/concepts/shopify-introduction) to learn more about [building Shopify apps](https://shopify.dev/concepts/apps).
|
29
26
|
|
30
27
|
This gem requires that you have the following credentials:
|
31
28
|
|
32
|
-
- **Shopify API key:** The API key app credential specified in your [Shopify Partners dashboard](https://partners.shopify.com/organizations).
|
33
|
-
- **Shopify API secret:** The API secret key app credential specified in your [Shopify Partners dashboard](https://partners.shopify.com/organizations).
|
29
|
+
- **Shopify API key:** The API key app credential specified in your [Shopify Partners dashboard](https://partners.shopify.com/organizations).
|
30
|
+
- **Shopify API secret:** The API secret key app credential specified in your [Shopify Partners dashboard](https://partners.shopify.com/organizations).
|
34
31
|
|
35
32
|
## Usage
|
36
33
|
|
@@ -40,21 +37,22 @@ This gem requires that you have the following credentials:
|
|
40
37
|
rails new my_shopify_app
|
41
38
|
```
|
42
39
|
|
43
|
-
2. Add the Shopify App gem to
|
40
|
+
2. Add the Shopify App gem to the app's Gemfile:
|
44
41
|
|
45
42
|
```sh
|
46
43
|
bundle add shopify_app
|
47
44
|
```
|
48
45
|
|
49
|
-
3.
|
46
|
+
3. You will need to provide several environment variables to the app.
|
47
|
+
There are a variety of way of doing this, but for a development environment we recommended the [`dotenv-rails`](https://github.com/bkeepers/dotenv) gem.
|
48
|
+
Create a `.env` file in the root of your Rails app to specify the full host and Shopify API credentials:
|
50
49
|
|
51
50
|
```sh
|
51
|
+
HOST=http://localhost:3000
|
52
52
|
SHOPIFY_API_KEY=<Your Shopify API key>
|
53
53
|
SHOPIFY_API_SECRET=<Your Shopify API secret>
|
54
54
|
```
|
55
55
|
|
56
|
-
> In a development environment, you can use a gem like `dotenv-rails` to manage environment variables.
|
57
|
-
|
58
56
|
4. Run the default Shopify App generator to create an app that can be embedded in the Shopify Admin:
|
59
57
|
|
60
58
|
```sh
|
@@ -67,15 +65,18 @@ rails generate shopify_app
|
|
67
65
|
rails db:migrate
|
68
66
|
```
|
69
67
|
|
70
|
-
6.
|
71
|
-
|
72
|
-
7. Run the app:
|
68
|
+
6. Run the app:
|
73
69
|
|
74
70
|
```sh
|
75
71
|
rails server
|
76
72
|
```
|
77
73
|
|
78
|
-
|
74
|
+
7. Within [Shopify Partners](https://www.shopify.com/partners), navigate to your App, then App Setup, and configure the URLs, e.g.:
|
75
|
+
|
76
|
+
* App URL: http://localhost:3000/
|
77
|
+
* Allowed redirection URL(s): http://localhost:3000/auth/shopify/callback
|
78
|
+
|
79
|
+
8. Install the app by visiting the server's URL (e.g. http://localhost:3000) and specifying the subdomain of the shop where you want it to be installed to.
|
79
80
|
|
80
81
|
9. After the app is installed, you're redirected to the embedded app.
|
81
82
|
|
@@ -103,13 +104,14 @@ You can find documentation on gem usage, concepts, mixins, installation, and mor
|
|
103
104
|
[Shopify App](/docs/shopify_app)
|
104
105
|
* [Authentication](/docs/shopify_app/authentication.md)
|
105
106
|
* [Engine](/docs/shopify_app/engine.md)
|
107
|
+
* [Controller Concerns](/docs/shopify_app/controller-concerns.md)
|
106
108
|
* [Generators](/docs/shopify_app/generators.md)
|
107
|
-
* [
|
108
|
-
* [Session repository](/docs/shopify_app/session-repository.md)
|
109
|
+
* [Sessions](/docs/shopify_app/sessions.md)
|
109
110
|
* [Handling changes in access scopes](/docs/shopify_app/handling-access-scopes-changes.md)
|
110
111
|
* [Testing](/docs/shopify_app/testing.md)
|
111
112
|
* [Webhooks](/docs/shopify_app/webhooks.md)
|
112
113
|
* [Content Security Policy](/docs/shopify_app/content-security-policy.md)
|
114
|
+
* [Logging](/docs/shopify_app/logging.md)
|
113
115
|
|
114
116
|
### Engine
|
115
117
|
|
@@ -127,6 +129,52 @@ These routes are configurable. See the more detailed [*Engine*](/docs/shopify_ap
|
|
127
129
|
|
128
130
|
To learn more about how this gem authenticates with Shopify, see [*Authentication*](/docs/shopify_app/authentication.md).
|
129
131
|
|
132
|
+
### New embedded app authorization strategy (Token Exchange)
|
133
|
+
|
134
|
+
> [!TIP]
|
135
|
+
> If you are building an embedded app, we **strongly** recommend using [Shopify managed installation](https://shopify.dev/docs/apps/auth/installation#shopify-managed-installation)
|
136
|
+
> with [token exchange](https://shopify.dev/docs/apps/auth/get-access-tokens/token-exchange) instead of the legacy authorization code grant flow.
|
137
|
+
|
138
|
+
We've introduced a new installation and authorization strategy for **embedded apps** that
|
139
|
+
eliminates the redirects that were previously necessary.
|
140
|
+
It replaces the existing [installation and authorization code grant flow](https://shopify.dev/docs/apps/auth/get-access-tokens/authorization-code-grant).
|
141
|
+
|
142
|
+
This is achieved by using [Shopify managed installation](https://shopify.dev/docs/apps/auth/installation#shopify-managed-installation)
|
143
|
+
to handle automatic app installations and scope updates, while utilizing
|
144
|
+
[token exchange](https://shopify.dev/docs/apps/auth/get-access-tokens/token-exchange) to retrieve an access token for
|
145
|
+
authenticated API access.
|
146
|
+
|
147
|
+
##### Enabling this new strategy in your app
|
148
|
+
|
149
|
+
1. Enable [Shopify managed installation](https://shopify.dev/docs/apps/auth/installation#shopify-managed-installation)
|
150
|
+
by configuring your scopes [through the Shopify CLI](https://shopify.dev/docs/apps/tools/cli/configuration).
|
151
|
+
> [!NOTE]
|
152
|
+
> Ensure you don't have `use_legacy_install_flow = true` in your `shopify.app.toml` configuration file. If `use_legacy_install_flow` is true, Shopify will not manage the installation process for your app.
|
153
|
+
> You should remove the `use_legacy_install_flow` line from your `shopify.app.toml` configuration file or set it to `false`.
|
154
|
+
|
155
|
+
2. Enable the new auth strategy in your app's ShopifyApp configuration file.
|
156
|
+
|
157
|
+
```ruby
|
158
|
+
# config/initializers/shopify_app.rb
|
159
|
+
ShopifyApp.configure do |config|
|
160
|
+
#.....
|
161
|
+
config.embedded_app = true
|
162
|
+
config.new_embedded_auth_strategy = true
|
163
|
+
|
164
|
+
# If your app is configured to use online sessions, you can enable session expiry date check so a new access token
|
165
|
+
# is fetched automatically when the session expires.
|
166
|
+
# See expiry date check docs: https://github.com/Shopify/shopify_app/blob/main/docs/shopify_app/sessions.md#expiry-date
|
167
|
+
config.check_session_expiry_date = true
|
168
|
+
...
|
169
|
+
end
|
170
|
+
|
171
|
+
```
|
172
|
+
3. Handle special callback logic. If your app has overridden the OAuth CallbackController to run special tasks post authorization,
|
173
|
+
you'll need to create and configure a custom PostAuthenticateTasks class to run these tasks after the token exchange. The original
|
174
|
+
OAuth CallbackController will not be triggered anymore. See [Post Authenticate Tasks documentation](/docs/shopify_app/authentication.md#post-authenticate-tasks) for more information.
|
175
|
+
4. Make sure your `embedded_app` layout is correct. If your app has any controller which includes `ShopifyApp::EnsureInstalled`, they will now also include the `ShopifyApp::EmbeddedApp` concern, which sets `layout 'embedded_app'` for the current controller by default. In cases where the controller originally looked for another layout file, this can cause unexpected behavior. See [`EmbeddedApp` concern's documentation](/docs/shopify_app/controller-concerns.md#embeddedapp) for more information on the effects of this concern and how to disable the layout change if needed.
|
176
|
+
5. Enjoy a smoother and faster app installation process.
|
177
|
+
|
130
178
|
### API Versioning
|
131
179
|
|
132
180
|
[Shopify's API is versioned](https://shopify.dev/concepts/about-apis/versioning). With Shopify App `v1.11.0`, the included Shopify API gem allows developers to specify and update the Shopify API version they want their app or service to use. The Shopify API gem also surfaces warnings to Rails apps about [deprecated endpoints, GraphQL fields and more](https://shopify.dev/concepts/about-apis/versioning#deprecation-practices).
|
data/SECURITY.md
CHANGED
@@ -56,4 +56,4 @@ We look forward to working with all security researchers and strive to be respec
|
|
56
56
|
|
57
57
|
## Receiving Security Updates
|
58
58
|
|
59
|
-
To
|
59
|
+
To receive all general updates to vulnerabilities, please subscribe to our hackerone [Hacktivity](https://hackerone.com/shopify/hacktivity)
|
@@ -1,6 +1,3 @@
|
|
1
|
-
//= require ./app_bridge_redirect.js
|
2
|
-
//= require ./app_bridge_utils_3.1.1.js
|
3
|
-
|
4
1
|
(function () {
|
5
2
|
function redirect() {
|
6
3
|
var redirectTargetElement = document.getElementById("redirection-target");
|
@@ -10,14 +7,10 @@
|
|
10
7
|
}
|
11
8
|
|
12
9
|
var targetInfo = JSON.parse(redirectTargetElement.dataset.target);
|
10
|
+
var normalizedLink = document.createElement('a');
|
11
|
+
normalizedLink.href = targetInfo.url;
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
if (appBridgeUtils.isShopifyEmbedded()) {
|
17
|
-
window.appBridgeRedirect(targetInfo.url);
|
18
|
-
} else {
|
19
|
-
window.top.location.href = targetInfo.url;
|
20
|
-
}
|
13
|
+
open(normalizedLink.href, '_top');
|
21
14
|
}
|
22
15
|
|
23
16
|
document.addEventListener("DOMContentLoaded", redirect);
|
@@ -14,21 +14,26 @@ module ShopifyApp
|
|
14
14
|
splash_page_with_params(
|
15
15
|
return_to: request.fullpath,
|
16
16
|
shop: current_shopify_domain,
|
17
|
-
host: params[:host]
|
17
|
+
host: params[:host],
|
18
|
+
embedded: params[:embedded],
|
18
19
|
)
|
19
20
|
end
|
20
21
|
|
21
22
|
def splash_page_with_params(params)
|
22
|
-
uri = URI(
|
23
|
+
uri = URI(base_url)
|
23
24
|
uri.query = params.compact.to_query
|
24
25
|
uri.to_s
|
25
26
|
end
|
26
27
|
|
28
|
+
def base_url
|
29
|
+
ShopifyApp.configuration.root_url.presence || root_path
|
30
|
+
end
|
31
|
+
|
27
32
|
def redirect_to_splash_page
|
28
33
|
redirect_to(splash_page)
|
29
34
|
rescue ::ShopifyApp::ShopifyDomainNotFound => error
|
30
|
-
|
31
|
-
"Could not determine current shop domain")
|
35
|
+
ShopifyApp::Logger.warn("Redirecting to login: [#{error.class}]"\
|
36
|
+
" Could not determine current shop domain")
|
32
37
|
redirect_to(ShopifyApp.configuration.login_url)
|
33
38
|
end
|
34
39
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ShopifyApp
|
4
|
+
module EnsureHasSession
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
include ShopifyApp::Localization
|
9
|
+
|
10
|
+
if ShopifyApp.configuration.use_new_embedded_auth_strategy?
|
11
|
+
include ShopifyApp::TokenExchange
|
12
|
+
around_action :activate_shopify_session
|
13
|
+
else
|
14
|
+
include ShopifyApp::LoginProtection
|
15
|
+
before_action :login_again_if_different_user_or_shop
|
16
|
+
around_action :activate_shopify_session
|
17
|
+
after_action :add_top_level_redirection_headers
|
18
|
+
end
|
19
|
+
|
20
|
+
include ShopifyApp::CsrfProtection
|
21
|
+
include ShopifyApp::EmbeddedApp
|
22
|
+
include ShopifyApp::EnsureBilling
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|