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

Question: why does the nonce staticmethod add angle brackets around the nonce value? #21

Open
jrobbins-LiveData opened this issue Aug 7, 2022 · 1 comment

Comments

@jrobbins-LiveData
Copy link

value = "'nonce-<{}>'".format(value)

The examples of adding a nonce to CSP that I've seen in, e.g., https://csp.withgoogle.com/docs/strict-csp.html#example and https://content-security-policy.com/nonce/ show 'nonce-rAnd0m'.

The CSP3 spec specifies the nonce production as:

; Nonces: 'nonce-[nonce goes here]'
nonce-source  = "'nonce-" [base64-value](https://www.w3.org/TR/CSP3/#grammardef-base64-value) "'"
base64-value  = 1*( [ALPHA](https://tools.ietf.org/html/rfc5234#appendix-B.1) / [DIGIT](https://tools.ietf.org/html/rfc5234#appendix-B.1) / "+" / "/" / "-" / "_" )*2( "=" )

Are the characters < and > even allowed?

@cak
Copy link
Owner

cak commented Apr 29, 2024

Thank you @jrobbins-LiveData!

cak added a commit that referenced this issue Apr 29, 2024
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