@@ -70,19 +70,6 @@ module TaintedPath {
7070 }
7171 }
7272
73- /**
74- * A call to `filepath.Rel`, considered as a sanitizer for path traversal.
75- */
76- class FilepathRelSanitizer extends Sanitizer {
77- FilepathRelSanitizer ( ) {
78- exists ( Function f , FunctionOutput outp |
79- f .hasQualifiedName ( "path/filepath" , "Rel" ) and
80- outp .isResult ( 0 ) and
81- this = outp .getNode ( f .getACall ( ) )
82- )
83- }
84- }
85-
8673 /**
8774 * A call to `filepath.Clean("/" + e)`, considered to sanitize `e` against path traversal.
8875 */
@@ -116,44 +103,6 @@ module TaintedPath {
116103 }
117104 }
118105
119- /**
120- * A read from the field `Filename` of the type `mime/multipart.FileHeader`,
121- * considered as a sanitizer for path traversal.
122- *
123- * The only way to create a `mime/multipart.FileHeader` is to create a
124- * `mime/multipart.Form`, which creates the `Filename` field of each
125- * `mime/multipart.FileHeader` by calling `Part.FileName`, which calls
126- * `path/filepath.Base` on its return value. In general `path/filepath.Base`
127- * is not a sanitizer for path traversal, but in this specific case where the
128- * output is going to be used as a filename rather than a directory name, it
129- * is adequate.
130- */
131- class MimeMultipartFileHeaderFilenameSanitizer extends Sanitizer {
132- MimeMultipartFileHeaderFilenameSanitizer ( ) {
133- this .( DataFlow:: FieldReadNode )
134- .getField ( )
135- .hasQualifiedName ( "mime/multipart" , "FileHeader" , "Filename" )
136- }
137- }
138-
139- /**
140- * A call to `mime/multipart.Part.FileName`, considered as a sanitizer
141- * against path traversal.
142- *
143- * `Part.FileName` calls `path/filepath.Base` on its return value. In
144- * general `path/filepath.Base` is not a sanitizer for path traversal, but in
145- * this specific case where the output is going to be used as a filename
146- * rather than a directory name, it is adequate.
147- */
148- class MimeMultipartPartFileNameSanitizer extends Sanitizer {
149- MimeMultipartPartFileNameSanitizer ( ) {
150- this =
151- any ( Method m | m .hasQualifiedName ( "mime/multipart" , "Part" , "FileName" ) )
152- .getACall ( )
153- .getResult ( )
154- }
155- }
156-
157106 /**
158107 * A check of the form `!strings.Contains(nd, "..")`, considered as a sanitizer guard for
159108 * path traversal.
0 commit comments