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

Better naming for nonce meta tag #1315

Closed
DavidPetrasek opened this issue Sep 20, 2024 · 5 comments
Closed

Better naming for nonce meta tag #1315

DavidPetrasek opened this issue Sep 20, 2024 · 5 comments

Comments

@DavidPetrasek
Copy link

DavidPetrasek commented Sep 20, 2024

I propose changing the name from:
<meta name="csp-nonce" ... >
to:
<meta name="csp-style-nonce" ... >
... which is clear, since there can be a script nonce as well.

@brunoprietog
Copy link
Collaborator

Thanks for the proposal, but I don't think it's worth making such a change. Don't see the value.

@DavidPetrasek
Copy link
Author

There is a value. It happened to me that I was passing a script nonce as a value to this meta tag, and things were not working well. Then I found out it needs to be a style nonce.

@brunoprietog
Copy link
Collaborator

Just include a random uuid, like this:

<meta name="csp-nonce" content="03204eb84932e2af821e2fbdca66232a">

@DavidPetrasek
Copy link
Author

Ok, but I already have a style and script nonce, then why should I generate another one? That would mean unnecessary overhead and confusion at the same time.

@brunoprietog
Copy link
Collaborator

You don't have to generate another one, just use the one you already have. That nonce can be included in the header directives for script and style. They don't necessarily have to be different. In fact, they should be the same. That nonce is used by Turbo not only for styles but also to activate scripts in some cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants