Skip to content

Instantly share code, notes, and snippets.

@randomdross
Created April 23, 2019 21:38
Show Gist options
  • Save randomdross/ea9767833aac4cd223fc6efda1ea229d to your computer and use it in GitHub Desktop.
Save randomdross/ea9767833aac4cd223fc6efda1ea229d to your computer and use it in GitHub Desktop.
Nonce validation
func validateCSPNonce(cspNonce string) string {
if m, _ := regexp.MatchString("^[a-zA-Z0-9]{20}$", cspNonce); !m {
return ""
}
return cspNonce
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment