diff --git a/java/ql/lib/semmle/code/java/environment/SystemProperty.qll b/java/ql/lib/semmle/code/java/environment/SystemProperty.qll index 4fe04db60abe7..60a19a00f77ef 100644 --- a/java/ql/lib/semmle/code/java/environment/SystemProperty.qll +++ b/java/ql/lib/semmle/code/java/environment/SystemProperty.qll @@ -1,3 +1,7 @@ +/** + * Provides classes and predicates for working with java system properties. + */ + import java private import semmle.code.java.dataflow.DataFlow private import semmle.code.java.frameworks.Properties diff --git a/java/ql/lib/semmle/code/java/frameworks/Properties.qll b/java/ql/lib/semmle/code/java/frameworks/Properties.qll index a98c9a88c36b1..35640c52edf17 100644 --- a/java/ql/lib/semmle/code/java/frameworks/Properties.qll +++ b/java/ql/lib/semmle/code/java/frameworks/Properties.qll @@ -2,10 +2,14 @@ import semmle.code.java.Type private import semmle.code.java.dataflow.FlowSteps +/** + * The `java.util.Properties` class. + */ class TypeProperty extends Class { TypeProperty() { hasQualifiedName("java.util", "Properties") } } +/** The `getProperty` method of the class `java.util.Properties`. */ class PropertiesGetPropertyMethod extends ValuePreservingMethod { PropertiesGetPropertyMethod() { getDeclaringType() instanceof TypeProperty and @@ -15,6 +19,7 @@ class PropertiesGetPropertyMethod extends ValuePreservingMethod { override predicate returnsValue(int arg) { arg = 1 } } +/** The `get` method of the class `java.util.Properties`. */ class PropertiesGetMethod extends Method { PropertiesGetMethod() { getDeclaringType() instanceof TypeProperty and @@ -22,6 +27,7 @@ class PropertiesGetMethod extends Method { } } +/** The `setProperty` method of the class `java.util.Properties`. */ class PropertiesSetPropertyMethod extends Method { PropertiesSetPropertyMethod() { getDeclaringType() instanceof TypeProperty and @@ -29,6 +35,9 @@ class PropertiesSetPropertyMethod extends Method { } } +/** + * The methods of the class `java.util.Properties` that write the contents to an output. + */ class PropertiesStoreMethod extends Method { PropertiesStoreMethod() { getDeclaringType() instanceof TypeProperty and diff --git a/java/ql/src/Security/CWE/CWE-200/TempDirLocalInformationDisclosure.ql b/java/ql/src/Security/CWE/CWE-200/TempDirLocalInformationDisclosure.ql index 3e94d3222191b..5992ca11fd4af 100644 --- a/java/ql/src/Security/CWE/CWE-200/TempDirLocalInformationDisclosure.ql +++ b/java/ql/src/Security/CWE/CWE-200/TempDirLocalInformationDisclosure.ql @@ -177,9 +177,7 @@ private class TempDirSystemGetPropertyDirectlyToMkdirConfig extends TaintTrackin } override predicate isSource(DataFlow::Node node) { - exists( - ExprSystemGetPropertyTempDirTainted propertyGetExpr, DataFlow::Node callSite - | + exists(ExprSystemGetPropertyTempDirTainted propertyGetExpr, DataFlow::Node callSite | DataFlow::localFlow(DataFlow::exprNode(propertyGetExpr), callSite) | isFileConstructorArgument(callSite.asExpr(), node.asExpr(), 1) diff --git a/java/ql/test/library-tests/os/specific-unix-variant-test.ql b/java/ql/test/library-tests/os/specific-unix-variant-test.ql index 6f975ecc0ff87..9343f3c6ad224 100644 --- a/java/ql/test/library-tests/os/specific-unix-variant-test.ql +++ b/java/ql/test/library-tests/os/specific-unix-variant-test.ql @@ -2,4 +2,4 @@ import default import semmle.code.java.os.OSCheck from IsSpecificUnixVariant isAnyUnix -select isAnyUnix \ No newline at end of file +select isAnyUnix diff --git a/java/ql/test/library-tests/os/specific-windows-variant-test.ql b/java/ql/test/library-tests/os/specific-windows-variant-test.ql index 11371db55b4b0..fed895e389afa 100644 --- a/java/ql/test/library-tests/os/specific-windows-variant-test.ql +++ b/java/ql/test/library-tests/os/specific-windows-variant-test.ql @@ -2,4 +2,4 @@ import default import semmle.code.java.os.OSCheck from IsSpecificWindowsVariant isAnyWindows -select isAnyWindows \ No newline at end of file +select isAnyWindows diff --git a/java/ql/test/library-tests/os/unix-test.ql b/java/ql/test/library-tests/os/unix-test.ql index b2b48d2df7e6f..83f0bc01ccf36 100644 --- a/java/ql/test/library-tests/os/unix-test.ql +++ b/java/ql/test/library-tests/os/unix-test.ql @@ -2,4 +2,4 @@ import default import semmle.code.java.os.OSCheck from IsUnixGuard isUnix -select isUnix \ No newline at end of file +select isUnix diff --git a/java/ql/test/library-tests/os/windows-test.ql b/java/ql/test/library-tests/os/windows-test.ql index 4027d6da8a1e1..17481a186c365 100644 --- a/java/ql/test/library-tests/os/windows-test.ql +++ b/java/ql/test/library-tests/os/windows-test.ql @@ -2,4 +2,4 @@ import default import semmle.code.java.os.OSCheck from IsWindowsGuard isWindows -select isWindows \ No newline at end of file +select isWindows