2323XSS . Exceptions = ( ( ) => {
2424
2525 var Exceptions = {
26- get legacyExceptions ( ) {
27- delete this . legacyExceptions ;
28- this . legacyExceptions =
29- Legacy . getRxPref ( "filterXExceptions" ,
30- Legacy . RX . multi , "g" , / ^ h t t p s ? : [ 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 ( / ^ h t t p s ? : \/ \/ m s d n \. m i c r o s o f t \. c o m \/ q u e r y \/ [ ^ < ] + $ / . 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- / ^ h t t p s : \/ \/ (?: p l u s \. g o o g l e a p i s | a p i s \. g o o g l e ) \. c o m \/ [ \w / ] + \/ w i d g e t \/ r e n d e r \/ c o m m e n t s \? / . test ( destUrl ) &&
97- Legacy . getPref ( "filterXExceptions.yt_comments" )
98- ) {
79+ / ^ h t t p s : \/ \/ (?: p l u s \. g o o g l e a p i s | a p i s \. g o o g l e ) \. c o m \/ [ \w / ] + \/ w i d g e t \/ r e n d e r \/ c o m m e n t s \? / . 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" && / ^ h t t p s : \/ \/ .* \. t w i t t e r \. c o m $ / . test ( destOrigin ) ) {
86+ if ( / ^ h t t p s : \/ \/ (?: t w i t t e r | x ) .c o m $ / . test ( srcOrigin ) &&
87+ / ^ h t t p s : \/ \/ .* \. (?: t w i t t e r | x ) \. c o m $ / . test ( destOrigin ) ) {
11088 return true ;
11189 }
11290
@@ -119,88 +97,34 @@ XSS.Exceptions = (() => {
11997
12098 if ( / ^ h t t p s ? : \/ \/ c s r \. e b a y \. (?: \w { 2 , 3 } | c o \. u k ) \/ c s e \/ s t a r t \. j s f $ / . test ( srcUrl ) &&
12199 / ^ h t t p s ? : \/ \/ m s a - l f n \. e b a y \. (?: \w { 2 , 3 } | c o \. u k ) \/ w s \/ e B a y I S A P I \. d l l \? [ ^ < ' " % ] * $ / . 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 ( / ^ h t t p s : \/ \/ (?: c a p \. s e c u r e c o d e \. c o m | w w w \. s e c u r e s u i t e \. n e t | (?: .* ?\. ) ? f i r s t d a t a \. (?: l [ t v ] | c o m ) ) $ / . test ( srcUrl ) &&
129- Legacy . getPref ( "filterXException.visa" ) ) {
105+ if ( / ^ h t t p s : \/ \/ (?: c a p \. s e c u r e c o d e \. c o m | w w w \. s e c u r e s u i t e \. n e t | (?: .* ?\. ) ? f i r s t d a t a \. c o m ) $ / . test ( srcUrl ) ) {
130106 logEx ( "Verified by Visa exception" ) ;
131107 return true ;
132108 }
133109
134- if ( / \. v e r i z o n \. c o m $ / . test ( srcOrigin ) &&
135- / ^ h t t p s : \/ \/ s i g n i n \. v e r i z o n \. c o m \/ s s o \/ a u t h s s o \/ f o r u m L o g i n \. j s p $ / . test ( destUrl ) &&
136- Legacy . getPref ( "filterXExceptions.verizon" ) ) {
137- logEx ( "Verizon login exception" ) ;
138- return true ;
139- }
140-
141110 if ( / ^ h t t p s ? : \/ \/ m a i l \. l y c o s \. c o m \/ l y c o s \/ m a i l \/ M a i l C o m p o s e \. l y c o s $ / . test ( srcUrl ) &&
142- / \. l y c o s m a i l \. l y c o s \. c o m $ / . test ( destOrigin ) &&
143- Legacy . getPref ( "filterXExceptions.lycosmail" ) ) {
111+ / \. l y c o s m a i l \. l y c o s \. c o m $ / . test ( destOrigin ) ) {
144112 logEx ( "Lycos Mail exception" ) ;
145113 return true ;
146114 }
147115
148- if ( / \. l i v e j o u r n a l \. c o m $ / . test ( srcOrigin ) &&
149- / ^ h t t p s ? : \/ \/ w w w \. l i v e j o u r n a l \. c o m \/ t a l k p o s t _ d o \. b m l $ / . test ( destUrl ) &&
150- Legacy . getPref ( "filterXExceptions.livejournal" ) ) {
116+ if ( / ^ h t t p s : .* \. l i v e j o u r n a l \. c o m $ / . test ( srcOrigin ) &&
117+ / ^ h t t p s : \/ \/ w w w \. l i v e j o u r n a l \. c o m \/ t a l k p o s t _ d o \. b m l $ / . 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- / ^ h t t p : \/ \/ h t t p \. l e t i t b i t \. n e t : 8 1 \/ c g i - b i n \/ m u l t i \/ u p l o a d \. c g i \? / . test ( destUrl ) &&
163- Legacy . getPref ( "filterXExceptions.letitibit" )
164- ) {
165- logEx ( "letitbit.net upload exception" ) ;
166- return true ;
167- }
168-
169- if ( / \. d e v i a n t a r t \. c o m $ / . test ( srcOrigin ) &&
170- / ^ h t t p : \/ \/ m y \. d e v i a n t a r t \. c o m \/ j o u r n a l \/ u p d a t e \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 ( / ^ h t t p s ? : \/ \/ (?: d r a f t | w w w ) \. b l o g g e r \. c o m \/ t e m p l a t e - e d i t o r \. g \? / . test ( srcUrl ) &&
186- / ^ h t t p s ? : \/ \/ [ \w \- ] + \. b l o g s p o t \. c o m \/ b \/ p r e v i e w \? / . test ( destUrl ) &&
187- Legacy . getPref ( "filterXExceptions.blogspot" )
122+ if ( / ^ h t t p s : \/ \/ (?: d r a f t | w w w ) \. b l o g g e r \. c o m \/ t e m p l a t e - e d i t o r \. g \? / . test ( srcUrl ) &&
123+ / ^ h t t p s : \/ \/ [ \w \- ] + \. b l o g s p o t \. c o m \/ b \/ p r e v i e w \? / . test ( destUrl )
188124 ) {
189125 logEx ( "blogspot.com template preview exception" ) ;
190126 return true ;
191127 }
192-
193- if ( / ^ h t t p s ? : \/ \/ w w w \. r e a d a b i l i t y \. c o m \/ a r t i c l e s \/ q u e u e $ / . test ( destUrl ) &&
194- Legacy . getPref ( "filterXExceptions.readability" ) ) {
195- logEx ( "Readability exception" ) ;
196- return true ;
197- }
198-
199- if ( / ^ h t t p s ? : \/ \/ p d f \. p r i n t f r i e n d l y \. c o m \/ p d f s \/ m a k e $ / . 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 / ^ h t t p s : \/ \/ [ ^ \/ ] + \. g o o g l e u s e r c o n t e n t \. c o m \/ g a d g e t s \/ i f r \? / . test ( destUrl ) // Google gadgets
236160 ) ) {
237161 skipRx = / # [ ^ # ] + $ / ; // remove receiver's hash
238- } else if ( / ^ h t t p s ? : \/ \/ a p p s \. f a c e b o o k \. c o m \/ / . test ( srcUrl ) && Legacy . getPref ( "filterXExceptions.fbconnect" ) ) {
162+ } else if ( / ^ h t t p s ? : \/ \/ a p p s \. f a c e b o o k \. c o m \/ / . test ( srcUrl ) ) {
239163 skipRx = / & i n v i t e _ u r l = j a v a s c r i p t [ ^ & ] + / ; // Zynga stuff
240164 } else if ( / ^ h t t p s ? : \/ \/ l \. y i m g \. c o m \/ j \/ s t a t i c \/ f r a m e \? e = / . test ( destUrl ) &&
241- / \. y a h o o \. c o m $ / . test ( srcOrigin ) &&
242- Legacy . getPref ( "filterXExceptions.yahoo" ) ) {
165+ / \. y a h o o \. c o m $ / . test ( srcOrigin ) ) {
243166 skipParams = [ 'e' ] ;
244167 } else if ( / ^ h t t p s ? : \/ \/ w p c o m w i d g e t s \. c o m \/ \? / . test ( destUrl ) ) {
245168 skipParams = [ "_data" ] ;
0 commit comments