Skip to content

Commit

Permalink
Add tests for lastaflute framework
Browse files Browse the repository at this point in the history
  • Loading branch information
egregius313 committed Jul 16, 2024
1 parent 3a97b9b commit 80af38e
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 deletions.
27 changes: 27 additions & 0 deletions java/ql/test/library-tests/frameworks/lastaflute/Test.java
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions java/ql/test/library-tests/frameworks/lastaflute/options
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/lastaflute
Empty file.
12 changes: 12 additions & 0 deletions java/ql/test/library-tests/frameworks/lastaflute/test.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import java
import semmle.code.java.dataflow.DataFlow
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 changes: 5 additions & 0 deletions java/ql/test/stubs/lastaflute/org/lastaflute/web/Execute.java

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.

0 comments on commit 80af38e

Please sign in to comment.