Skip to content

feat: Improve Secret inspection privacy and usage messaging#12

Merged
pierinho13 merged 1 commit into
mainfrom
modifying_secret_behaviour
Jul 21, 2026
Merged

feat: Improve Secret inspection privacy and usage messaging#12
pierinho13 merged 1 commit into
mainfrom
modifying_secret_behaviour

Conversation

@pierinho13

Copy link
Copy Markdown
Owner

Summary

This PR improves the kubectl-peek secret workflow by making Secret inspection safer and more explicit.

By default, the command now shows Secret values without performing usage discovery. Relationship discovery is only executed when explicitly requested.

Changes

Usage discovery is now opt-in

kubectl-peek secret no longer searches for or displays related resources by default.

Use:

kubectl-peek secret --show-usage

to discover and display resources that use, produce, or reference the selected Secret.

This also avoids unnecessary API calls and permission warnings when relationship discovery is not needed.

Secret values can be redacted

Secret values remain visible by default for backward compatibility.

Use:

kubectl-peek secret --show-values=false

to hide decoded values.

Redacted values keep the key name and display the original byte length:

password:
────────────────────────────────────────────────────────────
<redacted: 24 bytes>

Both options can be combined:

kubectl-peek secret --show-usage --show-values=false

Clearer message when no relationships are found

When usage discovery is enabled but no supported references are detected, the output now explains that the result is not a guarantee that the Secret is unused.

Example:

Used by:
  No references were found among the supported built-in resources and configured usage rules.
  This does not guarantee that the Secret is unused; unsupported resources, external systems, or unconfigured custom resources may still reference it.

Resulting behavior

kubectl-peek secret
  • Displays decoded Secret values.
  • Does not perform usage discovery.
  • Does not display the Used by section.
kubectl-peek secret --show-usage
  • Displays decoded Secret values.
  • Discovers and displays supported relationships.
kubectl-peek secret --show-values=false
  • Hides decoded values.
  • Displays the byte length for each Secret entry.
kubectl-peek secret --show-usage --show-values=false
  • Displays relationships.
  • Keeps Secret values redacted.

@pierinho13
pierinho13 merged commit 72aa65f into main Jul 21, 2026
2 checks passed
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