Skip to content

Commit 6a99c15

Browse files
authored
Merge pull request #25 from Seol-JY/fix/vulnerability
[FIX]: 취약점 수정
2 parents c81aec0 + 8bac082 commit 6a99c15

File tree

4 files changed

+9
-84
lines changed

4 files changed

+9
-84
lines changed

client/public/index.html

-36
Original file line numberDiff line numberDiff line change
@@ -21,40 +21,4 @@
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>
6024
</html>

client/src/App.js

-48
Original file line numberDiff line numberDiff line change
@@ -23,57 +23,9 @@ function App() {
2323
);
2424
const [counterValue, setCounterValue] = useState(0);
2525

26-
// useEffect(() => {
27-
// // 마우스 메뉴 막기
28-
// const handleContextMenu = (e) => {
29-
// e.preventDefault();
30-
// };
31-
// const handleKeyDown = (e) => {
32-
// if (
33-
// // CMD + Alt + I (Chrome, Firefox, Safari)
34-
// (e.metaKey && e.altKey && e.keyCode === 73) ||
35-
// // CMD + Alt + J (Chrome)
36-
// (e.metaKey && e.altKey && e.keyCode === 74) ||
37-
// // CMD + Alt + C (Chrome)
38-
// (e.metaKey && e.altKey && e.keyCode === 67) ||
39-
// // CMD + Shift + C (Chrome)
40-
// (e.metaKey && e.shiftKey && e.keyCode === 67) ||
41-
// // Ctrl + Shift + I (Chrome, Firefox, Safari, Edge)
42-
// (e.ctrlKey && e.shiftKey && e.keyCode === 73) ||
43-
// // Ctrl + Shift + J (Chrome, Edge)
44-
// (e.ctrlKey && e.shiftKey && e.keyCode === 74) ||
45-
// // Ctrl + Shift + C (Chrome, Edge)
46-
// (e.ctrlKey && e.shiftKey && e.keyCode === 67) ||
47-
// // F12 (Chome, Firefox, Edge)
48-
// e.keyCode === 123 ||
49-
// // CMD + Alt + U, Ctrl + U (View source: Chrome, Firefox, Safari, Edge)
50-
// (e.metaKey && e.altKey && e.keyCode === 85) ||
51-
// (e.ctrlKey && e.keyCode === 85)
52-
// ) {
53-
// e.preventDefault();
54-
// }
55-
// };
56-
57-
// document.addEventListener("contextmenu", handleContextMenu);
58-
// document.addEventListener("keydown", handleKeyDown);
59-
60-
// return () => {
61-
// document.removeEventListener("contextmenu", handleContextMenu);
62-
// document.removeEventListener("keydown", handleKeyDown);
63-
// };
64-
// }, []);
65-
6626
useEffect(() => {
6727
fetchCounterValue();
6828
egg();
69-
70-
window.addEventListener("devtoolschange", (event) => {
71-
if (event.detail.isOpen) {
72-
console.log("Developer tools opened");
73-
} else {
74-
console.log("Developer tools closed");
75-
}
76-
});
7729
}, []);
7830

7931
const fetchCounterValue = async () => {

client/src/components/Editor.jsx

+5
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@ export default function Editor({
9595

9696
const userInputHandler = (event) => {
9797
//input창 내용을 userinput에 반영
98+
const previousValue = userInput; // 직전 값 저장
9899
setUserInput(event.currentTarget.value); // replace(/[ㄱ-ㅎ|ㅏ-ㅣ|가-힣]/g,'')
100+
if (event.currentTarget.value.length - previousValue.length > 2) {
101+
alert("Careful. This might not do what you think, 잘못된 접근입니다.");
102+
window.location.reload();
103+
}
99104
};
100105

101106
useEffect(() => {

client/src/utils/egg.js

+4
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,8 @@ can manipulate speed, please report
5050
"color: balck; font-size: 10px;",
5151
"color: #fff530; background-color: #212121; font-size: 11px;"
5252
);
53+
console.log(
54+
`%cCareful. This might not do what you think.`,
55+
"color: yellow; background-color: red; font-size: 14px; font-weight: bold;"
56+
);
5357
}

0 commit comments

Comments
 (0)