-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest2.html
More file actions
35 lines (29 loc) · 1.14 KB
/
test2.html
File metadata and controls
35 lines (29 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DOMPurify GET Parameter PoC</title>
</head>
<body>
<h1>DOMPurify GET Parameter Test</h1>
<p>This page takes the `q` parameter from the URL, sanitizes it using DOMPurify, and displays it below.</p>
<h2>Sanitized Output:</h2>
<div id="output" style="border: 1px solid #ccc; padding: 10px; margin-top: 10px;">
<em>Sanitized content will appear here.</em>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/2.4.1/purify.min.js"></script>
<script>
function getQueryParam(param) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(param);
}
const userInput = getQueryParam('q') || '';
const sanitized = DOMPurify.sanitize(userInput);
const outputDiv = document.getElementById('output');
outputDiv.innerHTML = sanitized;
console.log('User Input:', userInput);
console.log('Sanitized Output:', sanitized);
</script>
</body>
</html>