简体   繁体   English

我需要担心 Stripe“payment_intent_client_secret”的泄露吗?

[英]Do I need to worry about Stripe "payment_intent_client_secret"s leaking?

I've been testing a Stipe implementation against their test cards .我一直在针对他们的测试卡测试一个 Stipe 实现。 All of them perform as expected, but the first 3 3DS Required cards (as opposed to 3DS2) throw a bunch of errors in the browser console:它们都按预期执行,但前 3 个 3DS 必需卡(与 3DS2 相对)在浏览器控制台中引发了一堆错误:

[Error] The Content Security Policy directive 'frame-ancestors' is ignored when delivered in a report-only policy.
[Error] [Report Only] Refused to apply a stylesheet because its hash, its nonce, or 'unsafe-inline' does not appear in the style-src directive of the Content Security Policy. (test_source_3ds, line 96)
[Error] [Report Only] Refused to apply a stylesheet because its hash, its nonce, or 'unsafe-inline' does not appear in the style-src directive of the Content Security Policy. (test_source_3ds, line 98)
[Error] [Report Only] Refused to apply a stylesheet because its hash, its nonce, or 'unsafe-inline' does not appear in the style-src directive of the Content Security Policy. (test_source_3ds, line 145)
[Error] [Report Only] Refused to load https://fast.fonts.net/t/1.css?apiType=css&projectid=4414faae-0f1e-48be-9319-851fc710f613 because it does not appear in the style-src directive of the Content Security Policy. (x2)
[Error] [Report Only] Refused to apply a stylesheet because its hash, its nonce, or 'unsafe-inline' does not appear in the style-src directive of the Content Security Policy. (test_source_3ds, line 286, x5)
[Error] Failed to load resource: the server responded with a status of 404 () (index-123dfdc61622c51a9de7.min.css.map, line 0)
[Error] Failed to load resource: the server responded with a status of 404 () (index-1c379baa22db1e91b0f5.min.css.map, line 0)
[Error] [Report Only] Refused to load https://hooks.stripe.com/three_d_secure/redirect_complete/acct_1Ks5eEJk0JZEEkV1/tdsrc_1LJNBMJk0JZEEkV1t6uTeC4Y because it does not appear in the form-action directive of the Content Security Policy. (x2)

I assume those "Report Only" items are inconsequential (though I don't know why they get thrown as errors instead of warnings), but then, after the transaction completes (or fails), it throws some errors that include "payment_intent_client_secret" and "payment_intent":我假设那些“仅报告”项目是无关紧要的(尽管我不知道为什么它们会作为错误而不是警告被抛出),但是在交易完成(或失败)之后,它会引发一些错误,包括“payment_intent_client_secret”和“付款意向”:

[Error] Refused to load http://localhost:3000/?payment_intent=pi_3LJNBCJk0JZEEkV11lhu6GfN&payment_intent_client_secret=pi_3LJNBCJk0JZEEkV11lhu6GfN_secret_KA1mmJKPHNqgHvc2Tb62LgnI1&source_redirect_slug=test_YWNjdF8xS3M1ZUVKazBKWkVFa1YxLF9NMVExQTFhWXo2RDgxYnpDTHlidW1DbVZ4eVVNOTdv0100Efqqsukb&source_type=card#register because it does not appear in the frame-src directive of the Content Security Policy.
[Error] [Report Only] Refused to load http://localhost:3000/?payment_intent=pi_3LJNBCJk0JZEEkV11lhu6GfN&payment_intent_client_secret=pi_3LJNBCJk0JZEEkV11lhu6GfN_secret_KA1mmJKPHNqgHvc2Tb62LgnI1&source_redirect_slug=test_YWNjdF8xS3M1ZUVKazBKWkVFa1YxLF9NMVExQTFhWXo2RDgxYnpDTHlidW1DbVZ4eVVNOTdv0100Efqqsukb&source_type=card#register because it does not appear in the frame-src directive of the Content Security Policy.

Of course, this may only be happening because I'm developing on localhost, though it is curious that it doesn't happen for the other 3DS cards.当然,这可能只是因为我在 localhost 上开发而发生的,尽管奇怪的是其他 3DS 卡不会发生这种情况。

The console errors notwithstanding, everything works as expected from a user perspective.尽管控制台出现错误,但从用户的角度来看,一切都按预期工作。 The question is, is this something I need to worry about in production, or can I just ignore it.问题是,这是我在生产中需要担心的事情,还是我可以忽略它。 In particular, the fact that those last errors are revealing "secrets" seems worrisome.特别是,这些最后的错误揭示了“秘密”这一事实似乎令人担忧。

The test cards which cause this are:导致这种情况的测试卡是:

  • 4000000000003063 4000000000003063
  • 4000008400001629 4000008400001629
  • 4000008400001280 4000008400001280

All other cards, including 3DS2 cards, seem fine, so it may just be something with their test implementation on the back end.所有其他卡,包括 3DS2 卡,看起来都很好,所以这可能只是他们在后端的测试实现。

As you rightly identified, most of these errors are due to loading the outdated 3DSv1 content into the modal presented to the user.正如您正确指出的那样,这些错误中的大多数是由于将过时的 3DSv1 内容加载到呈现给用户的模式中。 As you noticed the 3DS2 implementation does not experience these errors.正如您所注意到的,3DS2 实现不会遇到这些错误。

Those URLs with the http://localhost:3000/ and the parameters look to be how you are configuring the redirect URL, since Stripe supports passing variables like client_secret .那些带有http://localhost:3000/和参数的 URL 看起来是您配置重定向 URL 的方式,因为 Stripe 支持传递诸如client_secret之类的变量。 However this is bad practice as the docs call out here (look for the amber alert box at the bottom).然而,这是一个不好的做法,因为文档在这里调用(查找底部的琥珀色警报框)。

I would suggest you review the success and/or redirect URLs you are providing both for the Payment Intent and the rendering of the Payment Element to ensure you aren't inadvertently embedding the client_secret directly.我建议您查看您为支付意图和支付元素的呈现提供的success和/或redirect URL,以确保您不会无意中直接嵌入client_secret

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在给定方案中,我是否需要担心UPDATE操作中同时请求的影响 - Do i need to worry about effect of simultaneous request in the UPDATE operation in the given scenario 我的 web 应用程序不是公开托管的,我需要担心 CSRF 吗? - My web application is not publicly hosted, do I need to worry about CSRF? 除了SQL注入和XSS攻击之外还有什么我需要担心的吗? - Is there anything I need to worry about besides SQL injections and XSS attacks? 如果您的网站不使用cookie,您还需要担心CSRF保护吗? - If your site doesn't use cookies do you still need to worry about CSRF protection? 商户网站在实施支付网关时应该担心什么? - What should a merchant site worry about when implementing a payment gateway? 编写自动更新客户端时,我必须担心哪些安全问题? - What security concerns must I worry about when writing an auto-update client? 我需要加密秘密访问密钥吗? - Do I need to encrypt secret access key? 为什么贝宝(PayPal)API凭据(客户端ID和机密)需要安全 - Why do PayPal API credentials (client id and secret) need to be secure 支付网关需要 javascript 中的密钥。 我担心这里的密钥安全 - Payment gateway wants the secret key in javascript. I'm concerned about the key security here 您是否需要担心php函数的安全性? - Do you have to worry about php function security?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM