ruby_shopify_app 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. checksums.yaml +7 -0
  2. data/.babelrc +5 -0
  3. data/.github/CODEOWNERS +2 -0
  4. data/.github/ISSUE_TEMPLATE/bug-report.md +63 -0
  5. data/.github/ISSUE_TEMPLATE/config.yml +1 -0
  6. data/.github/ISSUE_TEMPLATE/feature-request.md +33 -0
  7. data/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  8. data/.github/probots.yml +2 -0
  9. data/.github/workflows/build.yml +40 -0
  10. data/.github/workflows/release.yml +24 -0
  11. data/.github/workflows/rubocop.yml +22 -0
  12. data/.gitignore +14 -0
  13. data/.nvmrc +1 -0
  14. data/.rubocop.yml +18 -0
  15. data/.ruby-version +1 -0
  16. data/CHANGELOG-OLD.md +643 -0
  17. data/CHANGELOG.md +6 -0
  18. data/CONTRIBUTING.md +81 -0
  19. data/Gemfile +11 -0
  20. data/Gemfile.lock +280 -0
  21. data/LICENSE +19 -0
  22. data/README.md +132 -0
  23. data/Rakefile +7 -0
  24. data/SECURITY.md +59 -0
  25. data/app/assets/images/storage_access.svg +1 -0
  26. data/app/assets/javascripts/shopify_app/app_bridge_2.0.12.js +10 -0
  27. data/app/assets/javascripts/shopify_app/app_bridge_redirect.js +22 -0
  28. data/app/assets/javascripts/shopify_app/enable_cookies.js +3 -0
  29. data/app/assets/javascripts/shopify_app/itp_helper.js +40 -0
  30. data/app/assets/javascripts/shopify_app/partition_cookies.js +8 -0
  31. data/app/assets/javascripts/shopify_app/post_redirect.js +9 -0
  32. data/app/assets/javascripts/shopify_app/redirect.js +31 -0
  33. data/app/assets/javascripts/shopify_app/request_storage_access.js +3 -0
  34. data/app/assets/javascripts/shopify_app/storage_access.js +148 -0
  35. data/app/assets/javascripts/shopify_app/storage_access_redirect.js +17 -0
  36. data/app/assets/javascripts/shopify_app/top_level.js +2 -0
  37. data/app/assets/javascripts/shopify_app/top_level_interaction.js +11 -0
  38. data/app/controllers/concerns/shopify_app/authenticated.rb +16 -0
  39. data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +39 -0
  40. data/app/controllers/concerns/shopify_app/require_known_shop.rb +40 -0
  41. data/app/controllers/concerns/shopify_app/shop_access_scopes_verification.rb +32 -0
  42. data/app/controllers/shopify_app/authenticated_controller.rb +8 -0
  43. data/app/controllers/shopify_app/callback_controller.rb +195 -0
  44. data/app/controllers/shopify_app/extension_verification_controller.rb +15 -0
  45. data/app/controllers/shopify_app/sessions_controller.rb +202 -0
  46. data/app/controllers/shopify_app/webhooks_controller.rb +36 -0
  47. data/app/views/shopify_app/partials/_button_styles.html.erb +109 -0
  48. data/app/views/shopify_app/partials/_card_styles.html.erb +33 -0
  49. data/app/views/shopify_app/partials/_empty_state_styles.html.erb +98 -0
  50. data/app/views/shopify_app/partials/_form_styles.html.erb +56 -0
  51. data/app/views/shopify_app/partials/_layout_styles.html.erb +182 -0
  52. data/app/views/shopify_app/partials/_typography_styles.html.erb +35 -0
  53. data/app/views/shopify_app/sessions/enable_cookies.html.erb +70 -0
  54. data/app/views/shopify_app/sessions/new.html.erb +51 -0
  55. data/app/views/shopify_app/sessions/request_storage_access.html.erb +68 -0
  56. data/app/views/shopify_app/sessions/top_level_interaction.html.erb +63 -0
  57. data/app/views/shopify_app/shared/post_redirect_to_auth_shopify.html.erb +13 -0
  58. data/app/views/shopify_app/shared/redirect.html.erb +23 -0
  59. data/config/locales/cs.yml +23 -0
  60. data/config/locales/da.yml +20 -0
  61. data/config/locales/de.yml +22 -0
  62. data/config/locales/en.yml +15 -0
  63. data/config/locales/es.yml +22 -0
  64. data/config/locales/fi.yml +20 -0
  65. data/config/locales/fr.yml +23 -0
  66. data/config/locales/it.yml +21 -0
  67. data/config/locales/ja.yml +17 -0
  68. data/config/locales/ko.yml +19 -0
  69. data/config/locales/nb.yml +21 -0
  70. data/config/locales/nl.yml +21 -0
  71. data/config/locales/pl.yml +21 -0
  72. data/config/locales/pt-BR.yml +21 -0
  73. data/config/locales/pt-PT.yml +22 -0
  74. data/config/locales/sv.yml +21 -0
  75. data/config/locales/th.yml +20 -0
  76. data/config/locales/tr.yml +22 -0
  77. data/config/locales/vi.yml +22 -0
  78. data/config/locales/zh-CN.yml +16 -0
  79. data/config/locales/zh-TW.yml +16 -0
  80. data/config/routes.rb +23 -0
  81. data/docs/Quickstart.md +31 -0
  82. data/docs/Releasing.md +21 -0
  83. data/docs/Troubleshooting.md +159 -0
  84. data/docs/Upgrading.md +132 -0
  85. data/docs/shopify_app/authentication.md +124 -0
  86. data/docs/shopify_app/engine.md +82 -0
  87. data/docs/shopify_app/generators.md +127 -0
  88. data/docs/shopify_app/handling-access-scopes-changes.md +24 -0
  89. data/docs/shopify_app/script-tags.md +28 -0
  90. data/docs/shopify_app/session-repository.md +88 -0
  91. data/docs/shopify_app/testing.md +38 -0
  92. data/docs/shopify_app/webhooks.md +72 -0
  93. data/images/app-proxy-screenshot.png +0 -0
  94. data/karma.conf.js +44 -0
  95. data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +47 -0
  96. data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +11 -0
  97. data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +40 -0
  98. data/lib/generators/shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb +62 -0
  99. data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +69 -0
  100. data/lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt +13 -0
  101. data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +26 -0
  102. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb +8 -0
  103. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb +11 -0
  104. data/lib/generators/shopify_app/app_proxy_controller/templates/index.html.erb +19 -0
  105. data/lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator.rb +15 -0
  106. data/lib/generators/shopify_app/authenticated_controller/templates/authenticated_controller.rb +5 -0
  107. data/lib/generators/shopify_app/controllers/controllers_generator.rb +30 -0
  108. data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +53 -0
  109. data/lib/generators/shopify_app/home_controller/templates/home_controller.rb +18 -0
  110. data/lib/generators/shopify_app/home_controller/templates/index.html.erb +75 -0
  111. data/lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb +12 -0
  112. data/lib/generators/shopify_app/install/install_generator.rb +121 -0
  113. data/lib/generators/shopify_app/install/templates/_flash_messages.html.erb +3 -0
  114. data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +44 -0
  115. data/lib/generators/shopify_app/install/templates/flash_messages.js +24 -0
  116. data/lib/generators/shopify_app/install/templates/omniauth.rb +4 -0
  117. data/lib/generators/shopify_app/install/templates/session_store.rb +4 -0
  118. data/lib/generators/shopify_app/install/templates/shopify_app.js +15 -0
  119. data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +25 -0
  120. data/lib/generators/shopify_app/install/templates/shopify_app_importmap.js +13 -0
  121. data/lib/generators/shopify_app/install/templates/shopify_app_index.js +2 -0
  122. data/lib/generators/shopify_app/install/templates/shopify_provider.rb.tt +8 -0
  123. data/lib/generators/shopify_app/install/templates/user_agent.rb +6 -0
  124. data/lib/generators/shopify_app/products_controller/products_controller_generator.rb +19 -0
  125. data/lib/generators/shopify_app/products_controller/templates/products_controller.rb +8 -0
  126. data/lib/generators/shopify_app/rotate_shopify_token_job/rotate_shopify_token_job_generator.rb +16 -0
  127. data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token.rake +17 -0
  128. data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token_job.rb +42 -0
  129. data/lib/generators/shopify_app/routes/routes_generator.rb +32 -0
  130. data/lib/generators/shopify_app/routes/templates/routes.rb +12 -0
  131. data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +70 -0
  132. data/lib/generators/shopify_app/shop_model/templates/db/migrate/add_shop_access_scopes_column.erb +5 -0
  133. data/lib/generators/shopify_app/shop_model/templates/db/migrate/create_shops.erb +15 -0
  134. data/lib/generators/shopify_app/shop_model/templates/shop.rb +8 -0
  135. data/lib/generators/shopify_app/shop_model/templates/shops.yml +3 -0
  136. data/lib/generators/shopify_app/shopify_app_generator.rb +18 -0
  137. data/lib/generators/shopify_app/user_model/templates/db/migrate/add_user_access_scopes_column.erb +5 -0
  138. data/lib/generators/shopify_app/user_model/templates/db/migrate/create_users.erb +16 -0
  139. data/lib/generators/shopify_app/user_model/templates/user.rb +8 -0
  140. data/lib/generators/shopify_app/user_model/templates/users.yml +4 -0
  141. data/lib/generators/shopify_app/user_model/user_model_generator.rb +70 -0
  142. data/lib/generators/shopify_app/views/views_generator.rb +30 -0
  143. data/lib/shopify_app/access_scopes/noop_strategy.rb +13 -0
  144. data/lib/shopify_app/access_scopes/shop_strategy.rb +24 -0
  145. data/lib/shopify_app/access_scopes/user_strategy.rb +41 -0
  146. data/lib/shopify_app/configuration.rb +119 -0
  147. data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +38 -0
  148. data/lib/shopify_app/controller_concerns/csrf_protection.rb +15 -0
  149. data/lib/shopify_app/controller_concerns/embedded_app.rb +20 -0
  150. data/lib/shopify_app/controller_concerns/itp.rb +45 -0
  151. data/lib/shopify_app/controller_concerns/localization.rb +23 -0
  152. data/lib/shopify_app/controller_concerns/login_protection.rb +259 -0
  153. data/lib/shopify_app/controller_concerns/payload_verification.rb +24 -0
  154. data/lib/shopify_app/controller_concerns/webhook_verification.rb +23 -0
  155. data/lib/shopify_app/engine.rb +47 -0
  156. data/lib/shopify_app/jobs/scripttags_manager_job.rb +16 -0
  157. data/lib/shopify_app/jobs/webhooks_manager_job.rb +16 -0
  158. data/lib/shopify_app/managers/scripttags_manager.rb +78 -0
  159. data/lib/shopify_app/managers/webhooks_manager.rb +62 -0
  160. data/lib/shopify_app/middleware/jwt_middleware.rb +43 -0
  161. data/lib/shopify_app/middleware/same_site_cookie_middleware.rb +34 -0
  162. data/lib/shopify_app/omniauth/omniauth_configuration.rb +64 -0
  163. data/lib/shopify_app/session/in_memory_session_store.rb +31 -0
  164. data/lib/shopify_app/session/in_memory_shop_session_store.rb +16 -0
  165. data/lib/shopify_app/session/in_memory_user_session_store.rb +16 -0
  166. data/lib/shopify_app/session/jwt.rb +67 -0
  167. data/lib/shopify_app/session/null_user_session_store.rb +22 -0
  168. data/lib/shopify_app/session/session_repository.rb +56 -0
  169. data/lib/shopify_app/session/session_storage.rb +20 -0
  170. data/lib/shopify_app/session/shop_session_storage.rb +42 -0
  171. data/lib/shopify_app/session/shop_session_storage_with_scopes.rb +58 -0
  172. data/lib/shopify_app/session/user_session_storage.rb +42 -0
  173. data/lib/shopify_app/session/user_session_storage_with_scopes.rb +58 -0
  174. data/lib/shopify_app/test_helpers/all.rb +2 -0
  175. data/lib/shopify_app/test_helpers/webhook_verification_helper.rb +17 -0
  176. data/lib/shopify_app/utils.rb +37 -0
  177. data/lib/shopify_app/version.rb +4 -0
  178. data/lib/shopify_app.rb +80 -0
  179. data/package.json +27 -0
  180. data/service.yml +4 -0
  181. data/shipit.rubygems.yml +4 -0
  182. data/shopify_app.gemspec +39 -0
  183. data/translation.yml +7 -0
  184. data/webpack.config.js +24 -0
  185. data/yarn.lock +5230 -0
  186. metadata +465 -0
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,81 @@
1
+ # Contributing to the Shopify App gem
2
+
3
+ The following is a set of guidelines for contributing to the Shopify App gem. These are mostly guidelines, not rules. Use your best judgement, and feel free to propose changes to this document in a pull request.
4
+
5
+ #### Table of contents
6
+
7
+ [I just have a question!](#i-just-have-a-question)
8
+
9
+ [How can I contribute?](#how-can-i-contribute)
10
+ * [Reporting bugs](#reporting-bugs)
11
+ * [Suggesting or requesting improvements](#suggesting-or-requesting-improvements)
12
+ * [Pull requests](#pull-requests)
13
+
14
+ ## I just have a question!
15
+
16
+ > **Note:** Please don't file an issue to ask a question. You'll get faster results by using the resources below.
17
+
18
+ Shopify has an official message board with dedicated forums to discuss all things apps, APIs, SDKs and more.
19
+
20
+ #### Shopify Community forum links
21
+
22
+ * [Shopify Community](https://community.shopify.com)
23
+ * [Shopify Apps](https://community.shopify.com/c/Shopify-Apps/bd-p/shopify-apps)
24
+ * [Shopify APIs & SDKs](https://community.shopify.com/c/Shopify-APIs-SDKs/bd-p/shopify-apis-and-technology)
25
+
26
+ If you prefer to chat instead, join the [Shopify Partners Slack Community group](https://www.shopify.com/partners/community#conversation). This Slack group hosts an active community of thousands of app developers.
27
+
28
+ By participating in the Community forum or Slack group, you agree to adhere to the forum [Code of Conduct](https://community.shopify.com/c/Announcements/Code-of-Conduct/m-p/491969#M23) outlined.
29
+
30
+ ## How can I contribute?
31
+
32
+ ### Reporting bugs
33
+
34
+ This section guides you through submitting a bug report for the Shopify App gem. Following these guidelines helps maintainers and the community understand your report, reproduce the behavior, and find related reports.
35
+
36
+ #### Before submitting a bug report
37
+
38
+ * **Check the [troubleshooting guide](/docs/Troubleshooting.md).** You may be able to troubleshoot the issue you're facing.
39
+ * **Check the [Shopify Community links](#shopify-community-forum-links) to search for your issue.** This problem may have been reported before and solved on the Shopify forum.
40
+ * **Perform a cursory search for similar issues.** You may find that the same problem (or a similar one) has been filed already as an issue.
41
+
42
+ #### How do I submit a good bug report?
43
+
44
+ Bugs are tracked as GitHub issues. Create an issue and provide the following information by filling in the [bug-report template](/.github/ISSUE_TEMPLATE/bug-report.md).
45
+
46
+ Explain the problem and include additional details to help maintainers reproduce the problem:
47
+
48
+ * **Use a clear and descriptive title** for the issue to identify the problem.
49
+ * **Describe the exact steps which reproduce the problem** in as many details as possible.
50
+ * **Provide specific examples to demonstrate the steps.** Include links to files, or copy/pasteable snippets. If you're providing snippets in the issue, use Markdown code blocks.
51
+ * **Describe the behavior you observed** after following the steps and point out what exactly is the problem with that behavior.
52
+ * **Explain which behavior you expected to see** instead and why.
53
+ * **Include screenshots and animated GIFs** where possible.
54
+ * **Redact any private information** from your logs and issue description. This includes things like API keys, API secrets, and any access tokens.
55
+
56
+ ### Suggesting or requesting improvements
57
+
58
+ If you have a suggestion for the Shopify App gem or a feature request, provide the appropriate information by filling out the [feature-request template](/.github/ISSUE_TEMPLATE/feature-request.md).
59
+
60
+ ### Pull requests
61
+
62
+ The process described here has several goals:
63
+
64
+ * Maintain the Shopify App gem's quality
65
+ * Fix problems that are important to app developers
66
+ * Enable a sustainable system for the Shopify App gem's maintainers to review contributions
67
+
68
+ Please follow these steps to have your contribution considered by the maintainers:
69
+
70
+ * Follow all instructions in the [pull request template](/.github/PULL_REQUEST_TEMPLATE.md)
71
+ * After you submit your pull request, verify that all status checks are passing
72
+ * <details>
73
+ <summary>What if the status checks are failing?</summary>
74
+
75
+ While the prerequisites above must be satisfied prior to having your pull request reviewed, the reviewer(s) may ask you to complete additional design work, tests, or other changes before your pull request can be ultimately accepted.
76
+ </details>
77
+
78
+ ### App Bridge client
79
+
80
+ This gem ships with a UMD version of the App Bridge client. It lives inside the assets folder: `app/assets/javascripts/shopify_app/`. To update the client, simply download the UMD build from [unpkg.com](https://unpkg.com/@shopify/app-bridge) and save it into the folder.
81
+ Please follow the convention of including the client version number in the filename. Finally, change the reference to the new App Bridge client inside `app/assets/javascripts/shopify_app/app_bridge_redirect.js`.
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+ source "https://rubygems.org"
3
+
4
+ # Specify your gem's dependencies in shopify_app.gemspec
5
+ gemspec
6
+
7
+ gem 'rails-controller-testing', group: :test
8
+
9
+ group :rubocop do
10
+ gem 'rubocop-shopify', require: false
11
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,280 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ruby_shopify_app (1.0.0)
5
+ browser_sniffer (~> 1.4.0)
6
+ jwt (>= 2.2.3)
7
+ omniauth-rails_csrf_protection
8
+ omniauth-shopify-oauth2 (~> 2.3)
9
+ rails (> 5.2.1)
10
+ redirect_safely (~> 1.0)
11
+ ruby_shopify_api (~> 1.0)
12
+
13
+ GEM
14
+ remote: https://rubygems.org/
15
+ specs:
16
+ actioncable (6.1.4.4)
17
+ actionpack (= 6.1.4.4)
18
+ activesupport (= 6.1.4.4)
19
+ nio4r (~> 2.0)
20
+ websocket-driver (>= 0.6.1)
21
+ actionmailbox (6.1.4.4)
22
+ actionpack (= 6.1.4.4)
23
+ activejob (= 6.1.4.4)
24
+ activerecord (= 6.1.4.4)
25
+ activestorage (= 6.1.4.4)
26
+ activesupport (= 6.1.4.4)
27
+ mail (>= 2.7.1)
28
+ actionmailer (6.1.4.4)
29
+ actionpack (= 6.1.4.4)
30
+ actionview (= 6.1.4.4)
31
+ activejob (= 6.1.4.4)
32
+ activesupport (= 6.1.4.4)
33
+ mail (~> 2.5, >= 2.5.4)
34
+ rails-dom-testing (~> 2.0)
35
+ actionpack (6.1.4.4)
36
+ actionview (= 6.1.4.4)
37
+ activesupport (= 6.1.4.4)
38
+ rack (~> 2.0, >= 2.0.9)
39
+ rack-test (>= 0.6.3)
40
+ rails-dom-testing (~> 2.0)
41
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
+ actiontext (6.1.4.4)
43
+ actionpack (= 6.1.4.4)
44
+ activerecord (= 6.1.4.4)
45
+ activestorage (= 6.1.4.4)
46
+ activesupport (= 6.1.4.4)
47
+ nokogiri (>= 1.8.5)
48
+ actionview (6.1.4.4)
49
+ activesupport (= 6.1.4.4)
50
+ builder (~> 3.1)
51
+ erubi (~> 1.4)
52
+ rails-dom-testing (~> 2.0)
53
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
54
+ activejob (6.1.4.4)
55
+ activesupport (= 6.1.4.4)
56
+ globalid (>= 0.3.6)
57
+ activemodel (6.1.4.4)
58
+ activesupport (= 6.1.4.4)
59
+ activemodel-serializers-xml (1.0.2)
60
+ activemodel (> 5.x)
61
+ activesupport (> 5.x)
62
+ builder (~> 3.1)
63
+ activerecord (6.1.4.4)
64
+ activemodel (= 6.1.4.4)
65
+ activesupport (= 6.1.4.4)
66
+ activeresource (6.0.0)
67
+ activemodel (>= 6.0)
68
+ activemodel-serializers-xml (~> 1.0)
69
+ activesupport (>= 6.0)
70
+ activestorage (6.1.4.4)
71
+ actionpack (= 6.1.4.4)
72
+ activejob (= 6.1.4.4)
73
+ activerecord (= 6.1.4.4)
74
+ activesupport (= 6.1.4.4)
75
+ marcel (~> 1.0.0)
76
+ mini_mime (>= 1.1.0)
77
+ activesupport (6.1.4.4)
78
+ concurrent-ruby (~> 1.0, >= 1.0.2)
79
+ i18n (>= 1.6, < 2)
80
+ minitest (>= 5.1)
81
+ tzinfo (~> 2.0)
82
+ zeitwerk (~> 2.3)
83
+ addressable (2.8.0)
84
+ public_suffix (>= 2.0.2, < 5.0)
85
+ ast (2.4.1)
86
+ binding_of_caller (0.8.0)
87
+ debug_inspector (>= 0.0.1)
88
+ browser_sniffer (1.4.0)
89
+ builder (3.2.4)
90
+ byebug (11.1.3)
91
+ coderay (1.1.3)
92
+ concurrent-ruby (1.1.9)
93
+ crack (0.4.4)
94
+ crass (1.0.6)
95
+ date (3.3.3)
96
+ debug_inspector (0.0.3)
97
+ erubi (1.10.0)
98
+ faraday (2.7.4)
99
+ faraday-net_http (>= 2.0, < 3.1)
100
+ ruby2_keywords (>= 0.0.4)
101
+ faraday-net_http (3.0.2)
102
+ globalid (1.1.0)
103
+ activesupport (>= 5.0)
104
+ graphql (2.0.18)
105
+ graphql-client (0.18.0)
106
+ activesupport (>= 3.0)
107
+ graphql
108
+ hashdiff (1.0.1)
109
+ hashie (5.0.0)
110
+ i18n (1.9.1)
111
+ concurrent-ruby (~> 1.0)
112
+ jwt (2.7.0)
113
+ loofah (2.13.0)
114
+ crass (~> 1.0.2)
115
+ nokogiri (>= 1.5.9)
116
+ mail (2.8.1)
117
+ mini_mime (>= 0.1.1)
118
+ net-imap
119
+ net-pop
120
+ net-smtp
121
+ marcel (1.0.2)
122
+ method_source (0.9.2)
123
+ mini_mime (1.1.2)
124
+ mini_portile2 (2.6.1)
125
+ minitest (5.14.4)
126
+ mocha (1.11.2)
127
+ multi_xml (0.6.0)
128
+ net-imap (0.3.4)
129
+ date
130
+ net-protocol
131
+ net-pop (0.1.2)
132
+ net-protocol
133
+ net-protocol (0.2.1)
134
+ timeout
135
+ net-smtp (0.3.3)
136
+ net-protocol
137
+ nio4r (2.5.8)
138
+ nokogiri (1.12.5)
139
+ mini_portile2 (~> 2.6.1)
140
+ racc (~> 1.4)
141
+ oauth2 (2.0.9)
142
+ faraday (>= 0.17.3, < 3.0)
143
+ jwt (>= 1.0, < 3.0)
144
+ multi_xml (~> 0.5)
145
+ rack (>= 1.2, < 4)
146
+ snaky_hash (~> 2.0)
147
+ version_gem (~> 1.1)
148
+ omniauth (2.1.1)
149
+ hashie (>= 3.4.6)
150
+ rack (>= 2.2.3)
151
+ rack-protection
152
+ omniauth-oauth2 (1.8.0)
153
+ oauth2 (>= 1.4, < 3)
154
+ omniauth (~> 2.0)
155
+ omniauth-rails_csrf_protection (1.0.1)
156
+ actionpack (>= 4.2)
157
+ omniauth (~> 2.0)
158
+ omniauth-shopify-oauth2 (2.3.2)
159
+ activesupport
160
+ omniauth-oauth2 (~> 1.5)
161
+ parallel (1.20.1)
162
+ parser (2.7.2.0)
163
+ ast (~> 2.4.1)
164
+ pry (0.12.2)
165
+ coderay (~> 1.1.0)
166
+ method_source (~> 0.9.0)
167
+ pry-nav (0.3.0)
168
+ pry (>= 0.9.10, < 0.13.0)
169
+ pry-stack_explorer (0.4.9.3)
170
+ binding_of_caller (>= 0.7)
171
+ pry (>= 0.9.11)
172
+ public_suffix (4.0.6)
173
+ racc (1.6.0)
174
+ rack (2.2.3)
175
+ rack-protection (3.0.5)
176
+ rack
177
+ rack-test (1.1.0)
178
+ rack (>= 1.0, < 3)
179
+ rails (6.1.4.4)
180
+ actioncable (= 6.1.4.4)
181
+ actionmailbox (= 6.1.4.4)
182
+ actionmailer (= 6.1.4.4)
183
+ actionpack (= 6.1.4.4)
184
+ actiontext (= 6.1.4.4)
185
+ actionview (= 6.1.4.4)
186
+ activejob (= 6.1.4.4)
187
+ activemodel (= 6.1.4.4)
188
+ activerecord (= 6.1.4.4)
189
+ activestorage (= 6.1.4.4)
190
+ activesupport (= 6.1.4.4)
191
+ bundler (>= 1.15.0)
192
+ railties (= 6.1.4.4)
193
+ sprockets-rails (>= 2.0.0)
194
+ rails-controller-testing (1.0.5)
195
+ actionpack (>= 5.0.1.rc1)
196
+ actionview (>= 5.0.1.rc1)
197
+ activesupport (>= 5.0.1.rc1)
198
+ rails-dom-testing (2.0.3)
199
+ activesupport (>= 4.2.0)
200
+ nokogiri (>= 1.6)
201
+ rails-html-sanitizer (1.4.2)
202
+ loofah (~> 2.3)
203
+ railties (6.1.4.4)
204
+ actionpack (= 6.1.4.4)
205
+ activesupport (= 6.1.4.4)
206
+ method_source
207
+ rake (>= 0.13)
208
+ thor (~> 1.0)
209
+ rainbow (3.0.0)
210
+ rake (13.0.3)
211
+ rb-readline (0.5.5)
212
+ redirect_safely (1.0.0)
213
+ activemodel
214
+ regexp_parser (2.0.0)
215
+ rexml (3.2.5)
216
+ rubocop (1.5.2)
217
+ parallel (~> 1.10)
218
+ parser (>= 2.7.1.5)
219
+ rainbow (>= 2.2.2, < 4.0)
220
+ regexp_parser (>= 1.8, < 3.0)
221
+ rexml
222
+ rubocop-ast (>= 1.2.0, < 2.0)
223
+ ruby-progressbar (~> 1.7)
224
+ unicode-display_width (>= 1.4.0, < 2.0)
225
+ rubocop-ast (1.3.0)
226
+ parser (>= 2.7.1.5)
227
+ rubocop-shopify (1.0.7)
228
+ rubocop (~> 1.4)
229
+ ruby-progressbar (1.10.1)
230
+ ruby2_keywords (0.0.5)
231
+ ruby_shopify_api (1.0.0)
232
+ activeresource (>= 4.1.0)
233
+ graphql-client
234
+ rack
235
+ snaky_hash (2.0.1)
236
+ hashie
237
+ version_gem (~> 1.1, >= 1.1.1)
238
+ sprockets (4.1.1)
239
+ concurrent-ruby (~> 1.0)
240
+ rack (> 1, < 3)
241
+ sprockets-rails (3.4.2)
242
+ actionpack (>= 5.2)
243
+ activesupport (>= 5.2)
244
+ sprockets (>= 3.0.0)
245
+ sqlite3 (1.4.2)
246
+ thor (1.2.1)
247
+ timeout (0.3.2)
248
+ tzinfo (2.0.4)
249
+ concurrent-ruby (~> 1.0)
250
+ unicode-display_width (1.7.0)
251
+ version_gem (1.1.1)
252
+ webmock (3.9.1)
253
+ addressable (>= 2.3.6)
254
+ crack (>= 0.3.2)
255
+ hashdiff (>= 0.4.0, < 2.0.0)
256
+ websocket-driver (0.7.5)
257
+ websocket-extensions (>= 0.1.0)
258
+ websocket-extensions (0.1.5)
259
+ zeitwerk (2.5.4)
260
+
261
+ PLATFORMS
262
+ ruby
263
+
264
+ DEPENDENCIES
265
+ byebug
266
+ minitest
267
+ mocha
268
+ pry
269
+ pry-nav
270
+ pry-stack_explorer
271
+ rails-controller-testing
272
+ rake
273
+ rb-readline
274
+ rubocop-shopify
275
+ ruby_shopify_app!
276
+ sqlite3 (~> 1.4)
277
+ webmock
278
+
279
+ BUNDLED WITH
280
+ 2.3.5
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2013 Shopify
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,132 @@
1
+ # Shopify App
2
+
3
+ **Shopify is doubling our engineering staff in 2021! [Join our team and work on libraries like this one.](https://smrtr.io/5GGrK)**
4
+
5
+ [![Version][gem]][gem_url] [![Build Status](https://github.com/Shopify/shopify_app/workflows/CI/badge.svg)](https://github.com/Shopify/shopify_app/actions?query=workflow%3ACI) ![Supported Rails version][supported_rails_version]
6
+
7
+ [gem]: https://img.shields.io/gem/v/shopify_app.svg
8
+ [gem_url]: https://rubygems.org/gems/shopify_app
9
+ [supported_rails_version]: https://img.shields.io/badge/rails-%3C6.2.0-orange
10
+
11
+ This gem builds Rails applications that can be embedded in the Shopify Admin.
12
+
13
+ [Introduction](#introduction) |
14
+ [Requirements](#requirements) |
15
+ [Usage](#usage) |
16
+ [Documentation](#documentation) |
17
+ [Contributing](/CONTRIBUTING.md) |
18
+ [License](/LICENSE)
19
+
20
+
21
+ ## Introduction
22
+
23
+ This gem includes a Rails engine, generators, modules, and mixins that help create Rails applications that work with Shopify APIs. The [Shopify App Rails engine](/docs/shopify_app/engine.md) provides all the code required to implement OAuth with Shopify. The [default Shopify App generator](/docs/shopify_app/generators.md#-environment-rails-generate-shopify_app) builds an app that can be embedded in the Shopify Admin and secures it with [session tokens](https://shopify.dev/concepts/apps/building-embedded-apps-using-session-tokens).
24
+
25
+ <!-- This section is linked to in `templates/shopify_app.rb.tt`. Be careful renaming this heading. -->
26
+ ## Requirements
27
+
28
+ > **Rails compatibility**
29
+ > * Use Shopify App `<= v7.2.8` if you need to work with Rails 4.
30
+
31
+ 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).
32
+
33
+ This gem requires that you have the following credentials:
34
+
35
+ - **Shopify API key:** The API key app credential specified in your [Shopify Partners dashboard](https://partners.shopify.com/organizations).
36
+ - **Shopify API secret:** The API secret key app credential specified in your [Shopify Partners dashboard](https://partners.shopify.com/organizations).
37
+
38
+ ## Usage
39
+
40
+ 1. To get started, create a new Rails app:
41
+
42
+ ``` sh
43
+ $ rails new my_shopify_app
44
+ ```
45
+
46
+ 2. Add the Shopify App gem to `my_shopify_app`'s Gemfile.
47
+
48
+ ```sh
49
+ $ bundle add shopify_app
50
+ ```
51
+
52
+ 3. Create a `.env` file in the root of `my_shopify_app` to specify your Shopify API credentials:
53
+
54
+ ```
55
+ SHOPIFY_API_KEY=<Your Shopify API key>
56
+ SHOPIFY_API_SECRET=<Your Shopify API secret>
57
+ ```
58
+
59
+ > In a development environment, you can use a gem like `dotenv-rails` to manage environment variables.
60
+
61
+ 4. Run the default Shopify App generator to create an app that can be embedded in the Shopify Admin:
62
+
63
+ ```sh
64
+ $ rails generate shopify_app
65
+ ```
66
+
67
+ 5. Run a migration to create the necessary tables in your database:
68
+
69
+ ```sh
70
+ $ rails db:migrate
71
+ ```
72
+
73
+ 6. Run the app:
74
+
75
+ ```sh
76
+ $ rails server
77
+ ```
78
+
79
+ See [*Quickstart*](/docs/Quickstart.md) to learn how to install your app on a shop.
80
+
81
+ This app implements [OAuth 2.0](https://shopify.dev/tutorials/authenticate-with-oauth) with Shopify to authenticate requests made to Shopify APIs. By default, this app is configured to use [session tokens](https://shopify.dev/concepts/apps/building-embedded-apps-using-session-tokens) to authenticate merchants when embedded in the Shopify Admin.
82
+
83
+ See [*Generators*](/docs/shopify_app/generators.md) for a complete list of generators available to Shopify App.
84
+
85
+ ## Documentation
86
+
87
+ You can find documentation on gem usage, concepts, mixins, installation, and more in [`/docs`](/docs).
88
+
89
+ * Start with the [*Generators*](/docs/shopify_app/generators.md) document to learn more about the generators this gem offers.
90
+ * Check out the [*Changelog*](/CHANGELOG.md) for notes on the latest gem releases.
91
+ * See [*Troubleshooting*](/docs/Troubleshooting.md) for tips on common issues.
92
+ * If you are looking to upgrade your Shopify App version to a new major release, see [*Upgrading*](/docs/Upgrading.md) for important notes on breaking changes.
93
+
94
+ ### Overview
95
+
96
+ [Quickstart](/docs/Quickstart.md)
97
+
98
+ [Troubleshooting](/docs/Troubleshooting.md)
99
+
100
+ [Upgrading](/docs/Upgrading.md)
101
+
102
+ [Shopify App](/docs/shopify_app)
103
+ * [Authentication](/docs/shopify_app/authentication.md)
104
+ * [Engine](/docs/shopify_app/engine.md)
105
+ * [Generators](/docs/shopify_app/generators.md)
106
+ * [ScriptTags](/docs/shopify_app/script-tags.md)
107
+ * [Session repository](/docs/shopify_app/session-repository.md)
108
+ * [Handling changes in access scopes](/docs/shopify_app/handling-access-scopes-changes.md)
109
+ * [Testing](/docs/shopify_app/testing.md)
110
+ * [Webhooks](/docs/shopify_app/webhooks.md)
111
+
112
+ ### Engine
113
+
114
+ Mounting the Shopify App Rails Engine provides the following routes. These routes are configured to help install your application on shops and implement OAuth.
115
+
116
+ | Verb | Route | Action |
117
+ | ---: | :--- | :--- |
118
+ | `GET` | `/login` | Login |
119
+ | `POST` | `/login` | Login |
120
+ | `GET` | `/auth/shopify/callback` | OAuth redirect URI |
121
+ | `GET` | `/logout` | Logout |
122
+ | `POST` | `/webhooks/:type` | Webhook callback |
123
+
124
+ These routes are configurable. See the more detailed [*Engine*](/docs/shopify_app/engine.md) documentation to learn how you can customize the login URL or mount the Shopify App Rails engine at nested routes.
125
+
126
+ To learn more about how this gem authenticates with Shopify, see [*Authentication*](/docs/shopify_app/authentication.md).
127
+
128
+ ### API Versioning
129
+
130
+ [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).
131
+
132
+ See the [Shopify API gem README](https://github.com/Shopify/shopify_api/) for more information.
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ require 'bundler/gem_tasks'
3
+ require 'rake/testtask'
4
+
5
+ require File.expand_path('../test/dummy/config/application', __FILE__)
6
+
7
+ Rails.application.load_tasks
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)
@@ -0,0 +1 @@
1
+ <svg width="140" height="140" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M79 55a9 9 0 00-18 0v8h18v-8zm6 8v-8a15 15 0 00-30 0v8h-5a2 2 0 00-2 2v20a15 15 0 0015 15h14a15 15 0 0015-15V65a2 2 0 00-2-2h-5zM70 90a3 3 0 01-3-3V75a3 3 0 116 0v12a3 3 0 01-3 3z" fill="#8C9196"/></svg>