Skip to content

Commit 530a77e

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Java: refactor into canTargetDatabaseUpdateMethod
1 parent 8173fd0 commit 530a77e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,21 @@ module CallGraph {
183183
[viableCallable(this.asCall()), this.asCall().getCallee()] = result.asMethod()
184184
}
185185

186+
pragma[nomagic]
187+
private predicate canTargetDatabaseUpdateMethod() {
188+
exists(CallPathNode p |
189+
p = this.getACallee() and
190+
p.asMethod() instanceof DatabaseUpdateMethod
191+
)
192+
}
193+
186194
/** Gets a successor node of this `CallPathNode`, if any. */
187195
CallPathNode getASuccessor() {
188196
this.asMethod() = result.asCall().getEnclosingCallable()
189197
or
190198
result = this.getACallee() and
191199
(
192-
exists(CallPathNode p |
193-
p = this.getACallee() and
194-
p.asMethod() instanceof DatabaseUpdateMethod
195-
)
200+
this.canTargetDatabaseUpdateMethod()
196201
implies
197202
result.asMethod() instanceof DatabaseUpdateMethod
198203
)

0 commit comments

Comments
 (0)