Skip to content

Commit 1e01979

Browse files
committed
[XSS] Fixed false positives and timeouts (thanks riaggren for report).
1 parent 97c7cc7 commit 1e01979

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/bg/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@
296296

297297
async collectSeen(tabId) {
298298
try {
299-
let seen = Array.from(await Messages.send("collect", {}, {tabId, frameId: 0}));
299+
let seen = Array.from(await Messages.send("collect", {uiid: ns.local.uiid}, {tabId, frameId: 0}));
300300
debug("Collected seen", seen);
301301
return seen;
302302
} catch (e) {

src/xss/InjectionCheckWorker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Entities = {
7474
if (msg.handler in Handlers) try {
7575
await Handlers[msg.handler](msg);
7676
} catch (e) {
77-
postMessage({error: e});
77+
postMessage({error: e.message});
7878
}
7979
}
8080

src/xss/InjectionChecker.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ XSS.InjectionChecker = (async () => {
327327
_assignmentRx: /^(?:[^()="'\s]+=(?:[^(='"\[+]+|[?a-zA-Z_0-9;,&=/]+|[\d.|]+))$/,
328328
_badRightHandRx: /=[\s\S]*(?:_QS_\b|[|.][\s\S]*source\b|<[\s\S]*\/[^>]*>)/,
329329
_wikiParensRx: /^(?:[\w.|-]+\/)*\(*[\w\s-]+\([\w\s-]+\)[\w\s-]*\)*$/,
330-
_neutralDotsRx: /(?:^|[\/;&#])[\w-]+\.[\w-]+[\?;\&#]/g,
330+
_neutralDotsOrParensRx: /(?:^|[\/;&#])(?:[\w-]+\.[\w-]+[\?;\&#]|[\s\d]*\()/g,
331331
_openIdRx: /^scope=(?:\w+\+)\w/, // OpenID authentication scope parameter, see http://forums.informaction.com/viewtopic.php?p=69851#p69851
332332
_gmxRx: /\$\(clientName\)-\$\(dataCenter\)\.(\w+\.)+\w+/, // GMX webmail, see http://forums.informaction.com/viewtopic.php?p=69700#p69700
333333

@@ -354,7 +354,7 @@ XSS.InjectionChecker = (async () => {
354354
return this._singleAssignmentRx.test(expr) || this._riskyAssignmentRx.test(expr) && this._nameRx.test(expr);
355355

356356
return this._riskyParensRx.test(expr) ||
357-
this._maybeJSRx.test(expr.replace(this._neutralDotsRx, '')) &&
357+
this._maybeJSRx.test(expr.replace(this._neutralDotsOrParensRx, '')) &&
358358
!this._wikiParensRx.test(expr);
359359

360360
},
@@ -457,7 +457,7 @@ XSS.InjectionChecker = (async () => {
457457
checkLastFunction: function() {
458458
var fn = this.syntax.lastFunction;
459459
if (!fn) return false;
460-
var m = fn.toSource().match(/\{([\s\S]*)\}/);
460+
var m = fn.toString().match(/\{([\s\S]*)\}/);
461461
if (!m) return false;
462462
var expr = this.stripLiteralsAndComments(m[1]);
463463
return /=[\s\S]*cookie|\b(?:setter|document|location|(?:inn|out)erHTML|\.\W*src)[\s\S]*=|[\w$\u0080-\uffff\)\]]\s*[\[\(]/.test(expr) ||
@@ -778,7 +778,7 @@ XSS.InjectionChecker = (async () => {
778778
if (ret) {
779779
let msg = "JavaScript Injection in " + s;
780780
if (this.syntax.lastFunction) {
781-
msg += "\n" + this.syntax.lastFunction.toSource();
781+
msg += `\n${this.syntax.lastFunction}`;
782782
}
783783
this.escalate(msg);
784784
}

0 commit comments

Comments
 (0)