Skip to content

Commit 62944ee

Browse files
committed
Add tests for lastaflute framework
1 parent 3bd3304 commit 62944ee

File tree

6 files changed

+58
-0
lines changed

6 files changed

+58
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import java.io.IOException;
2+
3+
import org.lastaflute.web.Execute;
4+
import org.lastaflute.web.ruts.multipart.MultipartFormFile;
5+
6+
public class Test {
7+
8+
void sink(Object o) {
9+
}
10+
11+
public class TestForm {
12+
public MultipartFormFile file;
13+
}
14+
15+
@Execute
16+
public String index(TestForm form) throws IOException {
17+
MultipartFormFile file = form.file;
18+
19+
sink(file.getFileData()); // $hasTaintFlow
20+
sink(file.getInputStream()); // $hasTaintFlow
21+
22+
return "index.jsp";
23+
}
24+
25+
}
26+
27+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/lastaflute

java/ql/test/library-tests/frameworks/lastaflute/test.expected

Whitespace-only changes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import java
2+
import semmle.code.java.dataflow.FlowSources
3+
import TestUtilities.InlineFlowTest
4+
5+
module Config implements DataFlow::ConfigSig {
6+
predicate isSource(DataFlow::Node n) { n instanceof RemoteFlowSource }
7+
8+
predicate isSink(DataFlow::Node n) { DefaultFlowConfig::isSink(n) }
9+
}
10+
11+
import TaintFlowTest<Config>

java/ql/test/stubs/lastaflute/org/lastaflute/web/Execute.java

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/ql/test/stubs/lastaflute/org/lastaflute/web/ruts/multipart/MultipartFormFile.java

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)