ADR-0228: The actuator's metrics take the installation-wide settings read permission
Context
/actuator/prometheus and /actuator/metrics were exposed on the application port and fell through to anyRequest().permitAll(), so anyone who could reach the port read them without signing in. The series are tagged with every cluster's id and every destination's name (rahdar_rr_latency_seconds{cluster,address}, job and broker meters by node), so they answer questions the scope walk exists to refuse: a caller with a grant on one queue reads the name and traffic of all of them. That is enough to map a multi-tenant deployment and to pick a target for a later message injection or a denial of service.
Decision
/actuator/prometheus,/actuator/metricsand/actuator/metrics/**requiresettings:read, through the samePermissionResolverthe rest of the application uses. A scraper presents a bearer API token that holds it.- They stay on the application port. A separate management port is not introduced: with
management.server.portset, Boot runs the actuator in a child context, the application'sSecurityFilterChaindoes not apply there, and a fresh auto-configured chain would make/actuator/refreshanonymous again unless the rule were duplicated. The probe paths would move too, taking the container healthchecks, the compose files, the HAProxy check and the failover script with them. - Every other
/actuator/**path is denied. Health and the probes stay public because a load balancer and an orchestrator carry no credential;refreshkeeps itssettings:writerule; nothing else is served.
Consequences
- A scrape without a token gets 401, and a token without
settings:readgets 403. The leak the assessment describes is closed, for both endpoints, on the only port that serves them. - Prometheus needs a credential.
site/src/guide/observability.mddocuments theauthorizationblock, and a token rotation reaches the scraper through its credentials file. - The metrics no longer work as an unauthenticated health signal for an external uptime check.
/livezand/readyzremain public and are what such a check should use. - An operator whose only reason to read metrics is dashboards must now hold, or lend a token,
settings:read. That coupling is deliberate: the data is installation-wide, so the permission is too. - The separate-port option is still available to a deployment that wants network isolation; the gate stays as defence in depth when it is added.
Alternatives considered
- Only moving to a management port. The report's suggestion, and it would leave the endpoints unauthenticated for anyone on that network segment, while reopening
refreshin the child context unless carefully duplicated. - Removing
metricsfrom the exposure./actuator/metricsis what an operator reads when a dashboard disagrees with reality. Gating costs one rule; removing costs a diagnostic. - Spring authorities instead of Rahdar permissions. It would put a second authorization model beside the scope walk. Using
settings:readkeeps one model and one audit path for a refusal.