Skip to content

Commit 413a6cb

Browse files
committed
Refactor SensitiveKeyboardCacheQuery
1 parent d68bec9 commit 413a6cb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,23 @@ private predicate inputTypeFieldNotCached(Field f) {
9191
}
9292

9393
/** Configuration that finds uses of `setInputType` for non cached fields. */
94-
private class GoodInputTypeConf extends DataFlow::Configuration {
95-
GoodInputTypeConf() { this = "GoodInputTypeConf" }
96-
97-
override predicate isSource(DataFlow::Node node) {
94+
private module GoodInputTypeConfig implements DataFlow::ConfigSig {
95+
predicate isSource(DataFlow::Node node) {
9896
inputTypeFieldNotCached(node.asExpr().(FieldAccess).getField())
9997
}
10098

101-
override predicate isSink(DataFlow::Node node) { node.asExpr() = setInputTypeForId(_) }
99+
predicate isSink(DataFlow::Node node) { node.asExpr() = setInputTypeForId(_) }
102100

103-
override predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
101+
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
104102
exists(OrBitwiseExpr bitOr |
105103
node1.asExpr() = bitOr.getAChildExpr() and
106104
node2.asExpr() = bitOr
107105
)
108106
}
109107
}
110108

109+
private module GoodInputTypeFlow = DataFlow::Make<GoodInputTypeConfig>;
110+
111111
/** Gets a regex indicating that an input field may contain sensitive data. */
112112
private string getInputSensitiveInfoRegex() {
113113
result =
@@ -130,8 +130,8 @@ AndroidEditableXmlElement getASensitiveCachedInput() {
130130
result.getId().regexpMatch(getInputSensitiveInfoRegex()) and
131131
(
132132
not inputTypeNotCached(result.getInputType()) and
133-
not exists(GoodInputTypeConf conf, DataFlow::Node sink |
134-
conf.hasFlowTo(sink) and
133+
not exists(DataFlow::Node sink |
134+
GoodInputTypeFlow::hasFlowTo(sink) and
135135
sink.asExpr() = setInputTypeForId(result.getId())
136136
)
137137
)

0 commit comments

Comments
 (0)