Skip to content

Commit

Permalink
Finished up
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwstubbs committed Sep 27, 2024
1 parent 1b5299d commit f056045
Show file tree
Hide file tree
Showing 48 changed files with 1,018 additions and 17 deletions.
16 changes: 8 additions & 8 deletions java/ql/lib/ext/jakarta.servlet.http.model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ extensions:
pack: codeql/java-all
extensible: sourceModel
data:
- ["jakarta.servlet.http", "HttpServletRequest", True, "getServletPath", "", "", "ReturnValue", "remote", "manual"]
- ["jakarta.servlet.http", "Part", True, "getInputStream", "", "()", "ReturnValue", "remote", "manual"]
- ["jakarta.servlet.http", "Part", True, "getName", "", "()", "ReturnValue", "remote", "manual"]
- ["jakarta.servlet.http", "Part", True, "getContentType", "", "()", "ReturnValue", "remote", "manual"]
- ["jakarta.servlet.http", "Part", True, "getHeader", "", "(String)", "ReturnValue", "remote", "manual"]
- ["jakarta.servlet.http", "Part", True, "getHeaders", "", "(String)", "ReturnValue", "remote", "manual"]
- ["jakarta.servlet.http", "Part", True, "getHeaderNames", "", "()", "ReturnValue", "remote", "manual"]
- ["jakarta.servlet.http", "Part", True, "getSubmittedFileName", "", "()", "ReturnValue", "remote", "manual"]
- ["jakarta.servlet.http", "HttpServletRequest", True, "getServletPath", "()", "", "ReturnValue", "remote", "manual"]
- ["jakarta.servlet.http", "Part", True, "getInputStream", "()", "", "ReturnValue", "remote", "manual"]
- ["jakarta.servlet.http", "Part", True, "getName", "()", "", "ReturnValue", "remote", "manual"]
- ["jakarta.servlet.http", "Part", True, "getContentType", "()", "", "ReturnValue", "remote", "manual"]
- ["jakarta.servlet.http", "Part", True, "getHeader", "(String)", "", "ReturnValue", "remote", "manual"]
- ["jakarta.servlet.http", "Part", True, "getHeaders", "(String)", "", "ReturnValue", "remote", "manual"]
- ["jakarta.servlet.http", "Part", True, "getHeaderNames", "()", "", "ReturnValue", "remote", "manual"]
- ["jakarta.servlet.http", "Part", True, "getSubmittedFileName", "()", "", "ReturnValue", "remote", "manual"]
2 changes: 1 addition & 1 deletion java/ql/lib/ext/org.apache.commons.fileupload.model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extensions:
- ["org.apache.commons.fileupload", "FileItem", True, "getInputStream", "()", "", "ReturnValue", "remote", "manual"]
- ["org.apache.commons.fileupload", "FileItem", True, "getFieldName", "()", "", "ReturnValue", "remote", "manual"]
- ["org.apache.commons.fileupload", "FileItem", True, "getContentType", "()", "", "ReturnValue", "remote", "manual"]
- ["org.apache.commons.fileupload", "FileItem", False, "getString", "()", "", "ReturnValue", "remote", "manual"]
- ["org.apache.commons.fileupload", "FileItem", True, "getString", "()", "", "ReturnValue", "remote", "manual"]
- ["org.apache.commons.fileupload", "FileItem", True, "getName", "()", "", "ReturnValue", "remote", "manual"]
- ["org.apache.commons.fileupload", "FileItem", True, "getName", "(String)", "", "ReturnValue", "remote", "manual"]
- ["org.apache.commons.fileupload", "FileItem", True, "get", "()", "", "ReturnValue", "remote", "manual"]
Expand Down
21 changes: 14 additions & 7 deletions java/ql/test/library-tests/dataflow/taintsources/FileUpload.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemStream;


public class FileUpload {

private HttpServletRequest request;
private HttpServletResponse response;
private Part filePart;
private javax.servlet.http.Part filePart;
private FileItem fileItem;
private FileItemStream fileItemStream;
private jakarta.servlet.http.Part jakartaPart;

private static void sink(Object o) {}

Expand All @@ -29,11 +30,17 @@ public void test() throws Exception {
sink(fileItem.getContentType()); // $ hasRemoteValueFlow
sink(fileItem.getName()); // $ hasRemoteValueFlow

//These result in a compiler error when uncommented
//sink(fileItemStream) // $ hasRemoteValueFlow
//sink(fileItemStream.getFieldName()) // $ hasRemoteValueFlow
//sink(fileItemStream.getName()) // $ hasRemoteValueFlow
//sink(fileItemStream.openStream()) // $ hasRemoteValueFlow
sink(fileItemStream.getFieldName()); // $ hasRemoteValueFlow
sink(fileItemStream.getName()); // $ hasRemoteValueFlow
sink(fileItemStream.openStream()); // $ hasRemoteValueFlow

sink(jakartaPart.getContentType()); // $ hasRemoteValueFlow
sink(jakartaPart.getHeader("test")); // $ hasRemoteValueFlow
sink(jakartaPart.getInputStream()); // $ hasRemoteValueFlow
sink(jakartaPart.getHeaders("test")); // $ hasRemoteValueFlow
sink(jakartaPart.getHeaderNames()); // $ hasRemoteValueFlow
sink(jakartaPart.getSubmittedFileName()); // $ hasRemoteValueFlow
sink(jakartaPart.getName()); // $ hasRemoteValueFlow

}
}
2 changes: 1 addition & 1 deletion java/ql/test/library-tests/dataflow/taintsources/options
Original file line number Diff line number Diff line change
@@ -1 +1 @@
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/apache-commons-fileupload-1.4:${testdir}/../../../stubs/javax-servlet-2.5:${testdir}/../../../stubs/servlet-api-2.4:${testdir}/../../../stubs/springframework-5.3.8:${testdir}/../../../stubs/google-android-9.0.0:${testdir}/../../../stubs/playframework-2.6.x:${testdir}/../../../stubs/jackson-databind-2.12:${testdir}/../../../stubs/jackson-core-2.12:${testdir}/../../../stubs/akka-2.6.x:${testdir}/../../../stubs/jwtk-jjwt-0.11.2:${testdir}/../../../stubs/jenkins:${testdir}/../../../stubs/stapler-1.263
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/jakarta.servlet-api-6.0.0:${testdir}/../../../stubs/apache-commons-fileupload-1.4:${testdir}/../../../stubs/javax-servlet-2.5:${testdir}/../../../stubs/servlet-api-2.4:${testdir}/../../../stubs/springframework-5.3.8:${testdir}/../../../stubs/google-android-9.0.0:${testdir}/../../../stubs/playframework-2.6.x:${testdir}/../../../stubs/jackson-databind-2.12:${testdir}/../../../stubs/jackson-core-2.12:${testdir}/../../../stubs/akka-2.6.x:${testdir}/../../../stubs/jwtk-jjwt-0.11.2:${testdir}/../../../stubs/jenkins:${testdir}/../../../stubs/stapler-1.263

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f056045

Please sign in to comment.