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 {
2828
2929class TokenAssignmentValueSink extends DataFlow:: Node {
3030 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 )
3433 or
3534 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+ )
4237 )
4338 }
4439}
Original file line number Diff line number Diff line change @@ -34,14 +34,10 @@ class PredictableResultSource extends DataFlow::Node {
3434
3535class TokenAssignmentValueSink extends DataFlow:: Node {
3636 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 ( ) )
4239 or
43- target .( Name ) .getId ( ) .toLowerCase ( ) .matches ( [ "%token" , "%code" ] )
44- )
40+ exists ( DataFlow:: AttrWrite aw | aw .getValue ( ) = this | name = aw .getAttributeName ( ) )
4541 )
4642 }
4743}
You can’t perform that action at this time.
0 commit comments