io.codemodder.codemods.sanitize-apache-multipart-filename.yaml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core-codemods Show documentation
Show all versions of core-codemods Show documentation
Codemods for fixing common errors across many Java projects
rules:
- id: sanitize-apache-multipart-filename
mode: taint
metadata:
options:
symbolic_propagation: true
pattern-sources:
- pattern: (org.apache.commons.fileupload.FileItem $X).getName()
- pattern: (FileItem $X).getName()
pattern-sanitizers:
- pattern-either:
- pattern: Filenames.toSimpleFileName(...)
pattern-sinks:
- patterns:
- pattern-either:
- pattern: |
new $F(...,<... $SINK ...>)
- pattern: |
$F(<... $SINK ...>)
- pattern: |
return $SINK;
message: Semgrep found a match
languages:
- java
severity: WARNING