Created
April 23, 2019 21:38
-
-
Save randomdross/ea9767833aac4cd223fc6efda1ea229d 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