Skip to content

Commit 5245fd8

Browse files
committed
Java: Address review comments and some other code quality improvements.
1 parent f95b330 commit 5245fd8

17 files changed

+42
-61
lines changed

java/ql/lib/semmle/code/java/security/AndroidSensitiveCommunicationQuery.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ deprecated class SensitiveCommunicationConfig extends TaintTracking::Configurati
153153
}
154154

155155
/**
156-
* A class of sensitive communication sink nodes.
156+
* A sensitive communication sink node.
157157
*/
158-
class SensitiveCommunicationSink extends ApiSinkNode {
158+
private class SensitiveCommunicationSink extends ApiSinkNode {
159159
SensitiveCommunicationSink() {
160160
isSensitiveBroadcastSink(this)
161161
or

java/ql/lib/semmle/code/java/security/CleartextStorageAndroidDatabaseQuery.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,16 @@ private predicate localDatabaseStore(DataFlow::Node database, MethodCall store)
9999
}
100100

101101
/**
102-
* A class of local database open method call source nodes.
102+
* A local database open method call source node.
103103
*/
104-
class LocalDatabaseOpenMethodCallSource extends ApiSourceNode {
104+
private class LocalDatabaseOpenMethodCallSource extends ApiSourceNode {
105105
LocalDatabaseOpenMethodCallSource() { this.asExpr() instanceof LocalDatabaseOpenMethodCall }
106106
}
107107

108108
/**
109-
* A class of local database sink nodes.
109+
* A local database sink node.
110110
*/
111-
class LocalDatabaseSink extends ApiSinkNode {
111+
private class LocalDatabaseSink extends ApiSinkNode {
112112
LocalDatabaseSink() { localDatabaseInput(this, _) or localDatabaseStore(this, _) }
113113
}
114114

java/ql/lib/semmle/code/java/security/CleartextStorageAndroidFilesystemQuery.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,16 @@ private class CloseFileMethod extends Method {
8282
}
8383

8484
/**
85-
* A class of local file open call source nodes.
85+
* A local file open call source node.
8686
*/
87-
class LocalFileOpenCallSource extends ApiSourceNode {
87+
private class LocalFileOpenCallSource extends ApiSourceNode {
8888
LocalFileOpenCallSource() { this.asExpr() instanceof LocalFileOpenCall }
8989
}
9090

9191
/**
92-
* A class of local file sink nodes.
92+
* A local file sink node.
9393
*/
94-
class LocalFileSink extends ApiSinkNode {
94+
private class LocalFileSink extends ApiSinkNode {
9595
LocalFileSink() {
9696
filesystemInput(this, _) or
9797
closesFile(this, _)

java/ql/lib/semmle/code/java/security/CleartextStorageCookieQuery.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ private predicate cookieStore(DataFlow::Node cookie, Expr store) {
4040
}
4141

4242
/**
43-
* A class of cookie source nodes.
43+
* A cookie source node.
4444
*/
45-
class CookieSource extends ApiSourceNode {
45+
private class CookieSource extends ApiSourceNode {
4646
CookieSource() { this.asExpr() instanceof Cookie }
4747
}
4848

4949
/**
50-
* A class of cookie store sink nodes.
50+
* A cookie store sink node.
5151
*/
52-
class CookieStoreSink extends ApiSinkNode {
52+
private class CookieStoreSink extends ApiSinkNode {
5353
CookieStoreSink() { cookieStore(this, _) }
5454
}
5555

java/ql/lib/semmle/code/java/security/CleartextStorageSharedPrefsQuery.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,18 @@ private predicate sharedPreferencesStore(DataFlow::Node editor, MethodCall m) {
7070
}
7171

7272
/**
73-
* A shared preferences editor method call source nodes.
73+
* A shared preferences editor method call source node.
7474
*/
75-
class SharedPreferencesEditorMethodCallSource extends ApiSourceNode {
75+
private class SharedPreferencesEditorMethodCallSource extends ApiSourceNode {
7676
SharedPreferencesEditorMethodCallSource() {
7777
this.asExpr() instanceof SharedPreferencesEditorMethodCall
7878
}
7979
}
8080

8181
/**
82-
* A class of shared preferences sink nodes.
82+
* A shared preferences sink node.
8383
*/
84-
class SharedPreferencesSink extends ApiSinkNode {
84+
private class SharedPreferencesSink extends ApiSinkNode {
8585
SharedPreferencesSink() {
8686
sharedPreferencesInput(this, _) or
8787
sharedPreferencesStore(this, _)

java/ql/lib/semmle/code/java/security/ExternallyControlledFormatStringQuery.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ private import semmle.code.java.dataflow.FlowSources
66
private import semmle.code.java.StringFormat
77

88
/**
9-
* A class of string format sink nodes.
9+
* A string format sink node.
1010
*/
11-
class StringFormatSink extends ApiSinkNode {
11+
private class StringFormatSink extends ApiSinkNode {
1212
StringFormatSink() { this.asExpr() = any(StringFormat formatCall).getFormatArgument() }
1313
}
1414

java/ql/lib/semmle/code/java/security/ImplicitPendingIntents.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import java
44
private import semmle.code.java.dataflow.ExternalFlow
55
private import semmle.code.java.dataflow.FlowSources
6-
private import semmle.code.java.dataflow.TaintTracking
7-
private import semmle.code.java.frameworks.android.Intent
86
private import semmle.code.java.frameworks.android.PendingIntent
97

108
private newtype TPendingIntentState =

java/ql/lib/semmle/code/java/security/ImproperIntentVerificationQuery.qll

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import java
44
import semmle.code.java.dataflow.DataFlow
55
import semmle.code.xml.AndroidManifest
66
import semmle.code.java.frameworks.android.Intent
7-
private import semmle.code.java.dataflow.FlowSources
87

98
/** An `onReceive` method of a `BroadcastReceiver` */
109
private class OnReceiveMethod extends Method {
@@ -14,18 +13,11 @@ private class OnReceiveMethod extends Method {
1413
Parameter getIntentParameter() { result = this.getParameter(1) }
1514
}
1615

17-
/**
18-
* A class of verified intent source nodes.
19-
*/
20-
class VerifiedIntentConfigSource extends ApiSourceNode {
21-
VerifiedIntentConfigSource() {
22-
this.asParameter() = any(OnReceiveMethod orm).getIntentParameter()
23-
}
24-
}
25-
2616
/** A configuration to detect whether the `action` of an `Intent` is checked. */
2717
private module VerifiedIntentConfig implements DataFlow::ConfigSig {
28-
predicate isSource(DataFlow::Node src) { src instanceof VerifiedIntentConfigSource }
18+
predicate isSource(DataFlow::Node src) {
19+
src.asParameter() = any(OnReceiveMethod orm).getIntentParameter()
20+
}
2921

3022
predicate isSink(DataFlow::Node sink) {
3123
exists(MethodCall ma |

java/ql/lib/semmle/code/java/security/InsecureRandomnessQuery.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import java
44
private import semmle.code.java.frameworks.OpenSaml
55
private import semmle.code.java.frameworks.Servlets
66
private import semmle.code.java.dataflow.ExternalFlow
7+
private import semmle.code.java.dataflow.FlowSinks
78
private import semmle.code.java.dataflow.TaintTracking
89
private import semmle.code.java.security.Cookies
910
private import semmle.code.java.security.RandomQuery
@@ -49,7 +50,7 @@ abstract class InsecureRandomnessSink extends DataFlow::Node { }
4950
/**
5051
* A node which sets the value of a cookie.
5152
*/
52-
private class CookieSink extends InsecureRandomnessSink {
53+
private class CookieSink extends InsecureRandomnessSink, ApiSinkNode {
5354
CookieSink() { this.asExpr() instanceof SetCookieValue }
5455
}
5556

java/ql/lib/semmle/code/java/security/JWT.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/** Provides classes for working with JSON Web Token (JWT) libraries. */
22

33
import java
4-
private import semmle.code.java.dataflow.DataFlow
54
private import semmle.code.java.dataflow.FlowSinks
65
private import semmle.code.java.dataflow.FlowSources
76

0 commit comments

Comments
 (0)