-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Java: Promote Insecure Spring Boot Actuator Configuration query from experimental #20006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java: Promote Insecure Spring Boot Actuator Configuration query from experimental #20006
Conversation
QHelp previews: java/ql/src/Security/CWE/CWE-200/SpringBootActuatorsConfig/SpringBootActuatorsConfig.qhelpExposed Spring Boot actuators in configuration fileSpring Boot includes features called actuators that let you monitor and interact with your web application. Exposing unprotected actuator endpoints through configuration files can lead to information disclosure or even to remote code execution. RecommendationSince actuator endpoints may contain sensitive information, carefully consider when to expose them, and secure them as you would any sensitive URL. If you need to expose actuator endpoints, use Spring Security, which secures actuators by default, or define a custom security configuration. ExampleThe following examples show
The below configurations ensure that sensitive actuator endpoints are not exposed.
To use Spring Security, which secures actuators by default, add the ...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- GOOD: Enable Spring Security -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
...
References
|
...ecurity/CWE-200/semmle/tests/InsecureSpringActuatorConfig/InsecureSpringActuatorConfig.qlref
Fixed
Show fixed
Hide fixed
d8bbc2b
to
cde1939
Compare
java/ql/lib/semmle/code/java/security/SpringBootActuatorsConfigQuery.qll
Fixed
Show fixed
Hide fixed
c0680d1
to
9ac212d
Compare
java/ql/lib/semmle/code/java/security/SpringBootActuatorsConfigQuery.qll
Fixed
Show fixed
Hide fixed
java/ql/lib/semmle/code/java/security/SpringBootActuatorsConfigQuery.qll
Fixed
Show fixed
Hide fixed
java/ql/src/Security/CWE/CWE-200/InsecureSpringActuatorConfig/InsecureSpringActuatorConfig.ql
Fixed
Show fixed
Hide fixed
java/ql/src/Security/CWE/CWE-200/InsecureSpringActuatorConfig/InsecureSpringActuatorConfig.ql
Fixed
Show fixed
Hide fixed
9ac212d
to
8dd8c17
Compare
java/ql/src/Security/CWE/CWE-200/InsecureSpringActuatorConfig/InsecureSpringActuatorConfig.ql
Fixed
Show fixed
Hide fixed
8dd8c17
to
c31fb17
Compare
java/ql/src/Security/CWE/CWE-200/InsecureSpringActuatorConfig/InsecureSpringActuatorConfig.ql
Fixed
Show fixed
Hide fixed
c31fb17
to
6a6b794
Compare
splitting is required to properly test each scenario
Need the existence of an ApplicationProperties File, not an ApplicationProperties ConfigPair
6a6b794
to
56f667d
Compare
…to align with Spring docs
56f667d
to
7250265
Compare
java/ql/src/Security/CWE/CWE-200/SpringBootActuatorsConfig/SpringBootActuatorsConfig.ql
Show resolved
Hide resolved
java/ql/lib/semmle/code/java/security/SpringBootActuatorsConfigQuery.qll
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR promotes the experimental query java/insecure-spring-actuator-config
to the main query pack as java/spring-boot-exposed-actuators-config
, enabling it to appear in default CodeQL results.
Key changes include:
- Adding support for Spring Boot version 3.x
- Extending configuration property detection beyond
application.properties
to any.properties
file - Refactoring from experimental CWE-016 categorization to production CWE-200
Reviewed Changes
Copilot reviewed 46 out of 46 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
java/ql/src/Security/CWE/CWE-200/SpringBootActuatorsConfig/SpringBootActuatorsConfig.ql | New main query implementing the promoted actuator configuration detection |
java/ql/lib/semmle/code/java/security/SpringBootActuatorsConfigQuery.qll | Core logic library for detecting insecure Spring Boot actuator configurations |
java/ql/lib/semmle/code/configfiles/ConfigFiles.qll | Added PropertiesFile class to support broader .properties file detection |
java/ql/test/query-tests/security/CWE-200/semmle/tests/SpringBootActuatorsConfig/ | Comprehensive test suite covering Spring Boot versions 1.x through 3.x |
java/ql/src/experimental/Security/CWE/CWE-016/ | Removal of experimental query files |
java/ql/integration-tests/java/query-suite/*.expected | Updated query suite expectations to include the new query |
java/ql/test/query-tests/security/CWE-200/semmle/tests/SpringBootActuatorsConfig/options
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very thorough. One minor request in the change note.
java/ql/src/change-notes/2025-07-17-spring-actuators-config-promo.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from a Docs POV. 👍
* @problem.severity error | ||
* @security-severity 6.5 | ||
* @precision high | ||
* @id java/spring-boot-exposed-actuators-config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a @previous-id java/insecure-spring-actuator-config
tag as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we are using @previous-id
when promoting experimental queries. Only when porting queries from a different query pack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we are using
@previous-id
when promoting experimental queries. Only when porting queries from a different query pack.
This was my understanding as well.
Description
This PR promotes
java/insecure-spring-actuator-config
from experimental asjava/spring-boot-exposed-actuators-config
(original PR: #5384).Consideration
Main changes from the experimental query:
application.properties
file, I've used the pre-existingJavaProperty
class which only looks for the.properties
extension. Spring allows changing the theapplications.properties
name, so this update reduces FNs.management.endpoint.web.expose
. This property is not particularly common, but was available in at least one version 2.x, so I've added it since it was easy to add.