XSS 공격 방지
This commit is contained in:
1 parent
2fdf5aa9c7
commit
c1f9d9d127
2 files changed
+10
-6
No files matched your search
@@ -5,16 +5,18 @@
|
||||
|
||||
<script>
|
||||
<?php
|
||||
$maestro_name = $_GET["maestro_name"];
|
||||
$maestro_name = isset($_GET["maestro_name"]) ? (string)$_GET["maestro_name"] : "";
|
||||
|
||||
// echo "maestro_name : $maestro_name</br>";
|
||||
if($maestro_name == "") {
|
||||
echo "no maestro_name";
|
||||
echo "// no maestro_name\n";
|
||||
run_url("./../../client/license_timer.html");
|
||||
exit;
|
||||
}
|
||||
|
||||
echo("sessionStorage.setItem('maestroName', '$maestro_name');\n\r");
|
||||
// 사용자 입력이 스크립트로 실행되지 않도록 JS 문자열 리터럴로 안전하게 출력 (XSS 방지)
|
||||
$maestro_name_js = json_encode($maestro_name, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);
|
||||
echo("sessionStorage.setItem('maestroName', $maestro_name_js);\n\r");
|
||||
run_url("./../../client/license_timer.html");
|
||||
|
||||
function run_url($targetUrl) {
|
||||
|
||||
@@ -5,16 +5,18 @@
|
||||
|
||||
<script>
|
||||
<?php
|
||||
$maestro_name = $_GET["maestro_name"];
|
||||
$maestro_name = isset($_GET["maestro_name"]) ? (string)$_GET["maestro_name"] : "";
|
||||
|
||||
// echo "maestro_name : $maestro_name</br>";
|
||||
if($maestro_name == "") {
|
||||
echo "no maestro_name";
|
||||
echo "// no maestro_name\n";
|
||||
run_url("./../../player/login.html");
|
||||
exit;
|
||||
}
|
||||
|
||||
echo("sessionStorage.setItem('maestroName', '$maestro_name');\n\r");
|
||||
// 사용자 입력이 스크립트로 실행되지 않도록 JS 문자열 리터럴로 안전하게 출력 (XSS 방지)
|
||||
$maestro_name_js = json_encode($maestro_name, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);
|
||||
echo("sessionStorage.setItem('maestroName', $maestro_name_js);\n\r");
|
||||
run_url("./../../client/login.html");
|
||||
|
||||
function run_url($targetUrl) {
|
||||
|
||||
Reference in new issue
Block a user