File tree Expand file tree Collapse file tree 7 files changed +28
-132
lines changed
javascript/ql/src/experimental/Security/CWE-347-noVerification Expand file tree Collapse file tree 7 files changed +28
-132
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,18 @@ DataFlow::Node unverifiedDecode() {
12
12
.mayHaveStringValue ( "none" ) and
13
13
result = verify .getParameter ( 0 ) .asSink ( )
14
14
)
15
+ or
16
+ // jwt-simple
17
+ exists ( API:: Node n | n = API:: moduleImport ( "jwt-simple" ) .getMember ( "decode" ) |
18
+ n .getParameter ( 2 ) .asSink ( ) .asExpr ( ) = any ( BoolLiteral b | b .getBoolValue ( ) = true ) and
19
+ result = n .getParameter ( 0 ) .asSink ( )
20
+ )
21
+ or
22
+ // jwt-decode
23
+ result = API:: moduleImport ( "jwt-decode" ) .getParameter ( 0 ) .asSink ( )
24
+ or
25
+ //jose
26
+ result = API:: moduleImport ( "jose" ) .getMember ( "decodeJwt" ) .getParameter ( 0 ) .asSink ( )
15
27
}
16
28
17
29
DataFlow:: Node verifiedDecode ( ) {
@@ -27,4 +39,16 @@ DataFlow::Node verifiedDecode() {
27
39
) and
28
40
result = verify .getParameter ( 0 ) .asSink ( )
29
41
)
30
- }
42
+ or
43
+ // jwt-simple
44
+ exists ( API:: Node n | n = API:: moduleImport ( "jwt-simple" ) .getMember ( "decode" ) |
45
+ (
46
+ n .getParameter ( 2 ) .asSink ( ) .asExpr ( ) = any ( BoolLiteral b | b .getBoolValue ( ) = false ) or
47
+ not exists ( n .getParameter ( 2 ) )
48
+ ) and
49
+ result = n .getParameter ( 0 ) .asSink ( )
50
+ or
51
+ //jose
52
+ result = API:: moduleImport ( "jose" ) .getMember ( "jwtVerify" ) .getParameter ( 0 ) .asSink ( )
53
+ )
54
+ }
Original file line number Diff line number Diff line change 12
12
13
13
import javascript
14
14
import DataFlow:: PathGraph
15
- import jsonWebToken
15
+ import JWT
16
16
17
17
class Configuration extends TaintTracking:: Configuration {
18
18
Configuration ( ) { this = "jsonwebtoken without any signature verification" }
Original file line number Diff line number Diff line change 12
12
13
13
import javascript
14
14
import DataFlow:: PathGraph
15
- import jsonWebToken
15
+ import JWT
16
16
17
17
class Configuration extends TaintTracking:: Configuration {
18
18
Configuration ( ) { this = "jsonwebtoken without any signature verification" }
Original file line number Diff line number Diff line change 12
12
13
13
import javascript
14
14
import DataFlow:: PathGraph
15
- import jsonWebToken
15
+ import JWT
16
16
17
17
class ConfigurationUnverifiedDecode extends TaintTracking:: Configuration {
18
18
ConfigurationUnverifiedDecode ( ) { this = "jsonwebtoken without any signature verification" }
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments