File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
lib/semmle/javascript/security
test/query-tests/Security/CWE-798 Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -213,6 +213,9 @@ module PasswordHeuristics {
213
213
normalized
214
214
.regexpMatch ( ".*(pass|test|sample|example|secret|root|admin|user|change|auth|fake|(my(token|password))|string|foo|bar|baz|qux|1234|3141|abcd).*" )
215
215
)
216
+ or
217
+ // repeats the same char more than 10 times
218
+ password .regexpMatch ( ".*([a-zA-Z0-9])\\1{10,}.*" )
216
219
}
217
220
218
221
/**
Original file line number Diff line number Diff line change 284
284
require ( "http" ) . request ( { auth : "user:fake token" } ) // OK
285
285
require ( "http" ) . request ( { auth : "user:dcba" } ) // OK
286
286
require ( "http" ) . request ( { auth : "user:custom string" } ) // OK
287
- } ) ;
287
+ } ) ;
288
+
289
+ ( function ( ) {
290
+ // browser API
291
+ var headers = new Headers ( ) ;
292
+ headers . append ( "Authorization" , `Basic sdsdag:sdsdag` ) ; // NOT OK
293
+ headers . append ( "Authorization" , `Basic sdsdag:xxxxxxxxxxxxxx` ) ; // OK
294
+ headers . append ( "Authorization" , `Basic sdsdag:aaaiuogrweuibgbbbbb` ) ; // NOT OK
295
+ headers . append ( "Authorization" , `Basic sdsdag:000000000000001` ) ; // OK
296
+ } ) ;
You can’t perform that action at this time.
0 commit comments