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

docs: example of generated nonce to use base64 encoding as per spec #55039

Merged
merged 2 commits into from Sep 6, 2023

Conversation

csi-lk
Copy link
Contributor

@csi-lk csi-lk commented Sep 6, 2023

nonce's are limited to characters found in base64 encoding, uuids contain '-' which breaks the spec,
converting to a base64 string after generating simplifies this


This was a bit gotcha in our project, there are a few tools that only expect there to be a single - and do a split based off it (so when there are >1 they fail)

Rules for nonce's

  • The nonce must be unique for each HTTP response
  • The nonce should be generated using a cryptographically secure random generator
  • The nonce should have sufficient length, aim for at least 128 bits of entropy (32 hex characters, or about 24 base64 characters).
  • Script tags that have a nonce attribute must not have any untrusted / unescaped variables within them.
  • The characters that can be used in the nonce string are limited to the characters found in base64 encoding.

nonce's are limited to characters found in base64 encoding,
uuids contain '-' which breaks the spec,
converting to a base64 string after generating simplifies this
@csi-lk
Copy link
Contributor Author

csi-lk commented Sep 6, 2023

CC @leerob who just wrote the documentation in this PR: #54601

Copy link

@orca-security-us orca-security-us bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 1   low 0   info 0 View in Orca

@styfle styfle added the CI approved Approve running CI for fork label Sep 6, 2023
@kodiakhq kodiakhq bot merged commit cc34ea5 into vercel:canary Sep 6, 2023
41 checks passed
kodiakhq bot pushed a commit that referenced this pull request Sep 8, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CI approved Approve running CI for fork locked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants