Skip to content

Instantly share code, notes, and snippets.

@randomdross
Created May 13, 2019 22:04
Show Gist options
  • Save randomdross/312434ea2eb5d3584c791f9da24a8092 to your computer and use it in GitHub Desktop.
Save randomdross/312434ea2eb5d3584c791f9da24a8092 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