Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9f3980e

Browse filesBrowse files
Jami CogswellJami Cogswell
Jami Cogswell
authored and
Jami Cogswell
committed
Java: adjust qhelp tests, fix indentation
1 parent 36c6ac7 commit 9f3980e
Copy full SHA for 9f3980e

File tree

1 file changed

+7
-7
lines changed
Filter options

1 file changed

+7
-7
lines changed

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

Copy file name to clipboardExpand all lines: java/ql/test/query-tests/security/CWE-200/semmle/tests/SpringBootActuators/SpringBootActuatorsTest.java
+7-7Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.