Created
July 27, 2015 23:37
-
-
Save forced-request/00275c928a59c0632315 to your computer and use it in GitHub Desktop.
Using json_encode to prevent JS context XSS
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
<html> | |
<body> | |
<script> | |
var a = “prefix” + <?= json_encode($_GET['p']); ?> + “suffix”; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment