Skip to content
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

Testing csp policy phase is preventing webrowser to load ressources #12

Open
Barnoux opened this issue Feb 16, 2024 · 7 comments
Open

Comments

@Barnoux
Copy link

Barnoux commented Feb 16, 2024

Hello,

I was testing the policy and the product owner notified me that some ressources are not loaded in the browser during the fifth phase that is mentionned in the helper of the plugin

Leaving the tag capture active, activate the policy test (at this stage the plugin will generate some violations of the temporary policy used to record additional values to be included in the directives of your "content security policy").

This is an example found in the browser console with the devtool.
image

I thought that during this phase, the policy couldn't impact the client naviguation on the wordpress site.
It appeared to me that the testing CSP policy doesn't "always" prevent a loading.

maybe i miss something ?

regards,
BBA

@MocioF
Copy link
Owner

MocioF commented Feb 16, 2024

The line you copied reports "Report Only". This should not prevent the script from loading.

@Barnoux
Copy link
Author

Barnoux commented Feb 16, 2024

Ok well i have an issue then... When the test policy is not applied, browser clients correctly load the ressources. How can i troubleshoot this ?

@MocioF
Copy link
Owner

MocioF commented Feb 17, 2024

Sorry, I don't understand.
If you don't apply any policy, why browsers should not load whatever they find in the page?

@Barnoux
Copy link
Author

Barnoux commented Feb 17, 2024

My bad i wasn't clear in my statement.

  • When the test policy is not applied, browser clients correctly load the ressources.
  • When the test policy is applied, browser clients doesn't correctly load the ressources.

@MocioF
Copy link
Owner

MocioF commented Feb 17, 2024

Is the resource whitelisted?
How did you whitelist it?
Can you post a link to the page with the problem?

@Barnoux
Copy link
Author

Barnoux commented Feb 19, 2024

i'm testing the plugin in a test environnement so i can't send you a link because you could not have access to the page.

when the pages are not loaded this is the common error that i have in the console :
image
as we can see in the console log the test policy is activated.

One thing that is als strange, the CSP policy is not always in the HTTP response header.

@MocioF
Copy link
Owner

MocioF commented Mar 4, 2024

Try to use nonces and not hashes. Maybe the CSP generated with hashes is too big to fit the response header size of your server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants