@@ -911,7 +911,7 @@ private module Stdlib {
911911 private string pathlibPathMethodExport ( ) { result in [ "as_posix" , "as_uri" ] }
912912
913913 /**
914- * Flow for type presering mehtods .
914+ * Flow for mehtods that return a `pathlib.Path` object .
915915 */
916916 private predicate typePreservingCall ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo ) {
917917 exists ( DataFlow:: AttrRead returnsPath | returnsPath .getAttributeName ( ) = pathlibPathMethod ( ) |
@@ -921,7 +921,7 @@ private module Stdlib {
921921 }
922922
923923 /**
924- * Flow for type presering attributes .
924+ * Flow for attributes that are `pathlib.Path` objects .
925925 */
926926 private predicate typePreservingAttribute ( DataFlow:: Node nodeFrom , DataFlow:: Node nodeTo ) {
927927 exists ( DataFlow:: AttrRead isPath | isPath .getAttributeName ( ) = pathlibPathAttribute ( ) |
@@ -1018,32 +1018,22 @@ private module Stdlib {
10181018 // Type-preserving call
10191019 typePreservingCall ( nodeFrom , nodeTo )
10201020 or
1021- // Type-preserving attribute
1021+ // Type-preserving attribute access
10221022 typePreservingAttribute ( nodeFrom , nodeTo )
10231023 )
10241024 or
10251025 // Data injection
10261026 nodeTo .getALocalSource ( ) = pathlibPath ( ) and
10271027 (
10281028 // Special handling of the `/` operator
1029- exists ( BinaryExprNode slash , DataFlow:: Node pathOperand , DataFlow :: Node dataOperand |
1029+ exists ( BinaryExprNode slash , DataFlow:: Node pathOperand |
10301030 slash .getOp ( ) instanceof Div and
1031- (
1032- pathOperand .asCfgNode ( ) = slash .getLeft ( ) and
1033- dataOperand .asCfgNode ( ) = slash .getRight ( )
1034- or
1035- pathOperand .asCfgNode ( ) = slash .getRight ( ) and
1036- dataOperand .asCfgNode ( ) = slash .getLeft ( )
1037- ) and
1031+ pathOperand .asCfgNode ( ) = slash .getAnOperand ( ) and
10381032 pathOperand .getALocalSource ( ) = pathlibPath ( )
10391033 |
10401034 nodeTo .asCfgNode ( ) = slash and
1041- nodeFrom in [
1042- // type-preserving call
1043- pathOperand ,
1044- // data injection
1045- dataOperand
1046- ]
1035+ // Taint can flow either from the left or the right operand as long as one of them is a path.
1036+ nodeFrom .asCfgNode ( ) = slash .getAnOperand ( )
10471037 )
10481038 or
10491039 // standard case
0 commit comments