[英]How should I approach adding a react front-end to a web app built with rails?
[英]How can I add security to my Shopify App? (webhooks & front-end)
我正在開發帶導軌的Shopify應用程序, 我想避免它在安全性方面的未來問題 。 我不知道該怎么辦,所以希望您能以此為指導...
Webhooks控制器:
module ShopifyApp
class WebhooksController < ActionController::Base
include ShopifyApp::WebhookVerification
class ShopifyApp::MissingWebhookJobError < StandardError; end
def receive
params.try(:permit!)
job_args = {shop_domain: shop_domain, webhook: webhook_params.to_h}
webhook_job_klass.perform_later(job_args)
head :no_content
end
private
def webhook_params
params.except(:controller, :action, :type)
end
def webhook_job_klass
"#{webhook_type.classify}Job".safe_constantize or raise ShopifyApp::MissingWebhookJobError
end
def webhook_type
params[:type]
end
end
end
我已經閱讀過有關檢查Webhook的HMAC的信息,但是我不知道我是否必須自己實現它,或者上述代碼是否確實在執行該操作。
關於前端 ...我應該對視圖或控制器進行一些安全防護嗎?
感謝您的關注和知識。
我已經讀過有關它,並且不必編寫Webhooks的安全性。
該行包括ShopifyApp :: WebhookVerification完成所有過程。 WebhookVerification包含在gem'shopify_api'中,因此我們只需要包含gem並復制上面的代碼即可管理webhooks。
如果我們想通過Shopify管理員測試Webhook: Settings> Notifications> Webhook, 那么我們應該實現此代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.