@@ -57,73 +57,40 @@ module JwtAuth0 {
5757 }
5858}
5959
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 , _)
7564 }
7665
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 ) }
8267
83- predicate isAdditionalFlowStep (
84- DataFlow:: Node nodeFrom , FlowState stateFrom , DataFlow:: Node nodeTo , FlowState stateTo
85- ) {
68+ predicate isAdditionalFlowStep ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo ) {
8669 // Decode Should be one of the middle nodes
8770 exists ( JwtAuth0:: Decode a |
8871 nodeFrom .asExpr ( ) = a .getArgument ( 0 ) and
89- nodeTo .asExpr ( ) = a and
90- stateTo = "Auth0" and
91- stateFrom = "Auth0"
72+ nodeTo .asExpr ( ) = a
9273 )
9374 or
9475 exists ( JwtAuth0:: Verify a |
9576 nodeFrom .asExpr ( ) = a .getArgument ( 0 ) and
96- nodeTo .asExpr ( ) = a and
97- stateTo = "Auth0Verify" and
98- stateFrom = "Auth0Verify"
77+ nodeTo .asExpr ( ) = a
9978 )
10079 or
10180 exists ( JwtAuth0:: GetPayload a |
10281 nodeFrom .asExpr ( ) = a .getQualifier ( ) and
103- nodeTo .asExpr ( ) = a and
104- stateTo = "Auth0" and
105- stateFrom = "Auth0"
82+ nodeTo .asExpr ( ) = a
10683 )
10784 }
108-
109- predicate isBarrier ( DataFlow:: Node sanitizer , FlowState state ) { none ( ) }
11085}
11186
11287module 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 }
12089
12190 predicate isSink ( DataFlow:: Node sink ) { sink .asExpr ( ) = any ( JwtAuth0:: Verify a ) .getArgument ( 0 ) }
122-
123- predicate isAdditionalFlowStep ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo ) { none ( ) }
12491}
12592
126- module JwtDecode = TaintTracking:: GlobalWithState < JwtDecodeConfig > ;
93+ module JwtDecode = TaintTracking:: Global < JwtDecodeConfig > ;
12794
12895module FlowToJwtVerify = TaintTracking:: Global< FlowToJwtVerifyConfig > ;
12996
0 commit comments