Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
cd073a2
Java: Add Guard Classes for checking OS
JLLeitschuh Feb 14, 2022
39828fd
Apply OS guard checks to TempDirLocalInformationDisclosure
JLLeitschuh Feb 14, 2022
3cdfc00
Cleanup from review feedback
JLLeitschuh Feb 15, 2022
4951344
Update java/ql/lib/semmle/code/java/os/OSCheck.qll
JLLeitschuh Feb 23, 2022
9f5022e
Review fixup and add test for apache SystemUtils
JLLeitschuh Feb 23, 2022
fd63107
Update OS Check from Review Feedback
JLLeitschuh Mar 1, 2022
5913c9a
Refactor OS Guard Checks
JLLeitschuh Mar 1, 2022
dad9a02
Update TempDirInfoDisclosure with new OS Guards
JLLeitschuh Mar 1, 2022
82d3cd8
Improve system property lookup
JLLeitschuh Mar 2, 2022
3c53a05
Add OS Checks based upon separator or path separator
JLLeitschuh Mar 2, 2022
a7adbb7
Refactor more system property access logic
JLLeitschuh Mar 3, 2022
85de9f3
Fix naming of OSCheck method
JLLeitschuh Mar 3, 2022
fea5006
Fix duplicated comment
JLLeitschuh Mar 3, 2022
103c770
Apply suggestions from code review
JLLeitschuh Mar 3, 2022
31527a6
Refactor OS Checks & SystemProperty logic from review feedback
JLLeitschuh Mar 3, 2022
7ab193d
Add System.getProperties().getProperty support
JLLeitschuh Mar 4, 2022
5243fe3
Apply suggestions from code review
JLLeitschuh Mar 4, 2022
523ddb7
Cleanup after code review feedback
JLLeitschuh Mar 4, 2022
b282c7f
Apply suggestions from code review
JLLeitschuh Mar 7, 2022
5b651f2
Fix insufficient tests and add documentation
JLLeitschuh Mar 7, 2022
a21992a
Minor refactoring to improve tests and documentation
JLLeitschuh Mar 7, 2022
2a6c4e9
Add localFlowPlusInitializers
JLLeitschuh Mar 9, 2022
ecb8911
Apply suggestions from code review
JLLeitschuh Mar 10, 2022
1c98642
Remove SystemProperty from FlowSources
JLLeitschuh Mar 10, 2022
50ff2c2
Code cleanup from code review
JLLeitschuh Mar 11, 2022
451661d
Improve guard class names
smowton Mar 15, 2022
09cc8ee
Add tests for StandardSystemProperty
JLLeitschuh Mar 15, 2022
b11340c
Change note tense and detail level
smowton Mar 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cleanup from review feedback
  • Loading branch information
JLLeitschuh committed Mar 2, 2022
commit 3cdfc0054250726057e0a3b8b4673dc4c71fb9a0
6 changes: 3 additions & 3 deletions java/ql/lib/semmle/code/java/frameworks/apache/Lang.qll
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ private class ApacheStrBuilderFluentMethod extends FluentMethod {
}

/**
* The class ``org.apache.commons.lang.SystemUtils` or `org.apache.commons.lang3.SystemUtils`.
* The class `org.apache.commons.lang.SystemUtils` or `org.apache.commons.lang3.SystemUtils`.
*/
class ApacheSystemUtilis extends Class {
ApacheSystemUtilis() {
class ApacheSystemUtils extends Class {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "TypeApacheSystemUtils" to be consistent with other classes, for example with TypeApacheRandomStringUtils?

ApacheSystemUtils() {
this.hasQualifiedName(["org.apache.commons.lang", "org.apache.commons.lang3"], "SystemUtils")
}
}
8 changes: 4 additions & 4 deletions java/ql/lib/semmle/code/java/os/OSCheck.qll
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ private import semmle.code.java.dataflow.DataFlow
private import semmle.code.java.StringCheck

/**
* A complimentatry guard that checks if the current platform is Windows.
* A guard that checks if the current platform is Windows.
*/
abstract class IsWindowsGuard extends Guard { }

/**
* A complimentatry guard that checks if the current platform is unix or unix-like.
* A guard that checks if the current platform is unix or unix-like.
*/
abstract class IsUnixGuard extends Guard { }

Expand Down Expand Up @@ -53,7 +53,7 @@ private class IsUnixFromSystemProp extends IsUnixGuard instanceof MethodAccess {

private predicate isOsFromApacheCommons(FieldAccess fa, string fieldName) {
exists(Field f | f = fa.getField() |
f.getDeclaringType() instanceof ApacheSystemUtilis and
f.getDeclaringType() instanceof ApacheSystemUtils and
f.hasName(fieldName)
)
}
Expand All @@ -63,7 +63,7 @@ private class IsWindowsFromApacheCommons extends IsWindowsGuard instanceof Field
}

private class IsUnixFromApacheCommons extends IsUnixGuard instanceof FieldAccess {
IsUnixFromApacheCommons() { isOsFromApacheCommons(this, ["IS_OS_UNIX"]) }
IsUnixFromApacheCommons() { isOsFromApacheCommons(this, "IS_OS_UNIX") }
Comment thread
JLLeitschuh marked this conversation as resolved.
}

/**
Expand Down