Skip to content

Commit 9f3980e

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Java: adjust qhelp tests, fix indentation
1 parent 36c6ac7 commit 9f3980e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

java/ql/test/query-tests/security/CWE-200/semmle/tests/SpringBootActuators/SpringBootActuatorsTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,15 @@ protected void configureOkNoPermitAll7_securityMatchers(HttpSecurity http) throw
265265
http.securityMatchers(matcher -> EndpointRequest.toAnyEndpoint()).authorizeHttpRequests().anyRequest();
266266
}
267267

268-
// Spring doc example
269-
// https://docs.spring.io/spring-boot/reference/actuator/endpoints.html#actuator.endpoints.security
270-
public void securityFilterChain(HttpSecurity http) throws Exception {
271-
http.securityMatcher(EndpointRequest.toAnyEndpoint());
272-
http.authorizeHttpRequests((requests) -> requests.anyRequest().permitAll()); // $ hasExposedSpringBootActuator
273-
}
268+
// QHelp Bad example
269+
public void securityFilterChain1(HttpSecurity http) throws Exception {
270+
// BAD: Unauthenticated access to Spring Boot actuator endpoints is allowed
271+
http.securityMatcher(EndpointRequest.toAnyEndpoint());
272+
http.authorizeHttpRequests((requests) -> requests.anyRequest().permitAll()); // $ hasExposedSpringBootActuator
273+
}
274274

275275
// QHelp Good example
276-
protected void configureQhelpGood(HttpSecurity http) throws Exception {
276+
public void securityFilterChain2(HttpSecurity http) throws Exception {
277277
// GOOD: only users with ENDPOINT_ADMIN role are allowed to access the actuator endpoints
278278
http.securityMatcher(EndpointRequest.toAnyEndpoint());
279279
http.authorizeHttpRequests((requests) -> requests.anyRequest().hasRole("ENDPOINT_ADMIN"));

0 commit comments

Comments
 (0)