@@ -57,73 +57,40 @@ module JwtAuth0 {
57
57
}
58
58
}
59
59
60
- module JwtDecodeConfig implements DataFlow:: StateConfigSig {
61
- class FlowState = DataFlow:: FlowState ;
62
-
63
- predicate isSource ( DataFlow:: Node source , FlowState state ) {
64
- (
65
- exists ( Variable v |
66
- source .asExpr ( ) = v .getInitializer ( ) and
67
- v .getType ( ) .hasName ( "String" )
68
- )
69
- or
70
- source instanceof RemoteFlowSource
71
- ) and
72
- not FlowToJwtVerify:: flow ( source , _) and
73
- state = "Auth0" and
74
- not state = "Auth0Verify"
60
+ module JwtDecodeConfig implements DataFlow:: ConfigSig {
61
+ predicate isSource ( DataFlow:: Node source ) {
62
+ source instanceof RemoteFlowSource and
63
+ not FlowToJwtVerify:: flow ( source , _)
75
64
}
76
65
77
- predicate isSink ( DataFlow:: Node sink , FlowState state ) {
78
- sink .asExpr ( ) = any ( JwtAuth0:: GetPayload a ) and
79
- state = "Auth0" and
80
- not state = "Auth0Verify"
81
- }
66
+ predicate isSink ( DataFlow:: Node sink ) { sink .asExpr ( ) = any ( JwtAuth0:: GetPayload a ) }
82
67
83
- predicate isAdditionalFlowStep (
84
- DataFlow:: Node nodeFrom , FlowState stateFrom , DataFlow:: Node nodeTo , FlowState stateTo
85
- ) {
68
+ predicate isAdditionalFlowStep ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo ) {
86
69
// Decode Should be one of the middle nodes
87
70
exists ( JwtAuth0:: Decode a |
88
71
nodeFrom .asExpr ( ) = a .getArgument ( 0 ) and
89
- nodeTo .asExpr ( ) = a and
90
- stateTo = "Auth0" and
91
- stateFrom = "Auth0"
72
+ nodeTo .asExpr ( ) = a
92
73
)
93
74
or
94
75
exists ( JwtAuth0:: Verify a |
95
76
nodeFrom .asExpr ( ) = a .getArgument ( 0 ) and
96
- nodeTo .asExpr ( ) = a and
97
- stateTo = "Auth0Verify" and
98
- stateFrom = "Auth0Verify"
77
+ nodeTo .asExpr ( ) = a
99
78
)
100
79
or
101
80
exists ( JwtAuth0:: GetPayload a |
102
81
nodeFrom .asExpr ( ) = a .getQualifier ( ) and
103
- nodeTo .asExpr ( ) = a and
104
- stateTo = "Auth0" and
105
- stateFrom = "Auth0"
82
+ nodeTo .asExpr ( ) = a
106
83
)
107
84
}
108
-
109
- predicate isBarrier ( DataFlow:: Node sanitizer , FlowState state ) { none ( ) }
110
85
}
111
86
112
87
module FlowToJwtVerifyConfig implements DataFlow:: ConfigSig {
113
- predicate isSource ( DataFlow:: Node source ) {
114
- // source instanceof DataFlow::Node
115
- exists ( Variable v |
116
- source .asExpr ( ) = v .getInitializer ( ) and
117
- v .getType ( ) .hasName ( "String" )
118
- )
119
- }
88
+ predicate isSource ( DataFlow:: Node source ) { source instanceof RemoteFlowSource }
120
89
121
90
predicate isSink ( DataFlow:: Node sink ) { sink .asExpr ( ) = any ( JwtAuth0:: Verify a ) .getArgument ( 0 ) }
122
-
123
- predicate isAdditionalFlowStep ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo ) { none ( ) }
124
91
}
125
92
126
- module JwtDecode = TaintTracking:: GlobalWithState < JwtDecodeConfig > ;
93
+ module JwtDecode = TaintTracking:: Global < JwtDecodeConfig > ;
127
94
128
95
module FlowToJwtVerify = TaintTracking:: Global< FlowToJwtVerifyConfig > ;
129
96
0 commit comments