Skip to content

Commit 7ae41ff

Browse files
Invert the xml logic to be consistent with the dataflow logic
1 parent 6d465aa commit 7ae41ff

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,19 @@ private string getInputSensitiveInfoRegex() {
117117
]
118118
}
119119

120-
/** Holds if input using the given input type (as written in XML) may be stored in the keyboard cache. */
120+
/** Holds if input using the given input type (as written in XML) is not stored in the keyboard cache. */
121121
bindingset[ty]
122-
private predicate inputTypeCached(string ty) {
123-
ty.matches("%text%") and
124-
not ty.regexpMatch("(?i).*(nosuggestions|password).*")
122+
private predicate inputTypeNotCached(string ty) {
123+
not ty.matches("%text%")
124+
or
125+
ty.regexpMatch("(?i).*(nosuggestions|password).*")
125126
}
126127

127128
/** Gets an input field whose contents may be sensitive and may be stored in the keyboard cache. */
128129
AndroidEditableXmlElement getASensitiveCachedInput() {
129130
result.getId().regexpMatch(getInputSensitiveInfoRegex()) and
130131
(
131-
inputTypeCached(result.getInputType())
132-
or
133-
not exists(result.getInputType()) and
132+
not inputTypeNotCached(result.getInputType()) and
134133
not exists(GoodInputTypeConf conf, DataFlow::Node src, DataFlow::Node sink |
135134
conf.hasFlow(src, sink) and
136135
sink.asExpr() = setInputTypeForId(result.getId())

0 commit comments

Comments
 (0)