Skip to content

feat: Secret Manager SanitizingFunction #4122#4346

Open
kioie wants to merge 3 commits intoGoogleCloudPlatform:mainfrom
kioie:feat/sanitize-secret-manager-actuator
Open

feat: Secret Manager SanitizingFunction #4122#4346
kioie wants to merge 3 commits intoGoogleCloudPlatform:mainfrom
kioie:feat/sanitize-secret-manager-actuator

Conversation

@kioie
Copy link
Copy Markdown
Contributor

@kioie kioie commented Mar 2, 2026

Description

This PR is a fix for #4122: secrets loaded from GCP Secret Manager were exposed in plain text via /actuator/env when management.endpoint.env.show-values was set to always or when-authorized.

Changes

  • Implements SanitizingFunction. When a property's unresolved value (from the PropertySource) contains a ${sm@...} or ${sm://...} reference, the resolved secret is replaced with the unresolved expression so the real secret is never surfaced.
  • Added a new @bean to auto-register the sanitizing function, guarded by @ConditionalOnClass(SanitizingFunction.class) so it only activates when spring-boot-actuator is on the classpath
  • Added testSanitizingFunctionBeanRegistered to verify the bean is present in the application context.

@kioie kioie requested a review from a team as a code owner March 2, 2026 14:30
@google-cla
Copy link
Copy Markdown

google-cla bot commented Mar 2, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@kioie kioie force-pushed the feat/sanitize-secret-manager-actuator branch from bfe0091 to 07f2e95 Compare March 2, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant