-
Notifications
You must be signed in to change notification settings - Fork 699
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid preloading ActionController::Base (#855)
* moved extension verification controller from engine to app * nest in module * add changelog * remove loading controller from engine * minor version change, not a patch
- Loading branch information
Showing
8 changed files
with
28 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
app/controllers/shopify_app/extension_verification_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
module ShopifyApp | ||
class ExtensionVerificationController < ActionController::Base | ||
protect_from_forgery with: :null_session | ||
before_action :verify_request | ||
|
||
private | ||
|
||
def verify_request | ||
hmac_header = request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'] | ||
request_body = request.body.read | ||
secret = ShopifyApp.configuration.secret | ||
digest = OpenSSL::Digest.new('sha256') | ||
|
||
expected_hmac = Base64.strict_encode64(OpenSSL::HMAC.digest(digest, secret, request_body)) | ||
head(:unauthorized) unless ActiveSupport::SecurityUtils.secure_compare(expected_hmac, hmac_header) | ||
end | ||
end | ||
end |
2 changes: 1 addition & 1 deletion
2
...shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
lib/shopify_app/controllers/extension_verification_controller.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module ShopifyApp | ||
VERSION = '11.6.0'.freeze | ||
VERSION = '11.7.0'.freeze | ||
end |
2 changes: 1 addition & 1 deletion
2
...extension_verification_controller_test.rb → ...extension_verification_controller_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters