File tree Expand file tree Collapse file tree 2 files changed +7
-16
lines changed
javascript/ql/src/experimental/Security/CWE-340
python/ql/src/experimental/Security/CWE-340 Expand file tree Collapse file tree 2 files changed +7
-16
lines changed Original file line number Diff line number Diff line change @@ -28,17 +28,12 @@ class PredictableResultSource extends DataFlow::Node {
28
28
29
29
class TokenAssignmentValueSink extends DataFlow:: Node {
30
30
TokenAssignmentValueSink ( ) {
31
- exists ( PropWrite pw | this = pw .getRhs ( ) |
32
- pw .getPropertyName ( ) .toLowerCase ( ) .matches ( [ "%token" , "%code" ] )
33
- )
31
+ exists ( string name | name .toLowerCase ( ) .matches ( [ "%token" , "%code" ] ) |
32
+ exists ( PropWrite pw | this = pw .getRhs ( ) | pw .getPropertyName ( ) .toLowerCase ( ) = name )
34
33
or
35
34
exists ( AssignExpr ae | this = ae .getRhs ( ) .flow ( ) |
36
- ae .getLhs ( )
37
- .( VariableAccess )
38
- .getVariable ( )
39
- .getName ( )
40
- .toLowerCase ( )
41
- .matches ( [ "%token" , "%code" ] )
35
+ ae .getLhs ( ) .( VariableAccess ) .getVariable ( ) .getName ( ) .toLowerCase ( ) = name
36
+ )
42
37
)
43
38
}
44
39
}
Original file line number Diff line number Diff line change @@ -34,14 +34,10 @@ class PredictableResultSource extends DataFlow::Node {
34
34
35
35
class TokenAssignmentValueSink extends DataFlow:: Node {
36
36
TokenAssignmentValueSink ( ) {
37
- exists ( Assign a , Expr target | this = DataFlow:: exprNode ( a .getValue ( ) ) |
38
- target = a .getATarget ( ) and
39
- ( target instanceof Attribute or target instanceof Name ) and
40
- (
41
- target .( Attribute ) .getName ( ) .toLowerCase ( ) .matches ( [ "%token" , "%code" ] )
37
+ exists ( string name | name .toLowerCase ( ) .matches ( [ "%token" , "%code" ] ) |
38
+ exists ( DefinitionNode n | n .getValue ( ) = this .asCfgNode ( ) | name = n .( NameNode ) .getId ( ) )
42
39
or
43
- target .( Name ) .getId ( ) .toLowerCase ( ) .matches ( [ "%token" , "%code" ] )
44
- )
40
+ exists ( DataFlow:: AttrWrite aw | aw .getValue ( ) = this | name = aw .getAttributeName ( ) )
45
41
)
46
42
}
47
43
}
You can’t perform that action at this time.
0 commit comments