Skip to content

Commit ec04a2e

Browse files
committed
[xss] Removed legacy/obsolete exceptions.
1 parent 019cf8b commit ec04a2e

File tree

1 file changed

+12
-89
lines changed

1 file changed

+12
-89
lines changed

src/xss/Exceptions.js

Lines changed: 12 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@
2323
XSS.Exceptions = (() => {
2424

2525
var Exceptions = {
26-
get legacyExceptions() {
27-
delete this.legacyExceptions;
28-
this.legacyExceptions =
29-
Legacy.getRxPref("filterXExceptions",
30-
Legacy.RX.multi, "g", /^https?:[a-z:/@.?-]*$/i);
31-
return this.legacyExceptions;
32-
},
3326

3427
async getWhitelist() {
3528
return (await Storage.get("sync", "xssWhitelist")).xssWhitelist;
@@ -71,16 +64,6 @@ XSS.Exceptions = (() => {
7164
debug("Privileged origin", srcOrigin); // DEV_ONLY
7265
}
7366

74-
// destination or @source matching legacy regexp
75-
if (this.legacyExceptions &&
76-
(this.legacyExceptions.test(unescapedDest) &&
77-
!this.isBadException(xssReq.destDomain) ||
78-
this.legacyExceptions.test("@" + unescape(srcUrl))
79-
)) {
80-
logEx("Legacy exception", this.legacyExceptions);
81-
return true;
82-
}
83-
8467
if (!srcOrigin && isGet) {
8568
if (/^https?:\/\/msdn\.microsoft\.com\/query\/[^<]+$/.test(unescapedDest)) {
8669
return true; // MSDN from Microsoft VS
@@ -93,20 +76,15 @@ XSS.Exceptions = (() => {
9376
return true; // any about: URL except about:blank
9477

9578
if (srcOrigin === "https://www.youtube.com" &&
96-
/^https:\/\/(?:plus\.googleapis|apis\.google)\.com\/[\w/]+\/widget\/render\/comments\?/.test(destUrl) &&
97-
Legacy.getPref("filterXExceptions.yt_comments")
98-
) {
79+
/^https:\/\/(?:plus\.googleapis|apis\.google)\.com\/[\w/]+\/widget\/render\/comments\?/.test(destUrl)) {
9980
logEx("YouTube comments exception");
10081
return true;
10182
}
10283

10384
if (isPost) {
10485

105-
if (srcOrigin === "https://sso.post.ch" && destOrigin === "https://app.swisspost.ch") {
106-
return true;
107-
}
108-
109-
if (srcOrigin === "https://twitter.com" && /^https:\/\/.*\.twitter\.com$/.test(destOrigin)) {
86+
if (/^https:\/\/(?:twitter|x).com$/.test(srcOrigin) &&
87+
/^https:\/\/.*\.(?:twitter|x)\.com$/.test(destOrigin)) {
11088
return true;
11189
}
11290

@@ -119,88 +97,34 @@ XSS.Exceptions = (() => {
11997

12098
if (/^https?:\/\/csr\.ebay\.(?:\w{2,3}|co\.uk)\/cse\/start\.jsf$/.test(srcUrl) &&
12199
/^https?:\/\/msa-lfn\.ebay\.(?:\w{2,3}|co\.uk)\/ws\/eBayISAPI\.dll\?[^<'"%]*$/.test(unescapedDest) &&
122-
destObj.protocol === srcObj.protocol &&
123-
Legacy.getPref("filterXException.ebay")) {
100+
destObj.protocol === srcObj.protocol) {
124101
logEx("Ebay exception");
125102
return true;
126103
}
127104

128-
if (/^https:\/\/(?:cap\.securecode\.com|www\.securesuite\.net|(?:.*?\.)?firstdata\.(?:l[tv]|com))$/.test(srcUrl) &&
129-
Legacy.getPref("filterXException.visa")) {
105+
if (/^https:\/\/(?:cap\.securecode\.com|www\.securesuite\.net|(?:.*?\.)?firstdata\.com)$/.test(srcUrl)) {
130106
logEx("Verified by Visa exception");
131107
return true;
132108
}
133109

134-
if (/\.verizon\.com$/.test(srcOrigin) &&
135-
/^https:\/\/signin\.verizon\.com\/sso\/authsso\/forumLogin\.jsp$/.test(destUrl) &&
136-
Legacy.getPref("filterXExceptions.verizon")) {
137-
logEx("Verizon login exception");
138-
return true;
139-
}
140-
141110
if (/^https?:\/\/mail\.lycos\.com\/lycos\/mail\/MailCompose\.lycos$/.test(srcUrl) &&
142-
/\.lycosmail\.lycos\.com$/.test(destOrigin) &&
143-
Legacy.getPref("filterXExceptions.lycosmail")) {
111+
/\.lycosmail\.lycos\.com$/.test(destOrigin)) {
144112
logEx("Lycos Mail exception");
145113
return true;
146114
}
147115

148-
if (/\.livejournal\.com$/.test(srcOrigin) &&
149-
/^https?:\/\/www\.livejournal\.com\/talkpost_do\.bml$/.test(destUrl) &&
150-
Legacy.getPref("filterXExceptions.livejournal")) {
116+
if (/^https:.*\.livejournal\.com$/.test(srcOrigin) &&
117+
/^https:\/\/www\.livejournal\.com\/talkpost_do\.bml$/.test(destUrl)) {
151118
logEx("Livejournal comments exception");
152119
return true;
153120
}
154121

155-
if (srcOrigin == "https://ssl.rapidshare.com" &&
156-
xssReq.srcDomain == "rapidshare.com") {
157-
logEx("Rapidshare upload exception");
158-
return true;
159-
}
160-
161-
if (srcOrigin == "http://wm.letitbit.net" &&
162-
/^http:\/\/http\.letitbit\.net:81\/cgi-bin\/multi\/upload\.cgi\?/.test(destUrl) &&
163-
Legacy.getPref("filterXExceptions.letitibit")
164-
) {
165-
logEx("letitbit.net upload exception");
166-
return true;
167-
}
168-
169-
if (/\.deviantart\.com$/.test(srcOrigin) &&
170-
/^http:\/\/my\.deviantart\.com\/journal\/update\b/.test(destUrl) &&
171-
Legacy.getPref("filterXExceptions.deviantart")
172-
) {
173-
logEx("deviantart.com journal post exception");
174-
return true;
175-
}
176-
177-
if (srcOrigin == "https://www.mymedicare.gov" &&
178-
destOrigin == "https://myporal.medicare.gov" &&
179-
Legacy.getPref("filterXExceptions.medicare")
180-
) {
181-
logEx("mymedicare.gov exception");
182-
return true;
183-
}
184-
185-
if (/^https?:\/\/(?:draft|www)\.blogger\.com\/template-editor\.g\?/.test(srcUrl) &&
186-
/^https?:\/\/[\w\-]+\.blogspot\.com\/b\/preview\?/.test(destUrl) &&
187-
Legacy.getPref("filterXExceptions.blogspot")
122+
if (/^https:\/\/(?:draft|www)\.blogger\.com\/template-editor\.g\?/.test(srcUrl) &&
123+
/^https:\/\/[\w\-]+\.blogspot\.com\/b\/preview\?/.test(destUrl)
188124
) {
189125
logEx("blogspot.com template preview exception");
190126
return true;
191127
}
192-
193-
if (/^https?:\/\/www\.readability\.com\/articles\/queue$/.test(destUrl) &&
194-
Legacy.getPref("filterXExceptions.readability")) {
195-
logEx("Readability exception");
196-
return true;
197-
}
198-
199-
if (/^https?:\/\/pdf\.printfriendly\.com\/pdfs\/make$/.test(destUrl) &&
200-
Legacy.getPref("filterXExceptions.printfriendly")) {
201-
logEx("Printfriendly exception");
202-
return true;
203-
}
204128
}
205129
}
206130
},
@@ -235,11 +159,10 @@ XSS.Exceptions = (() => {
235159
/^https:\/\/[^\/]+\.googleusercontent\.com\/gadgets\/ifr\?/.test(destUrl) // Google gadgets
236160
)) {
237161
skipRx = /#[^#]+$/; // remove receiver's hash
238-
} else if (/^https?:\/\/apps\.facebook\.com\//.test(srcUrl) && Legacy.getPref("filterXExceptions.fbconnect")) {
162+
} else if (/^https?:\/\/apps\.facebook\.com\//.test(srcUrl)) {
239163
skipRx = /&invite_url=javascript[^&]+/; // Zynga stuff
240164
} else if (/^https?:\/\/l\.yimg\.com\/j\/static\/frame\?e=/.test(destUrl) &&
241-
/\.yahoo\.com$/.test(srcOrigin) &&
242-
Legacy.getPref("filterXExceptions.yahoo")) {
165+
/\.yahoo\.com$/.test(srcOrigin)) {
243166
skipParams = ['e'];
244167
} else if (/^https?:\/\/wpcomwidgets\.com\/\?/.test(destUrl)) {
245168
skipParams = ["_data"];

0 commit comments

Comments
 (0)