-
-
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
Reporting API #5634
Comments
I'll put together a test implementation this weekend. |
Rich, where are you getting this |
Scratch that, I just hadn't found the right documentation yet. Found it. |
The problem with using A solution I'd suggestMake this build-adapter specific and write the CSPs to each platform's headers file, instead of using meta tags. Examples
Then headers will be set in production even if routes prerendered. |
To go further, this workflow creates the opportunity for SvelteKit to allow devs to specify project-wide headers, like security headers, within headers: {
"/*": {
"X-Frame-Options": "DENY"
"X-Content-Type-Options": "nosniff"
},
"/foo": {
"Another-header": "some-value"
}
} (It seems okay to not worry about type safety of property options.) I use the following when creating my type HeadersObj = {
[key: string]: {
[innerKey: string]: string;
};
};
export function toStr(obj: HeadersObj): string {
let output = '';
for (const [key, value] of Object.entries(obj)) {
output += `${key}\n`;
for (const [innerKey, innerValue] of Object.entries(value)) {
output += ` ${innerKey}: ${innerValue}\n`;
}
output += '\n';
}
return output.replace(/\n\n$/, '\n');
} This also lets me use an object of standard headers for all projects with strict security, that can be customized within each project. |
Describe the problem
#5496 added CSP report-only mode. To use the
report-to
directive, it's necessary to addReport-To
andReporting-Endpoints
headers insidehandle
(the latter is the newer API, but isn't universally supported yet, so both are necessary), which somewhat defeats the object of letting the framework handle CSP. In fact it's worse, sincereport-to
isn't universally supported; you need to use thereport-uri
directive as well.The whole thing is a shocking mess.
Describe the proposed solution
Copied from this comment:
Alternatives considered
Leave it as an exercise to readers. I think that would be a shame, since it's so finicky to set up, and we already have nice CSP handling.
Importance
nice to have
Additional Information
No response
The text was updated successfully, but these errors were encountered: