Add sanitize from XSS to WebUI
This commit is contained in:
+2
-1
@@ -124,7 +124,8 @@
|
|||||||
fetch(url, {cache: 'no-cache'}).then(r => r.json()).then(data => {
|
fetch(url, {cache: 'no-cache'}).then(r => r.json()).then(data => {
|
||||||
tbody.innerHTML = '';
|
tbody.innerHTML = '';
|
||||||
|
|
||||||
for (const [name, value] of Object.entries(data)) {
|
for (const [key, value] of Object.entries(data)) {
|
||||||
|
const name = key.replace(/[<">]/g, ''); // sanitize
|
||||||
const online = value && value.consumers ? value.consumers.length : 0;
|
const online = value && value.consumers ? value.consumers.length : 0;
|
||||||
const src = encodeURIComponent(name);
|
const src = encodeURIComponent(name);
|
||||||
const links = templates.map(link => {
|
const links = templates.map(link => {
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@
|
|||||||
<script src="main.js"></script>
|
<script src="main.js"></script>
|
||||||
<div id="links"></div>
|
<div id="links"></div>
|
||||||
<script>
|
<script>
|
||||||
const src = new URLSearchParams(location.search).get('src');
|
const src = new URLSearchParams(location.search).get('src').replace(/[<">]/g, ''); // sanitize
|
||||||
|
|
||||||
document.getElementById('links').innerHTML = `
|
document.getElementById('links').innerHTML = `
|
||||||
<h2>Any codec in source</h2>
|
<h2>Any codec in source</h2>
|
||||||
|
|||||||
Reference in New Issue
Block a user