Skip to content

Commit c81aec0

Browse files
committed
[FIX]: 취약점 대응 수정
1 parent a2d5e44 commit c81aec0

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

client/public/index.html

+36
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,40 @@
2121
<body onpaste="return false">
2222
<div id="root"></div>
2323
</body>
24+
<script>
25+
window.onload = function () {
26+
const detectDevTool = (allow) => {
27+
let a = false;
28+
if (isNaN(+allow)) allow = 100;
29+
const start = +new Date();
30+
debugger;
31+
const end = +new Date();
32+
if (isNaN(start) || isNaN(end) || end - start > allow) {
33+
alert("DEVTOOLS detected. all operations will be terminated.");
34+
window.location.href = "/";
35+
}
36+
};
37+
38+
if (window.attachEvent) {
39+
if (
40+
document.readyState === "complete" ||
41+
document.readyState === "interactive"
42+
) {
43+
detectDevTool();
44+
window.attachEvent("onresize", detectDevTool);
45+
window.attachEvent("onmousemove", detectDevTool);
46+
window.attachEvent("onfocus", detectDevTool);
47+
window.attachEvent("onblur", detectDevTool);
48+
} else {
49+
setTimeout(arguments.callee, 0);
50+
}
51+
} else {
52+
window.addEventListener("load", detectDevTool);
53+
window.addEventListener("resize", detectDevTool);
54+
window.addEventListener("mousemove", detectDevTool);
55+
window.addEventListener("focus", detectDevTool);
56+
window.addEventListener("blur", detectDevTool);
57+
}
58+
};
59+
</script>
2460
</html>

client/src/App.js

-36
Original file line numberDiff line numberDiff line change
@@ -63,42 +63,6 @@ function App() {
6363
// };
6464
// }, []);
6565

66-
useEffect(() => {
67-
// 개발자 도구 검사
68-
const detectDevTool = (allow) => {
69-
let a = false;
70-
if (isNaN(+allow)) allow = 100;
71-
const start = +new Date();
72-
debugger;
73-
const end = +new Date();
74-
if (isNaN(start) || isNaN(end) || end - start > allow) {
75-
alert("DEVTOOLS detected. all operations will be terminated.");
76-
window.location.href = "/";
77-
}
78-
};
79-
80-
if (window.attachEvent) {
81-
if (
82-
document.readyState === "complete" ||
83-
document.readyState === "interactive"
84-
) {
85-
detectDevTool();
86-
window.attachEvent("onresize", detectDevTool);
87-
window.attachEvent("onmousemove", detectDevTool);
88-
window.attachEvent("onfocus", detectDevTool);
89-
window.attachEvent("onblur", detectDevTool);
90-
} else {
91-
setTimeout(arguments.callee, 0);
92-
}
93-
} else {
94-
window.addEventListener("load", detectDevTool);
95-
window.addEventListener("resize", detectDevTool);
96-
window.addEventListener("mousemove", detectDevTool);
97-
window.addEventListener("focus", detectDevTool);
98-
window.addEventListener("blur", detectDevTool);
99-
}
100-
}, []);
101-
10266
useEffect(() => {
10367
fetchCounterValue();
10468
egg();

0 commit comments

Comments
 (0)