#JasonG
1 messages · Page 1 of 1 (latest)
hello! gimme a while to see what's possible
it's not possible to add a CORS header, the only suggestion that I can give here is to use a CSP : https://stripe.com/docs/security/guide#content-security-policy
Thanks @hearty hill . I am already using a CSP, with script-src *.stripe.com, unfortunately that doesn't fix this, as CSP changes what the containing document (my site) will allow, but the lack of CORS header indicates that the embedded script (stripe.js) won't allow itself to be loaded, so the browser blocks it 😦.
Thanks for looking into this for me.
Just placing the actual error here for reference
Hi Jason. I am Jack and I work with Alex
Is there a webpage that I can visit to reproduce this error?
um... no, because the issue is only present on my development server. Our production servers do not use CSP because they do not currently use the browser features I'm trying to work with.
What browser feature are you working with? Is it a beta feature?
I'm working with mutli-threaded WASM, which requires CSP
I don't think it's a beta feature (at least in chrome) not sure about other web assembly implementations
Just double check if you have added script-src, https://js.stripe.com CSP directives?
script-src 'self' 'unsafe-eval' 'unsafe-inline' *.stripe.com cdn.jsdelivr.net blob:;
I'm new to CSP, but I had expected that to be sufficient
Did you also add the connect-src and frame-src?
frame-src 'self' js.stripe.com hooks.stripe.com;
connect-src 'self' api.stripe.com cdn.jsdelivr.net http://localhost:1337;
should connect-src include a broader (or otherwise different) stripe.com address?
Can you copy the exact configuration? e.g., including the https://
sure, give 2 minutes
here is my complete CSP config
default-src 'self' 'unsafe-inline' blob: data:;
font-src 'self' *.googleapis.com *.gstatic.com;
frame-src 'self' https://js.stripe.com https://hooks.stripe.com;
script-src 'self' 'unsafe-eval' 'unsafe-inline' https://js.stripe.com https://maps.googleapis.com cdn.jsdelivr.net blob:;
connect-src 'self' https://api.stripe.com https://maps.googleapis.com cdn.jsdelivr.net http://localhost:1337;
style-src-elem 'self' 'unsafe-inline' fonts.googleapis.com;
img-src 'self' blob: data: *.s3.ap-southeast-2.amazonaws.com *.s3-ap-southeast-2.amazonaws.com;
and the response from stripe.com/v3
I also have the following cross-origin policies
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: credentialless
Cross-Origin-Resource-Policy: cross-origin
Can you upload your working project somewhere public so that I can reproduce it?
I can work something out to make it reproducible, yes