File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
lib/semmle/code/java/security
test/query-tests/security/CWE-016 Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -142,5 +142,14 @@ predicate permitsSpringBootActuators(PermitAllCall permitAllCall) {
142142 registryRequestMatchersCall .getQualifier ( ) = authorizeCall and
143143 permitAllCall .getQualifier ( ) = registryRequestMatchersCall
144144 )
145+ or
146+ exists ( Variable v , MatcherCall matcherCall |
147+ // http.securityMatcher(EndpointRequest.toAnyEndpoint());
148+ // http.authorizeRequests([...].permitAll())
149+ v .getAnAccess ( ) = authorizeCall .getQualifier ( ) and
150+ v .getAnAccess ( ) = matcherCall .getQualifier ( ) and
151+ authorizeCall .getArgument ( 0 ) .( LambdaExpr ) .getExprBody ( ) = permitAllCall and
152+ permitAllCall .getQualifier ( ) instanceof AnyRequestCall
153+ )
145154 )
146155}
Original file line number Diff line number Diff line change @@ -264,4 +264,11 @@ protected void configureOkNoPermitAll4_securityMatchers(HttpSecurity http) throw
264264 protected void configureOkNoPermitAll7_securityMatchers (HttpSecurity http ) throws Exception {
265265 http .securityMatchers (matcher -> EndpointRequest .toAnyEndpoint ()).authorizeHttpRequests ().anyRequest ();
266266 }
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+ }
267274}
You can’t perform that action at this time.
0 commit comments