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

Disable output of "upgrade-insecure-requests" in "report only" mode #42

Open
mgroetan opened this issue May 3, 2019 · 3 comments
Open

Comments

@mgroetan
Copy link

mgroetan commented May 3, 2019

If you have run both csp.SetUpgradeInsecureRequests(); and csp.SetReportOnly();, a warning will be shown in the console of dev tools in the browser:
image

I suggest to disable output of this directive when in "report only" mode, to avoid this warning.

@juunas11
Copy link
Owner

juunas11 commented May 3, 2019

Hmm, thanks for reporting this. I've usually not wanted to implement too many of these kinds of behaviours into the library as these can change.
If this is implemented, I'd prefer an exception was thrown if both are defined.

@mgroetan
Copy link
Author

mgroetan commented May 3, 2019

If this is implemented, I'd prefer an exception was thrown if both are defined.

It's your call, but I'd vote for a more passive approach. Let's say that someone would like to enable this directive, but first play around in report only mode, as per the recommendation.
Then, in order not to get a runtime error, you'd have to comment out the directive call, or even delete it, if the company policy dictates that no "dead" code should exist.

Imagine then, that (much) later, someone else picks up the code, with the intention of going to live enforce mode. What's the odds for that person to remember, or even know, that the additional directive should be enabled at the same time?

@juunas11
Copy link
Owner

juunas11 commented May 7, 2019

Right, good points 👍

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