Scrivio Interview library
ConceptFoundations6 min read · updated 12 November 2026

Which Spring Boot Actuator settings can create security problems if left open in production, and how should actuator endpoints be secured?

Actuator endpoints such as env, configprops, heapdump, threaddump and loggers can leak secrets or let a caller change how the application behaves, so exposing them openly in production is dangerous. Spring Boot exposes only health over HTTP by default, so the risk comes from what management.endpoints.web.exposure.include adds. We secure exposed endpoints with Spring Security, for example requiring a role for EndpointRequest.toAnyEndpoint(), run management on a separate port or network where we can, and remember that masking in env and configprops does not protect a heap dump, which contains everything in memory.

Why this question is asked

Spring Boot Actuator is one of the most useful parts of Boot: health checks for Kubernetes, metrics for Prometheus, and runtime insight when something goes wrong. It is also a frequent source of real incidents, because one line of configuration copied from a tutorial, include: "*", can publish a full memory dump of the application to the internet. Interviewers ask this to see whether we know which endpoints are sensitive and how to lock them down properly. In this answer, we will recap what Actuator exposes by default, look at the dangerous endpoints one by one, and then secure them with Spring Security and network separation.

1A Quick Recap of Actuator Exposure

Actuator provides endpoints, small built-in pages that report on or control the running application. Each endpoint has two separate switches. It can be enabled or disabled (whether it exists at all), and it can be exposed over a technology, HTTP or JMX (whether anyone outside the JVM can call it).

Since Spring Boot 2, only the health endpoint is exposed over HTTP by default, under /actuator/health. Everything else must be added explicitly with management.endpoints.web.exposure.include. So the first thing to check in any review is that property, in every profile and in environment variables such as MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE.

YAML
# Dangerous: exposes every endpoint, including heapdump, over HTTP
management:
endpoints:
web:
exposure:
include: "*"
# Better: only what monitoring really needs
management:
endpoints:
web:
exposure:
include: health,info,prometheus

2Which Endpoints Are Dangerous and Why

The sensitive endpoints fall into two groups. Some read data that may contain secrets: env shows property sources and values, configprops shows @ConfigurationProperties beans, and heapdump returns a complete snapshot of the JVM heap. Others change behaviour: loggers can switch a package to DEBUG or TRACE, which may start writing request bodies or tokens to logs, and endpoints such as shutdown (disabled by default) or refresh in Spring Cloud can stop or reconfigure the service.

Even endpoints that look harmless give an attacker a map. mappings lists every URL in the application, beans lists every component, and threaddump shows stack traces with class names and sometimes values. That information makes other attacks much easier.

Sensitive Actuator endpoints
EndpointWhat it can expose or doRisk
heapdumpFull JVM memory: secrets, tokens, customer dataCritical
envProperty values; masked by default in Boot 3High if unmasked
configpropsConfiguration bean values; masked by default in Boot 3High if unmasked
loggersChange log levels at runtimeLeaks via DEBUG logs
threaddumpStack traces of all threadsInformation leak
mappings, beansMap of URLs and componentsHelps attackers
shutdownStops the application (off by default)Denial of service

3Masking Helps, but Not for Heap Dumps

In older Boot versions, env and configprops masked only keys that looked secret, such as password or token, so a property named db.url with credentials inside it leaked. Since Spring Boot 3.0, values in env and configprops are masked by default for everyone, controlled by management.endpoint.env.show-values, whose default is never. We can set it to when-authorized for operators with a role, and avoid always in production.

But there is a catch: masking is applied only to what those endpoints display. A heap dump is a raw copy of memory, and it contains the database password, the decrypted API keys, JWT signing keys, session data and recent request bodies, all readable with a heap analyser in minutes. That is why heapdump should never be exposed over HTTP in production unless it sits behind strong authentication on a private network.

YAML
management:
endpoint:
env:
show-values: when-authorized # never (default), when-authorized, or always
roles: ACTUATOR_ADMIN
configprops:
show-values: when-authorized
roles: ACTUATOR_ADMIN

4Securing Exposed Endpoints With Spring Security

When we do expose more than health, we protect the endpoints with Spring Security. Boot provides EndpointRequest, a request matcher that knows where Actuator endpoints live even if we change the base path. We create a security filter chain just for them, allow health and info for probes and require a role for the rest.

Java
@Bean
@Order(1)
SecurityFilterChain actuatorChain(HttpSecurity http) throws Exception {
http.securityMatcher(EndpointRequest.toAnyEndpoint())
.authorizeHttpRequests(a -> a
.requestMatchers(EndpointRequest.to(HealthEndpoint.class, InfoEndpoint.class)).permitAll()
.anyRequest().hasRole("ACTUATOR_ADMIN"))
.httpBasic(Customizer.withDefaults());
return http.build();
}
// GET /actuator/health -> 200 for anyone
// GET /actuator/env (no auth) -> 401
// GET /actuator/env (operator) -> 200, values shown because show-values is when-authorized

Notice the @Order(1) and securityMatcher. The chain applies only to Actuator requests, and it is checked before the main application chain, so a permissive rule in the main chain cannot accidentally open the management endpoints. Also note that the health endpoint can show details such as database status; management.endpoint.health.show-details should be when-authorized too.

5Separate Port or Network for Management

Authentication is one layer; network separation is another. With management.server.port set to a different port, such as 8081, Actuator is served on its own connector. The load balancer and ingress route only the application port to the internet, while Prometheus and the Kubernetes probes reach the management port from inside the cluster. A network policy can then allow only the monitoring namespace to call that port.

So an attacker on the internet cannot even reach /actuator/env, and if a later configuration change accidentally exposes an endpoint, it is still not reachable from outside. We combine this with authentication rather than relying on it alone, because internal networks are not fully trusted either.

YAML
management:
server:
port: 8081 # Actuator on its own port, not routed by the public ingress
address: 0.0.0.0
server:
port: 8080 # application traffic

6Follow-up questions

Is it safe to expose the prometheus endpoint publicly?

It does not reveal secrets, but metrics show internal names, traffic levels and sometimes customer identifiers in tags. It belongs on the management port, scraped from inside the network, or behind authentication.

What about Actuator over JMX?

JMX itself has been off by default since Spring Boot 2.2 unless enabled with spring.jmx.enabled, and since Boot 3.0 only health is exposed over JMX by default. If JMX is enabled with remote access, it needs authentication and TLS, because JMX can invoke operations just like HTTP.

How would you detect an exposure in an existing estate?

Scan configuration repositories for exposure.include values, and probe each service's public URL for /actuator/env and /actuator/heapdump from outside the network as part of a regular check. A 200 response from outside is an immediate finding.

7Conclusion

In this answer, we saw that Actuator is safe by default because only health is exposed over HTTP, and that the danger comes from what we add with management.endpoints.web.exposure.include. Endpoints such as env, configprops, heapdump, threaddump and loggers can leak secrets or change behaviour. We expose only what monitoring needs, protect the rest with a Spring Security chain built on EndpointRequest that requires a role, run management on a separate port that only the internal network can reach, and remember that masked values in env and configprops do not protect the contents of a heap dump.

What to say in the interviewAbout 80 seconds aloud

Open with

Actuator is fairly safe out of the box, because since Boot 2 only health is exposed over HTTP. The problems start when someone sets management.endpoints.web.exposure.include to a star or a long list.

Then, if they want more

The endpoints I worry about most are heapdump, because it is a copy of the whole heap with database passwords, signing keys and customer data in it; env and configprops, which show configuration values; loggers, which lets a caller turn on debug logging that might write tokens to logs; and threaddump, mappings and beans, which give an attacker a map of the application.

In Boot 3, env and configprops mask values by default with show-values set to never, and I would only raise that to when-authorized. But masking does nothing for a heap dump.

So my approach is to expose only health, info and prometheus, put Actuator on a separate management port that the public ingress does not route and that a network policy limits to monitoring, and add a dedicated Spring Security filter chain with EndpointRequest.toAnyEndpoint() that permits health and info and requires an admin role for everything else.

I would also set health details to when-authorized and add a regular external probe that alerts if /actuator/env or /actuator/heapdump ever returns 200 from outside.

About this answer

Last updated
12 November 2026
Versions it names
Spring Boot 2, Spring Boot 2.2, Spring Boot 3.0
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
OWASP Top Ten
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Which Spring Boot Actuator settings can create security problems if left open in...": https://scrivio-interview-library.netlify.app/spring-boot/web-security-threats/347731b188/