Skip to content

Commit 79d7ea3

Browse files
Update java/ql/src/experimental/Security/CWE/CWE-016/SpringBootActuators.qll
Co-Authored-By: Anders Schack-Mulligen <[email protected]>
1 parent 6ca963a commit 79d7ea3

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

java/ql/src/experimental/Security/CWE/CWE-016/SpringBootActuators.qll

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,12 @@ class PermitAllCall extends MethodAccess {
8686

8787
/** Holds if `permitAll` is called on request(s) mapped to actuator endpoint(s). */
8888
predicate permitsSpringBootActuators() {
89-
exists(
90-
RequestMatcherCall requestMatcherCall, RequestMatchersCall requestMatchersCall,
91-
RegistryRequestMatchersCall registryRequestMatchersCall,
92-
AuthorizeRequestsCall authorizeRequestsCall, AnyRequestCall anyRequestCall
93-
|
89+
exists(AuthorizeRequestsCall authorizeRequestsCall |
9490
// .requestMatcher(EndpointRequest).authorizeRequests([...]).[...]
95-
authorizeRequestsCall.getQualifier() = requestMatcherCall
91+
authorizeRequestsCall.getQualifier() instanceof RequestMatcherCall
9692
or
9793
// .requestMatchers(matcher -> EndpointRequest).authorizeRequests([...]).[...]
98-
authorizeRequestsCall.getQualifier() = requestMatchersCall
94+
authorizeRequestsCall.getQualifier() instanceof RequestMatchersCall
9995
or
10096
// http.authorizeRequests([...]).[...]
10197
authorizeRequestsCall.getQualifier() instanceof VarAccess
@@ -104,20 +100,22 @@ class PermitAllCall extends MethodAccess {
104100
// [...].authorizeRequests(r -> r.requestMatchers(EndpointRequest).permitAll())
105101
authorizeRequestsCall.getArgument(0).(LambdaExpr).getExprBody() = this and
106102
(
107-
this.getQualifier() = anyRequestCall or
108-
this.getQualifier() = registryRequestMatchersCall
103+
this.getQualifier() instanceof AnyRequestCall or
104+
this.getQualifier() instanceof RegistryRequestMatchersCall
109105
)
110106
or
111107
// [...].authorizeRequests().requestMatchers(EndpointRequest).permitAll() or
112108
// [...].authorizeRequests().anyRequest().permitAll()
113109
authorizeRequestsCall.getNumArgument() = 0 and
114-
(
110+
exists(RegistryRequestMatchersCall registryRequestMatchersCall |
115111
registryRequestMatchersCall.getQualifier() = authorizeRequestsCall and
116112
this.getQualifier() = registryRequestMatchersCall
117113
)
118114
or
119-
anyRequestCall.getQualifier() = authorizeRequestsCall and
120-
this.getQualifier() = anyRequestCall
115+
exists(AnyRequestCall anyRequestCall |
116+
anyRequestCall.getQualifier() = authorizeRequestsCall and
117+
this.getQualifier() = anyRequestCall
118+
)
121119
)
122120
}
123121
}

0 commit comments

Comments
 (0)