-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Content-Security-Policy blocks access. #22
Comments
Hi @zachwhelchel, Looking at the error code If yes, can you please change it to credentialless along with the if not, please share all the security headers you have in your application so that we can check further. Thank you. |
@vijayasingam-paddle thanks for the response. I set the Cross-Origin-Embedder-Policy as you suggested and it gets further now... but when I try to initialize a checkout the window shows this: There are no errors given in the console so I'm not sure what to do next. |
@vijayasingam-paddle I just checked the documentation for my code base and apparently there are restrictions on the CORS changes I can make:
Is there any way around this from your all's end? Does Paddle provide a hosted checkout page? Where I could direct users to with some prefilled options? Any way I try this I can't seem to get paddle to load on my app. |
Hi @zachwhelchel, Changing CORS headers is a very common approach to include third party scripts (Including Google Analytics or Cookie consent popup providers) to our applications. So it should be alright to change the CORS headers to allow downloading scripts from our domain. Unfortunately, I don't see any other option to make it work.
This is strange, we suspect a firewall or some other issue in your end. What happens when you open https://buy.paddle.com/ in your browser? it should throw a |
@vijayasingam-paddle this is what I see when I go to that url. So it seems to load in another tab but in my app it's still giving the "refused to connect" error I posted above. Is there some other security setting that needs to be set that we haven't covered? |
@vijayasingam-paddle I thought it might be due to a "frame-src" in the Content-Security-Policy but that doesn't seem to be the case. |
I also tried adding this and it didn't change anything: frame-ancestors 'self' https://sandbox-buy.paddle.com/; |
@vijayasingam-paddle welp... it turns out that Safari is still not pleased with my changes to "credentialless". We use the Shared Array Buffer and "credentialless" removes access to it for security purposes. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer Is there any chance I can set up a developer support call or something? I really want to implement Paddle but I just can't seem to get it working! |
Hi @zachwhelchel, Can you please reach out to us at Thank you. |
@vijayasingam-paddle I reached out to that email address asking for help. Thanks! Maybe it's just not possible to both support SharedArrayBuffer and Paddle inside the same app? Becuase the second I change to "credentialless" Safari refuses to use the SharedArrayBuffer. But "credentialless" is nessecary for Paddle? Am I missing something here or does Paddle just not work in any app that needs to support SharedArrayBuffer? |
I'm trying to integrate Paddle and have the same problem as @zachwhelchel. The problem is that Paddle is currently not following security best-practices by not providing the A more in-depth explanation as I would be interested in this getting solved by Paddle:
TLDR: The problem is on paddle's side. If this is not clear enough, check out this website that explains it: https://resourcepolicy.fyi/ And just to understand that this is best practice to deliver the How to fix this: Paddle needs to add the header It would be great if Padde could fix this. |
@thomasdondorf thanks for jumping in here. Just an update from my end. I was never able to get this working... I had to opt to sending users to a page on my marketing site to process the payment. Not ideal. Would love to see this fixed. |
@zachwhelchel Sure, I was happy someone had already reported the problem :) The only way to solve this currently is to redirect from the "main page" to some special page with the policy disabled... |
Hi @zachwhelchel, Hi @thomasdondorf, I will check with our support team to find why it was not addressed and move the ticket back to engineering to fix this problem. Thank you for your patience, I am really sorry for the inconvenience. |
This one is super interesting for me 😃 I hope we can get it working soon |
Hi everyone, Thank you for waiting patiently. |
I'm seeing a CSP issue too. Not sure if it's the same problem as that discussed here but I'll report just in case it's related. I have paddle integrated into an electron app that has the following CSP:
In dev, connecting to the paddle sandbox works fine but when the app is built, it refuses to connect to paddle prod. In the console I see: [Report Only] Refused to frame 'https://buy.paddle.com/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors ". Note that '' matches only URLs with network schemes ('http', 'https', 'ws', 'wss'), or URLs whose scheme matches |
Hi @marcolarosa, Our Checkouts can be launched only from approved domains in Production. However, as electron apps do not have a domain, our validation is failing and throwing an error. I am sorry that you are running into this issue. Thank you. |
@vijayasingam-paddle Ahh sorry! Thanks for the advice. |
Hi @zachwhelchel / @thomasdondorf / @pedrovgs, Thank you for being patient while we were looking into this issue. Changing the CORS headers in the Paddle side of things was the easier change. However, we quickly found that the problems don't stop there. In a cross-origin isolated environment, all the iframes loaded into the browser will inherit the same COEP and should either be from the same domain or include appropriate CORS headers. Even though we could fix the headers on our end, we rely on other payment partners and their servers do not send any CORS headers. Due to this, with the correct CORP and COEP headers we will be able to run Paddle.js and launch checkout. However, it will fail when it reaches the 3DS payments screen with the same error. There is a proposal to allow iframes to act independently, though browser support is minimal as it works only with Chrome at the moment. We cannot choose this solution as we will have to support all the browsers. Sadly, there is very little we can do about this issue. We will keep tabs on the proposal and we could get it working once every major browsers start supporting it. Please let us know if we can help you with anything else. |
@vijayasingam-paddle would it be possible to allow opt-in for using the credentialless iframes? |
Hi @lowkahonn, I will get this working in a couple of weeks and maybe we could run some beta tests to see real-world impact. Thank you. |
Would there be an option to perform feature detection for credentialless iFrames and use them if present? Currently, our web app (SPA) is Cross-Origin isolated and when a user opens the checkout page, we need to refresh the page to drop the COEP and COOP headers. When the user navigates away, we reload again. As this differs from SPA navigation, it can be jarring to our users. We would like to offer credentialless checkout frames to those users whose browsers support them and use our hard reload technique for all other users. |
Hi @reknih, I found this snippet to detect if an element supports a property. Thank you. |
I was able to integrate the payment process relatively smoothly in the following way. I added an exception in my server configuration to not serve the "Cross-Origin" headers for the one page that integrates Paddle.js ( Here is my (simplified) nginx config. location = /checkout {
try_files /checkout.html =404;
}
location / {
add_header Cross-Origin-Opener-Policy "same-origin";
add_header Cross-Origin-Embedder-Policy "require-corp";
try_files $uri.html =404;
} Note for Next.js users (like myself): Make sure to use actual links ( Maybe this helps someone else. |
As someone reached out to me for help, I'll give more details below: You can see it in action here: https://www.chessmonitor.com/pricing, but you have to create a (free) account. Basically there are two pages:
And of course, you should setup an event listener to listen to events like Hope that makes it more clear! |
I've faced the same issue at https://insightvox.net, so I had to disable the CSP for the where the Paddle iframe is shown. So in your controller, you would add: In my case the subscription page is under authentication, so the risk is limited, but ensure you know what you're doing. Hope this helps other people landing here! |
What happened?
I guess this is a CORS issue with my React app? But some guidance on this would be helpful.
GET https://cdn.paddle.com/paddle/v2/paddle.js net::ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep 200 (OK)
I've tried modifying my Content-Security-Policy to this:
<meta http-equiv="Content-Security-Policy" content="script-src 'self' https://cdn.paddle.com/; worker-src 'self' blob:;">
But it doesn't seem to help. Any thoughts? Could the code that downloads the script in the package be marked specifically with some modifier that CORS allows? I've seen that done elsewhere.
Steps to reproduce
Use the package via yarn install in a React app that has a strict Content-Security-Policy.
What did you expect to happen?
No response
How are you integrating?
No response
Logs
No response
The text was updated successfully, but these errors were encountered: