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

Autogenerate CSP hashes for static adapter #96

Open
DylanPiercey opened this issue Dec 30, 2024 · 1 comment
Open

Autogenerate CSP hashes for static adapter #96

DylanPiercey opened this issue Dec 30, 2024 · 1 comment

Comments

@DylanPiercey
Copy link
Contributor

Explore automatically replacing csp nonces with content hashes and an inline meta http-equiv tag (eg https://www.isaacsmith.us/blog/2022/add-csp-to-github-pages) when the static adapter is used.

This would allow csp nonce in ssr builds while still having a stricter csp in static builds.

@caseycarroll
Copy link

I'd like to call out a peculiar performance bug in chromium related to the meta CSP tag. The presence of a meta CSP tag disables the browser's preload scanner. Fortunately, this appears to be getting fixed soon.

The CSP meta tag can be a perf footgun in other ways. If, for any reason, a script tag exists before a meta CSP tag, browsers will disable the preload scanner. I'm struggling to find strong references to this behavior, but it is mentioned here by a DevRel at Google who strongly discourages the meta CSP altogether: https://rviscomi.dev/2023/07/you-probably-dont-need-http-equiv-meta-tags/#content-security-policy

Other references:

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