Skip to content

Commit 43a3fbf

Browse files
committed
Move "Sanitize Sensitive Values" in docs
Closes gh-35917
1 parent 8a27326 commit 43a3fbf

File tree

4 files changed

+41
-33
lines changed

4 files changed

+41
-33
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/env.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ The resulting response is similar to the following:
1414

1515
include::{snippets}/env/all/http-response.adoc[]
1616

17+
NOTE: Sanitization of sensitive values has been switched off for this example.
1718

1819

1920
[[env.entire.response-structure]]
@@ -37,7 +38,7 @@ The resulting response is similar to the following:
3738

3839
include::{snippets}/env/single/http-response.adoc[]
3940

40-
41+
NOTE: Sanitization of sensitive values has been switched off for this example.
4142

4243
[[env.single-property.response-structure]]
4344
=== Response Structure

spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/endpoints.adoc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ The following technology-agnostic endpoints are available:
3333

3434
| `configprops`
3535
| Displays a collated list of all `@ConfigurationProperties`.
36+
Subject to <<actuator#actuator.endpoints.sanitization, sanitization>>.
3637

3738
| `env`
3839
| Exposes properties from Spring's `ConfigurableEnvironment`.
40+
Subject to <<actuator#actuator.endpoints.sanitization, sanitization>>.
3941

4042
| `flyway`
4143
| Shows any Flyway database migrations that have been applied.
@@ -70,6 +72,7 @@ The following technology-agnostic endpoints are available:
7072

7173
|`quartz`
7274
|Shows information about Quartz Scheduler jobs.
75+
Subject to <<actuator#actuator.endpoints.sanitization, sanitization>>.
7376

7477
| `scheduledtasks`
7578
| Displays the scheduled tasks in your application.
@@ -277,6 +280,36 @@ NOTE: The `management.endpoint.<name>` prefix uniquely identifies the endpoint t
277280

278281

279282

283+
[[actuator.endpoints.sanitization]]
284+
=== Sanitize Sensitive Values
285+
Information returned by the `/env`, `/configprops` and `/quartz` endpoints can be somewhat sensitive.
286+
All values are sanitized by default (that is replaced by `+******+`).
287+
Viewing original values in the unsanitized form can be configured per endpoint using the `showValues` property for that endpoint.
288+
This property can be configured to have the following values:
289+
290+
- `ALWAYS` - all values are shown in their unsanitized form to all users
291+
- `NEVER` - all values are always sanitized (that is replaced by `+******+`)
292+
- `WHEN_AUTHORIZED` - all values are shown in their unsanitized form to authorized users
293+
294+
For HTTP endpoints, a user is considered to be authorized if they have authenticated and have the roles configured by the endpoint's roles property.
295+
By default, any authenticated user is authorized.
296+
For JMX endpoints, all users are always authorized.
297+
298+
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
299+
----
300+
management:
301+
endpoint:
302+
env:
303+
show-values: WHEN_AUTHORIZED
304+
roles: "admin"
305+
----
306+
307+
The configuration above enables the ability for all users with the `admin` role to view all values in their original form from the `/env` endpoint.
308+
309+
NOTE: When `show-values` is set to `ALWAYS` or `WHEN_AUTHORIZED` any sanitization applied by a `<<howto#howto.actuator.customizing-sanitization, SanitizingFunction>>` will still be applied.
310+
311+
312+
280313
[[actuator.endpoints.hypermedia]]
281314
=== Hypermedia for Actuator Web Endpoints
282315
A "`discovery page`" is added with links to all the endpoints.

spring-boot-project/spring-boot-docs/src/docs/asciidoc/anchor-rewrite.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,3 +1013,7 @@ data.nosql.elasticsearch.connecting-using-rest.webclient=data.nosql.elasticsearc
10131013
getting-started.first-application.code.enable-auto-configuration=getting-started.first-application.code.spring-boot-application
10141014
actuator.tracing=actuator.http-exchanges
10151015
actuator.tracing.custom=actuator.http-exchanges.custom
1016+
1017+
# gh-35917
1018+
howto.actuator.sanitize-sensitive-values=actuator.endpoints.sanitization
1019+
howto.actuator.sanitize-sensitive-values.customizing-sanitization=howto.actuator.customizing-sanitization

spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/actuator.adoc

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -34,38 +34,8 @@ See also the section on "`<<web#web.servlet.spring-mvc.error-handling, Error Han
3434

3535

3636

37-
[[howto.actuator.sanitize-sensitive-values]]
38-
=== Sanitize Sensitive Values
39-
Information returned by the `/env`, `/configprops` and `/quartz` endpoints can be somewhat sensitive.
40-
All values are sanitized by default (that is replaced by `+******+`).
41-
Viewing original values in the unsanitized form can be configured per endpoint using the `showValues` property for that endpoint.
42-
This property can be configured to have the following values:
43-
44-
- `ALWAYS` - all values are shown in their unsanitized form to all users
45-
- `NEVER` - all values are always sanitized (that is replaced by `+******+`)
46-
- `WHEN_AUTHORIZED` - all values are shown in their unsanitized form to authorized users
47-
48-
For HTTP endpoints, a user is considered to be authorized if they have authenticated and have the roles configured by the endpoint's roles property.
49-
By default, any authenticated user is authorized.
50-
For JMX endpoints, all users are always authorized.
51-
52-
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
53-
----
54-
management:
55-
endpoint:
56-
env:
57-
show-values: WHEN_AUTHORIZED
58-
roles: "admin"
59-
----
60-
61-
The configuration above enables the ability for all users with the `admin` role to view all values in their original form from the `/env` endpoint.
62-
63-
NOTE: When `show-values` is set to `ALWAYS` or `WHEN_AUTHORIZED` any sanitization applied by a `<<howto#howto.actuator.sanitize-sensitive-values.customizing-sanitization, SanitizingFunction>>` will still be applied.
64-
65-
66-
67-
[[howto.actuator.sanitize-sensitive-values.customizing-sanitization]]
68-
==== Customizing Sanitization
37+
[[howto.actuator.customizing-sanitization]]
38+
=== Customizing Sanitization
6939
To take control over the sanitization, define a `SanitizingFunction` bean.
7040
The `SanitizableData` with which the function is called provides access to the key and value as well as the `PropertySource` from which they came.
7141
This allows you to, for example, sanitize every value that comes from a particular property source.

0 commit comments

Comments
 (0)