-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
CSP report only mode #3556
Comments
Full CSP and Straightforward solution would be: // svelte.config.js
export default {
kit: {
csp: {
directives: {...},
reportOnly: {...}
}
}
}; This would probably lead to a fair bit of duplication in people's configs, as you need to start by copying the whole directive you want to make changes to. I'm not sure we can do something about that without creating more confusion than we're solving if we start changing the basic structure of the headers. |
@Rich-Harris, I'm looking at the PR related to this by @mcmxcdev, and I've noticed a couple of things based on the MDN documentation:
and
Annoyingly, clicking ont he I think what this means for this feature is at least:
What do you think? |
No rush on this one, but I'd like a resolution on a few questions before I put any more effort into it. I'm putting this comment on the issue rather than the PR, even though there's some technical discussion here, as issues tend to be more discoverable in the future if someone's having CSP issues and is looking for details. First, Is the current implementation (as described above and implemented on the linked PR) what you're looking for? Second, for testing: The CSP report-only mode is in a bit of a limbo right now, as the required directives Essentially, if you want your CSP report-only to work in all environments:
Okay, with the background laid, here's the idea: Common to both
|
@Rich-Harris This obviously isn't super high on the priority list, but I wanted to make sure the issue (and associated PR) don't fall into the stale PR pit. |
Hey, sorry — totally dropped the ball on this. Tried to bring #5078 up to date with Will review the implementation on the PR. Man, I didn't realise the reporting API was such a mess! I love the fact that an API for reporting (among other things) deprecations is itself responsible for multiple deprecations. I think for our current purposes we can just ignore it and leave it as an exercise to the reader — if someone specifies I think the question is whether we want to verify that the reporting endpoints are being created, and/or whether we want to provide a way to add Just spitballing: export default {
kit: {
csp: {...},
reporting: {
'main-endpoint': {
uri: '/reporting/main',
maxage: 86400
},
default: {
uri: '/reporting/default',
maxage: 86400
}
}
}
}; SvelteKit could then easily create the headers and However I don't think we need to do that as part of #5078 — I think it should be discussed and implemented separately. |
Agree about implementing built-in I'll clean up the current PR, and when that's merged, I'll open a separate discussion on the |
Opened #5634 for the reporting API headers stuff, so I'll close this |
Describe the problem
It's generally considered a good idea to enable
content-security-policy-report-only
before enabling CSP, just in case it will break a bunch of stuff.Describe the proposed solution
With this config, the header name would be
content-security-policy-report-only
instead ofcontent-security-policy
. Everything else would be unchanged.Alternatives considered
No response
Importance
nice to have
Additional Information
No response
The text was updated successfully, but these errors were encountered: