Created
May 13, 2019 22:04
-
-
Save randomdross/312434ea2eb5d3584c791f9da24a8092 to your computer and use it in GitHub Desktop.
Nonce validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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