File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
java/ql/test/query-tests/security/CWE-200/semmle/tests/SpringBootActuators Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -265,15 +265,15 @@ protected void configureOkNoPermitAll7_securityMatchers(HttpSecurity http) throw
265
265
http .securityMatchers (matcher -> EndpointRequest .toAnyEndpoint ()).authorizeHttpRequests ().anyRequest ();
266
266
}
267
267
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
+ }
274
274
275
275
// QHelp Good example
276
- protected void configureQhelpGood (HttpSecurity http ) throws Exception {
276
+ public void securityFilterChain2 (HttpSecurity http ) throws Exception {
277
277
// GOOD: only users with ENDPOINT_ADMIN role are allowed to access the actuator endpoints
278
278
http .securityMatcher (EndpointRequest .toAnyEndpoint ());
279
279
http .authorizeHttpRequests ((requests ) -> requests .anyRequest ().hasRole ("ENDPOINT_ADMIN" ));
You can’t perform that action at this time.
0 commit comments