Video in progress

Strong Junior 🧩 Microservices

Why is exposing all Actuator endpoints on prod dangerous?

Endpoints like /actuator/heapdump, /env and /configprops can leak passwords, tokens and in-memory data. Only health is exposed to the outside; the rest sit on a separate port or behind authentication.

📖 Answer

management.endpoints.web.exposure.include=* is one of the most dangerous lines that gets copied from tutorials and lands on prod.

What can leak:

  • /actuator/heapdump: the entire heap as a file. It contains DB passwords, user tokens and request bodies.
  • /actuator/env and /configprops: configuration values. In Boot 3 they're masked with ****** by default, but many people set show-values: always.
  • /actuator/loggers: changing the log level with a POST, and if /shutdown is enabled, shutting the service down.

A safe setup:

management:
  server:
    port: 8081               # a separate port, not exposed to the outside
  endpoints:
    web:
      exposure:
        include: health,info,prometheus
  endpoint:
    health:
      show-details: when-authorized

A separate port is convenient: Prometheus comes in on 8081, while the Ingress exposes only 8080. One catch: point the probes at 8081 too, or open /livez and /readyz on the main port with management.endpoint.health.probes.add-additional-paths=true.

If you put Spring Security on Actuator, restrict it to the admin role with the EndpointRequest.toAnyEndpoint() matcher. And verify this: curl https://api.example.uz/actuator/env should return 404.