Safeguard
Security Guides•

Does Spring Boot Actuator hide secrets in the env endpoint?

By default Actuator replaces values from env, configprops and quartz with asterisks. The show-values setting can change that, so check who can see them.

Safeguard Security Team
3 min read

By default, yes. Spring Boot Actuator fully sanitizes values returned by the env, configprops and quartz endpoints, replacing them with asterisks. Values appear only if the show-values property is set to something other than never and no custom SanitizingFunction bean applies. Check that property before exposing those endpoints.

What sanitization is

Sanitization means the endpoint still lists property names but masks the values. An attacker who reaches a masked endpoint learns the shape of your configuration, such as which services you connect to, but not the secrets themselves. Masking is a safety net, not a licence to expose the endpoint.

The three settings

The Spring Boot docs describe a show-values property for sanitizable endpoints:

ValueEffect
neverValues are always replaced by asterisks (the default)
alwaysValues are shown to all users who can reach the endpoint
when-authorizedValues are shown only to authorized users

For HTTP endpoints, a user counts as authorized if they have authenticated and have the roles configured for the endpoint. If no roles are configured, any authenticated user counts as authorized. That second sentence is the one to read twice. A developer account or a service account with no special rights may then see real values.

The docs give this example for letting only an admin role see original values:

management.endpoint.env.show-values=when-authorized
management.endpoint.env.roles=admin

Why teams turn it on

Debugging a bad property value is much easier with real values, and the docs call env and configprops useful for diagnosing why a property has a certain value. The risk is that the same view shows database passwords, API keys and signing secrets to whoever is allowed in.

Steps

  1. Find every show-values and show-details setting in your configuration, including per environment profiles.
  2. Prefer never in production. Use when-authorized with an explicit, narrow role if you must see values.
  3. Do not treat masking as a guarantee. Custom SanitizingFunction beans can change what is shown, so review any you have.
  4. Keep secrets out of plain property files in the first place, using a secret store or mounted files.
  5. Limit exposure with the include property, and put the endpoints behind authentication.
  6. Rotate any secret that was ever visible through an exposed endpoint.

Related reading: Actuator exposure and access.

Safeguard scans dependencies, produces SBOMs and uses reachability analysis to show which findings your code can actually reach. You can run a free scan at gold.safeguard.sh/scan.

Quick check

Is the default safe enough to expose env publicly?

No. Even masked, the endpoint reveals configuration structure. Only health is exposed over HTTP by default for that reason.

Who sees values with when-authorized and no roles set?

Any authenticated user, according to the Spring Boot docs.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.