mirror of
https://github.com/github/codeql.git
synced 2026-04-23 15:55:18 +02:00
Add tests for lastaflute framework
This commit is contained in:
27
java/ql/test/library-tests/frameworks/lastaflute/Test.java
Normal file
27
java/ql/test/library-tests/frameworks/lastaflute/Test.java
Normal file
@@ -0,0 +1,27 @@
|
||||
import java.io.IOException;
|
||||
|
||||
import org.lastaflute.web.Execute;
|
||||
import org.lastaflute.web.ruts.multipart.MultipartFormFile;
|
||||
|
||||
public class Test {
|
||||
|
||||
void sink(Object o) {
|
||||
}
|
||||
|
||||
public class TestForm {
|
||||
public MultipartFormFile file;
|
||||
}
|
||||
|
||||
@Execute
|
||||
public String index(TestForm form) throws IOException {
|
||||
MultipartFormFile file = form.file;
|
||||
|
||||
sink(file.getFileData()); // $hasTaintFlow
|
||||
sink(file.getInputStream()); // $hasTaintFlow
|
||||
|
||||
return "index.jsp";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
1
java/ql/test/library-tests/frameworks/lastaflute/options
Normal file
1
java/ql/test/library-tests/frameworks/lastaflute/options
Normal file
@@ -0,0 +1 @@
|
||||
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/lastaflute
|
||||
11
java/ql/test/library-tests/frameworks/lastaflute/test.ql
Normal file
11
java/ql/test/library-tests/frameworks/lastaflute/test.ql
Normal file
@@ -0,0 +1,11 @@
|
||||
import java
|
||||
import semmle.code.java.dataflow.FlowSources
|
||||
import TestUtilities.InlineFlowTest
|
||||
|
||||
module Config implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node n) { n instanceof RemoteFlowSource }
|
||||
|
||||
predicate isSink(DataFlow::Node n) { DefaultFlowConfig::isSink(n) }
|
||||
}
|
||||
|
||||
import TaintFlowTest<Config>
|
||||
5
java/ql/test/stubs/lastaflute/org/lastaflute/web/Execute.java
generated
Normal file
5
java/ql/test/stubs/lastaflute/org/lastaflute/web/Execute.java
generated
Normal file
@@ -0,0 +1,5 @@
|
||||
package org.lastaflute.web;
|
||||
|
||||
public @interface Execute {
|
||||
|
||||
}
|
||||
14
java/ql/test/stubs/lastaflute/org/lastaflute/web/ruts/multipart/MultipartFormFile.java
generated
Normal file
14
java/ql/test/stubs/lastaflute/org/lastaflute/web/ruts/multipart/MultipartFormFile.java
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
package org.lastaflute.web.ruts.multipart;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public interface MultipartFormFile {
|
||||
byte[] getFileData() throws IOException;
|
||||
|
||||
InputStream getInputStream() throws IOException;
|
||||
|
||||
String getFileName();
|
||||
|
||||
String getContentType();
|
||||
}
|
||||
Reference in New Issue
Block a user