Skip to content

fix(api): redact secret search results - #2147

Merged
lbroudoux merged 1 commit into
microcks:masterfrom
gyanranjanpanda:fix/issue-2146-secret-search-redaction
Jun 8, 2026
Merged

lbroudoux merged 1 commit into
microcks:masterfrom
gyanranjanpanda:fix/issue-2146-secret-search-redaction

Conversation

@gyanranjanpanda

Copy link
Copy Markdown
Contributor

Summary

This updates GET /api/secrets/search so it applies the same sensitive-data redaction already used by the other secret read endpoints.

Non-admin users can still search and discover matching secrets, but the response no longer includes credential values such as username, password, token, or caCertPem. Admin users continue to receive complete secret data.

Root cause

listSecrets() and getSecret() both check whether the caller has the admin role before returning secret data. searchSecrets() did not receive UserInfo, skipped that role check, and returned raw repository results directly.

Validation

Added SecretControllerTest coverage for both non-admin and admin search responses.

mvn -pl webapp -am -Dtest=SecretControllerTest -Dsurefire.failIfNoSpecifiedTests=false test

Fixes #2146

@gyanranjanpanda
gyanranjanpanda marked this pull request as ready for review June 5, 2026 21:38
@lbroudoux lbroudoux added this to the 1.15.0 milestone Jun 8, 2026

@lbroudoux lbroudoux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes related to SecretControlle are ok but there are other changes because your branch is probably not up-to-date with master. Please rebase your branch before resubmitting this PR.

@gyanranjanpanda
gyanranjanpanda force-pushed the fix/issue-2146-secret-search-redaction branch from 132c8ea to da97ad5 Compare June 8, 2026 13:17
@gyanranjanpanda

Copy link
Copy Markdown
Contributor Author

check this now @lbroudoux

@lbroudoux

lbroudoux commented Jun 8, 2026 •

Copy link
Copy Markdown
Member

check this now @lbroudoux

All good! Thanks for quick reply.

@lbroudoux lbroudoux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@lbroudoux
lbroudoux merged commit 0d60ce6 into microcks:master Jun 8, 2026
9 of 10 checks passed
@gyanranjanpanda
gyanranjanpanda deleted the fix/issue-2146-secret-search-redaction branch June 9, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GET /api/secrets/search returns unredacted credentials to non-admin users

2 participants