Skip to content

Commit 4159aaa

Browse files
authored
Merge commit from fork
HTML escape adlist URL and non-domain entried before printing it in gravity stream
2 parents 4d39206 + febc2b8 commit 4159aaa

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

scripts/js/gravity.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* This file is copyright under the latest version of the EUPL.
66
* Please see LICENSE file for your rights under this license. */
77

8-
/* global apiFailure:false */
8+
/* global apiFailure:false, utils:false */
99

1010
"use strict";
1111

@@ -89,9 +89,11 @@ function parseLines(outputElement, text) {
8989
const lines = text.split(/(?=\r)/g);
9090

9191
for (let line of lines) {
92+
// Escape HTML to prevent XSS attacks (both in adlist URL and non-domain entries)
93+
line = utils.escapeHtml(line);
9294
if (line[0] === "\r") {
9395
// This line starts with the "OVER" sequence. Replace them with "\n" before print
94-
line = line.replaceAll("\r[K", "\n").replaceAll("\r", "\n");
96+
line = line.replaceAll("\r\u001B[K", "\n").replaceAll("\r", "\n");
9597

9698
// Last line from the textarea will be overwritten, so we remove it
9799
const lastLineIndex = outputElement.innerHTML.lastIndexOf("\n");

0 commit comments

Comments
 (0)