Java: Refactor LogInjection

This commit is contained in:
Anders Schack-Mulligen
2023-03-15 10:10:02 +01:00
parent e8a7139020
commit b14b95cd79
3 changed files with 26 additions and 11 deletions

View File

@@ -2,10 +2,6 @@ import java
import semmle.code.java.security.LogInjectionQuery
import TestUtilities.InlineFlowTest
class EnableLegacy extends EnableLegacyConfiguration {
EnableLegacy() { exists(this) }
}
private class TestSource extends RemoteFlowSource {
TestSource() { this.asExpr().(MethodAccess).getMethod().hasName("source") }
@@ -13,9 +9,9 @@ private class TestSource extends RemoteFlowSource {
}
private class LogInjectionTest extends InlineFlowTest {
override DataFlow::Configuration getValueFlowConfig() { none() }
override predicate hasValueFlow(DataFlow::Node src, DataFlow::Node sink) { none() }
override TaintTracking::Configuration getTaintFlowConfig() {
result instanceof LogInjectionConfiguration
override predicate hasTaintFlow(DataFlow::Node src, DataFlow::Node sink) {
LogInjectionFlow::hasFlow(src, sink)
}
}