XSS에 대해 100 % 안전합니까? 그렇지 않은 경우 나에게 왜 나쁜 문자열 텍스트를 보여 주시겠습니까?XSS : PHP의 json_encode를 사용하여 javascript 객체 만들기
<html>
<body>
<script>
<?php
$bad = "some bad string. please give example text that makes the below unsafe";
echo "var a = ".json_encode($bad).";";
echo "var b = ".json_encode(array($bad)).";";
?>
</script>
</body>
</html>
Thanks.
그게 결국 당신이'a'로 무엇을 할 것인가에 달렸습니까? – chustar
'$ bad'는 실제로 어디에서 왔습니까? 'json_encode'는 "실행 불가능"인 유효한 [JSON] (http://json.org/) 만 생성하므로 중요하지 않습니다. –
@kevin,'json_encode'는 유효한 json – Neal