@@ -10,7 +10,7 @@ test("should throw an unsafe-import because the hexadecimal string is equal to t
1010 const str = "const foo = '68747470'" ;
1111 const ast = parseScript ( str ) ;
1212
13- const sastAnalysis = getSastAnalysis ( str , isLiteral ) ;
13+ const sastAnalysis = getSastAnalysis ( isLiteral ) ;
1414 const analyzeStringMock = t . mock . method ( sastAnalysis . sourceFile . deobfuscator , "analyzeString" ) ;
1515 sastAnalysis . execute ( ast . body ) ;
1616
@@ -28,7 +28,7 @@ test("should throw an encoded-literal warning because the hexadecimal value is e
2828 const str = "const _t = globalThis['72657175697265']" ;
2929 const ast = parseScript ( str ) ;
3030
31- const sastAnalysis = getSastAnalysis ( str , isLiteral ) ;
31+ const sastAnalysis = getSastAnalysis ( isLiteral ) ;
3232 const analyzeStringMock = t . mock . method ( sastAnalysis . sourceFile . deobfuscator , "analyzeString" ) ;
3333 sastAnalysis . execute ( ast . body ) ;
3434
@@ -44,7 +44,7 @@ test("should throw an encoded-literal warning because the hexadecimal value is e
4444test ( "should not throw an encoded-literal warning because hexadecimal value is safe" , ( ) => {
4545 const str = "const foo = '123456789'" ;
4646 const ast = parseScript ( str ) ;
47- const sastAnalysis = getSastAnalysis ( str , isLiteral )
47+ const sastAnalysis = getSastAnalysis ( isLiteral )
4848 . execute ( ast . body ) ;
4949
5050 assert . strictEqual ( sastAnalysis . warnings ( ) . length , 0 ) ;
@@ -54,7 +54,7 @@ test("should throw an encoded-literal warning because hexadecimal value is not s
5454 // Note: hexadecimal equal 'hello world'
5555 const str = "const foo = '68656c6c6f20776f726c64'" ;
5656 const ast = parseScript ( str ) ;
57- const sastAnalysis = getSastAnalysis ( str , isLiteral )
57+ const sastAnalysis = getSastAnalysis ( isLiteral )
5858 . execute ( ast . body ) ;
5959
6060 assert . strictEqual ( sastAnalysis . warnings ( ) . length , 1 ) ;
@@ -66,7 +66,7 @@ test("should not throw any warnings without hexadecimal value (and should call a
6666 const str = "const foo = 'hello world!'" ;
6767 const ast = parseScript ( str ) ;
6868
69- const sastAnalysis = getSastAnalysis ( str , isLiteral ) ;
69+ const sastAnalysis = getSastAnalysis ( isLiteral ) ;
7070 const analyzeLiteralMock = t . mock . method ( sastAnalysis . sourceFile , "analyzeLiteral" ) ;
7171 sastAnalysis . execute ( ast . body ) ;
7272
@@ -81,7 +81,7 @@ test("should not throw any warnings without hexadecimal value (and should call a
8181test ( "should detect shady link when an URL is bit.ly" , ( ) => {
8282 const str = "const foo = 'http://bit.ly/foo'" ;
8383 const ast = parseScript ( str ) ;
84- const sastAnalysis = getSastAnalysis ( str , isLiteral ) . execute ( ast . body ) ;
84+ const sastAnalysis = getSastAnalysis ( isLiteral ) . execute ( ast . body ) ;
8585
8686 assert . strictEqual ( sastAnalysis . warnings ( ) . length , 1 ) ;
8787 const warning = sastAnalysis . getWarning ( "shady-link" ) ;
@@ -91,7 +91,7 @@ test("should detect shady link when an URL is bit.ly", () => {
9191test ( "should detect shady link when an URL is ipinfo.io when protocol is http" , ( ) => {
9292 const str = "const foo = 'http://ipinfo.io/json'" ;
9393 const ast = parseScript ( str ) ;
94- const sastAnalysis = getSastAnalysis ( str , isLiteral ) . execute ( ast . body ) ;
94+ const sastAnalysis = getSastAnalysis ( isLiteral ) . execute ( ast . body ) ;
9595 assert . strictEqual ( sastAnalysis . warnings ( ) . length , 1 ) ;
9696 const warning = sastAnalysis . getWarning ( "shady-link" ) ;
9797 assert . strictEqual ( warning . value , "http://ipinfo.io/json" ) ;
@@ -100,7 +100,7 @@ test("should detect shady link when an URL is ipinfo.io when protocol is http",
100100test ( "should detect shady link when an URL is ipinfo.io when protocol is https" , ( ) => {
101101 const str = "const foo = 'https://ipinfo.io/json'" ;
102102 const ast = parseScript ( str ) ;
103- const sastAnalysis = getSastAnalysis ( str , isLiteral ) . execute ( ast . body ) ;
103+ const sastAnalysis = getSastAnalysis ( isLiteral ) . execute ( ast . body ) ;
104104 assert . strictEqual ( sastAnalysis . warnings ( ) . length , 1 ) ;
105105 const warning = sastAnalysis . getWarning ( "shady-link" ) ;
106106 assert . strictEqual ( warning . value , "https://ipinfo.io/json" ) ;
@@ -109,7 +109,7 @@ test("should detect shady link when an URL is ipinfo.io when protocol is https",
109109test ( "should detect shady link when an URL is httpbin.org when protocol is http" , ( ) => {
110110 const str = "const foo = 'http://httpbin.org/ip'" ;
111111 const ast = parseScript ( str ) ;
112- const sastAnalysis = getSastAnalysis ( str , isLiteral ) . execute ( ast . body ) ;
112+ const sastAnalysis = getSastAnalysis ( isLiteral ) . execute ( ast . body ) ;
113113 assert . strictEqual ( sastAnalysis . warnings ( ) . length , 1 ) ;
114114 const warning = sastAnalysis . getWarning ( "shady-link" ) ;
115115 assert . strictEqual ( warning . value , "http://httpbin.org/ip" ) ;
@@ -118,7 +118,7 @@ test("should detect shady link when an URL is httpbin.org when protocol is http"
118118test ( "should detect shady link when an URL is httpbin.org when protocol is https" , ( ) => {
119119 const str = "const foo = 'https://httpbin.org/ip'" ;
120120 const ast = parseScript ( str ) ;
121- const sastAnalysis = getSastAnalysis ( str , isLiteral ) . execute ( ast . body ) ;
121+ const sastAnalysis = getSastAnalysis ( isLiteral ) . execute ( ast . body ) ;
122122 assert . strictEqual ( sastAnalysis . warnings ( ) . length , 1 ) ;
123123 const warning = sastAnalysis . getWarning ( "shady-link" ) ;
124124 assert . strictEqual ( warning . value , "https://httpbin.org/ip" ) ;
@@ -127,7 +127,7 @@ test("should detect shady link when an URL is httpbin.org when protocol is https
127127test ( "should detect shady link when an URL has a suspicious domain" , ( ) => {
128128 const str = "const foo = 'http://foobar.link'" ;
129129 const ast = parseScript ( str ) ;
130- const sastAnalysis = getSastAnalysis ( str , isLiteral ) . execute ( ast . body ) ;
130+ const sastAnalysis = getSastAnalysis ( isLiteral ) . execute ( ast . body ) ;
131131
132132 assert . strictEqual ( sastAnalysis . warnings ( ) . length , 1 ) ;
133133 const warning = sastAnalysis . getWarning ( "shady-link" ) ;
@@ -137,23 +137,23 @@ test("should detect shady link when an URL has a suspicious domain", () => {
137137test ( "should not mark suspicious links the IPv4 address range 127.0.0.0/8 (localhost 127.0.0.1)" , ( ) => {
138138 const str = "const IPv4URL = ['http://127.0.0.1/script', 'http://127.7.7.7/script']" ;
139139 const ast = parseScript ( str ) ;
140- const sastAnalysis = getSastAnalysis ( str , isLiteral ) . execute ( ast . body ) ;
140+ const sastAnalysis = getSastAnalysis ( isLiteral ) . execute ( ast . body ) ;
141141
142142 assert . ok ( ! sastAnalysis . warnings ( ) . length ) ;
143143} ) ;
144144
145145test ( "should not be considered suspicious a link with a raw IPv4 address 127.0.0.1 and a port" , ( ) => {
146146 const str = "const IPv4URL = 'http://127.0.0.1:80/script'" ;
147147 const ast = parseScript ( str ) ;
148- const sastAnalysis = getSastAnalysis ( str , isLiteral ) . execute ( ast . body ) ;
148+ const sastAnalysis = getSastAnalysis ( isLiteral ) . execute ( ast . body ) ;
149149
150150 assert . ok ( ! sastAnalysis . warnings ( ) . length ) ;
151151} ) ;
152152
153153test ( "should detect the link as suspicious when a URL contains a raw IPv4 address" , ( ) => {
154154 const str = "const IPv4URL = 'http://77.244.210.247/burpcollaborator.txt'" ;
155155 const ast = parseScript ( str ) ;
156- const sastAnalysis = getSastAnalysis ( str , isLiteral ) . execute ( ast . body ) ;
156+ const sastAnalysis = getSastAnalysis ( isLiteral ) . execute ( ast . body ) ;
157157
158158 assert . strictEqual ( sastAnalysis . warnings ( ) . length , 1 ) ;
159159 const warning = sastAnalysis . getWarning ( "shady-link" ) ;
@@ -163,7 +163,7 @@ test("should detect the link as suspicious when a URL contains a raw IPv4 addres
163163test ( "should detect suspicious links when a URL contains a raw IPv4 address with port" , ( ) => {
164164 const str = "const IPv4URL = 'http://77.244.210.247:8080/script'" ;
165165 const ast = parseScript ( str ) ;
166- const sastAnalysis = getSastAnalysis ( str , isLiteral ) . execute ( ast . body ) ;
166+ const sastAnalysis = getSastAnalysis ( isLiteral ) . execute ( ast . body ) ;
167167
168168 assert . strictEqual ( sastAnalysis . warnings ( ) . length , 1 ) ;
169169 const warning = sastAnalysis . getWarning ( "shady-link" ) ;
@@ -173,7 +173,7 @@ test("should detect suspicious links when a URL contains a raw IPv4 address with
173173test ( "should detect suspicious links when a URL contains a raw IPv6 address" , ( ) => {
174174 const str = "const IPv6URL = 'http://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]/index.html'" ;
175175 const ast = parseScript ( str ) ;
176- const sastAnalysis = getSastAnalysis ( str , isLiteral ) . execute ( ast . body ) ;
176+ const sastAnalysis = getSastAnalysis ( isLiteral ) . execute ( ast . body ) ;
177177
178178 assert . strictEqual ( sastAnalysis . warnings ( ) . length , 1 ) ;
179179 const warning = sastAnalysis . getWarning ( "shady-link" ) ;
@@ -183,7 +183,7 @@ test("should detect suspicious links when a URL contains a raw IPv6 address", ()
183183test ( "should detect suspicious links when a URL contains a raw IPv6 address with port" , ( ) => {
184184 const str = "const IPv6URL = 'http://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:100/script'" ;
185185 const ast = parseScript ( str ) ;
186- const sastAnalysis = getSastAnalysis ( str , isLiteral ) . execute ( ast . body ) ;
186+ const sastAnalysis = getSastAnalysis ( isLiteral ) . execute ( ast . body ) ;
187187
188188 assert . strictEqual ( sastAnalysis . warnings ( ) . length , 1 ) ;
189189 const warning = sastAnalysis . getWarning ( "shady-link" ) ;
0 commit comments