Scrivio Interview library
ScenarioIntermediate6 min read · updated 12 November 2026

Which actuator endpoints would you expose in production, on which port, and which would you never expose publicly? Justify each choice.

In production I would expose health with its liveness and readiness probes, info, and metrics or prometheus to internal monitoring, ideally on a separate management.server.port that is reachable only inside the cluster. heapdump, threaddump, env, configprops, beans and loggers reveal internals or secrets, so they are restricted to authenticated operators, shutdown stays disabled, and every non-public endpoint is secured with authentication and roles.

Why this question is asked

Actuator is one of the most useful parts of Spring Boot in production and one of the most dangerous when exposed carelessly. Publicly reachable heap dumps and environment endpoints have led to real credential leaks, because they show exactly what a running application holds in memory and configuration. Interviewers ask this to see whether we can justify each endpoint by who needs it and what it reveals. In this answer, we will sort the endpoints into groups, justify each choice, choose the port, and write the security configuration that enforces it.

1A Quick Recap: Three Kinds of Callers

An Actuator endpoint is a small management API built into the application. Its callers fall into three groups. The platform needs health to decide whether to send traffic or restart a pod. Monitoring systems such as Prometheus need metrics every 15 or 30 seconds. Operators, people on the team, occasionally need deeper views during an incident: a thread dump, the current logger levels, or the effective configuration.

Members of the public need none of them. So the useful question for each endpoint is which of these groups needs it, and what an attacker would learn or be able to do if they reached it.

2What I Would Expose to the Platform and Monitoring

health is essential. With probes enabled, it provides /actuator/health/liveness and /actuator/health/readiness for Kubernetes, and by default it shows only an overall status such as UP, so it reveals almost nothing. info is harmless if we control what goes into it, such as the build version and git commit, which help during incidents to confirm what is deployed. metrics, or prometheus when Prometheus scrapes the service, gives monitoring the numbers it needs. Metric names and tag values can still reveal internal structure such as URL patterns and dependency names, so these go to internal monitoring only, not to the internet.

Actuator endpoints in production
EndpointWho needs itExposure
health (+ probes)Kubernetes, load balancerInternal, no auth for probes
infoOperators, deploy toolsInternal
metrics, prometheusMonitoringInternal, scraper identity
loggersOperators in incidentsOperator role; changes are powerful
threaddumpOperators in incidentsOperator role
env, configprops, beansRarely, for debuggingOperator role, values masked
heapdumpRare deep analysisOperator role, or not at all
shutdownNobodyAccess none (the default)

3What I Would Restrict to Operators, and Why

heapdump returns the entire Java heap as a file. That heap contains everything the application holds in memory: database passwords read at startup, OAuth client secrets, session tokens, and personal data from recent requests. Anyone who downloads it can search it for secrets. It is the single most dangerous endpoint, and many teams do not expose it at all, taking heap dumps through kubectl and jcmd when needed instead.

threaddump shows every thread's stack, which reveals class names, libraries and what the service is doing. env and configprops show configuration properties and their sources; since Boot 3 their values are masked by default, but the names and structure still reveal a lot, and turning unmasking on for convenience is a common mistake. beans lists every bean in the context, a map of the application's internals. loggers can do more than show levels: a POST can change a level, and switching a busy package to DEBUG can fill disks or leak data into logs. So all of these are restricted to authenticated operators.

shutdown can stop the application with a single POST. Its access is none by default, and I would keep it that way unless there is a strong reason, because the platform already has safe ways to stop a pod.

4Which Port to Use

management.server.port moves all Actuator endpoints to their own port, for example 9090, while the application stays on 8080. The load balancer and ingress route only to 8080, and a network policy allows 9090 only from inside the cluster, from the kubelet for probes and from the monitoring namespace for scraping. Even a mistake in the exposure list then does not put an endpoint on the internet. The cost is a second listener, and probes then check the management server rather than the one serving users, which is a known trade-off to accept or work around with add-additional-paths.

Properties
management.server.port=9090
management.endpoints.web.exposure.include=health,info,prometheus,loggers,threaddump
management.endpoint.health.probes.enabled=true
management.endpoint.health.show-details=when-authorized
management.endpoint.loggers.access=read-only # Boot 3.4+: reading levels yes, changing them no
management.endpoint.shutdown.access=none # the default, stated for clarity
management.endpoint.env.show-values=never # the default since Boot 3
# heapdump, env, configprops and beans are not exposed at all here

5Securing Every Non-Public Endpoint

Network isolation is one layer; authentication is the second, because an attacker who reaches any pod inside the cluster can reach port 9090. Spring Boot provides EndpointRequest to write security rules about Actuator endpoints without hard-coding paths.

Java
@Bean
@Order(1)
SecurityFilterChain actuatorSecurity(HttpSecurity http) throws Exception {
http.securityMatcher(EndpointRequest.toAnyEndpoint())
.authorizeHttpRequests(auth -> auth
.requestMatchers(EndpointRequest.to(HealthEndpoint.class)).permitAll() // probes
.requestMatchers(EndpointRequest.to("prometheus")).hasRole("MONITORING")
.anyRequest().hasRole("OPS")) // everything else
.httpBasic(Customizer.withDefaults());
return http.build();
}
// GET /actuator/health/readiness -> 200 without credentials
// GET /actuator/threaddump -> 401 without credentials, 403 for MONITORING, 200 for OPS
Step throughA request to an Actuator endpoint
  1. Arrived on the management port from inside the cluster?
    YesGo onNoBlocked by network policy
  2. Endpoint in the exposure list?
    YesGo onNo404
  3. Caller has the role for this endpoint?
    YesAllowedNo401 or 403

3 steps in order. Play them, or step through them one at a time.

Notice the order of the rules: health is open so the kubelet can probe without credentials, prometheus needs the monitoring role, and anything else needs the operator role. Because health is open, show-details stays at when-authorized, so anonymous callers see only UP or DOWN, not which database host is failing. The package of EndpointRequest moved between major versions, so check your Boot version for the import.

6Follow-up questions

Is it safe to expose health without authentication?

Yes, as long as it shows only the overall status to anonymous callers. Probes need it without credentials, and UP or DOWN reveals little. Component details, such as database host names and error messages, should be visible only when authorized.

How would you take a heap dump if heapdump is not exposed?

Through the platform, with access control and an audit trail: kubectl exec into the pod and run jcmd <pid> GC.heap_dump, or use a sidecar or tooling the platform provides. The dump is then handled as sensitive data, stored briefly and deleted after analysis.

Is a separate port enough on its own?

No. It reduces exposure, but anyone who gets into the cluster network, for example through a compromised pod, can reach it. Authentication and roles on non-public endpoints are still needed, so the two layers protect each other.

7Conclusion

In this answer, we exposed health with probes, info and metrics or prometheus to the platform and internal monitoring, and restricted heapdump, threaddump, env, configprops, beans and loggers to authenticated operators because they reveal internals or secrets. shutdown stays at access none, management.server.port keeps Actuator on a port reachable only inside the cluster, and a dedicated security filter chain secures every non-public endpoint with roles.

What to say in the interviewAbout 80 seconds aloud

Open with

I would decide by who needs each endpoint and what it reveals. For the platform and monitoring I expose health, with the liveness and readiness probe groups for Kubernetes, info with the build version and commit, which is useful during incidents, and prometheus or metrics for scraping.

Then, if they want more

Those go to internal monitoring, not the public.

Then there are endpoints that reveal internals or secrets. heapdump is the worst, it is the whole heap, so passwords, tokens and personal data, and I would usually not expose it at all and take dumps with jcmd through the platform when needed. threaddump, env, configprops, beans and loggers show stacks, configuration, the bean graph, and loggers can even change log levels, so those are only for authenticated operators, and I would give loggers read-only access with the Boot 3.4 access property. shutdown stays at access none, its default, because the platform already stops pods safely.

For the port, I would use management.server.port, say 9090, with a network policy so it is only reachable inside the cluster, and the ingress never routes to it. And I still secure it, with a dedicated SecurityFilterChain using EndpointRequest: health open for probes with details only when authorized, prometheus for a monitoring role, and everything else for an operator role.

About this answer

Last updated
12 November 2026
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
Spring Boot reference, Actuator
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 actuator endpoints would you expose in production, on which port, and which would...": https://scrivio-interview-library.netlify.app/spring-boot/actuator/e76aef2ce9/