-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
ViewTransitions (v3.2.0+) unusable with a content security policy #8937
Comments
Ah, ok yeah good call out. I think we can probably put this into the stylesheet we already have. I'll add it next week. |
Does this CSP directive help?
|
@lilnasy It's all relative. Any |
Has this been fixed in Astro v4.2.1? I ask because I think I am encountering this problem.
|
At least in v4.2.4, this has not been fixed yet. |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
The recent addition of a Route Announcer in
<ViewTransitions />
in 3.2.0 appends a div with a style declaration. That inline style breaks content security policy withoutunsafe-inline
so makes view transitions unusable with a CSP. While it's possible to declare unsafe-inline for styles in the CSP, that's not optimal from a security standpoint.To reproduce, run Astro in example below, click on a new page and inspect. You'll find:
Developers should have an option at least to render the styling in a stylesheet, or opt-out so they can implement on their own.
What's the expected result?
I think Announce should be optional—on by default with an option to not include—so that developers can implement in a manner appropriate for their needs.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-zxgdrp-6sx3md?file=src%2Fpages%2Findex.astro
Participation
The text was updated successfully, but these errors were encountered: