Skip to content

Mask secret-looking app environment variable values - #5834

Merged
norman-abramovitz merged 10 commits into
cloudfoundry:developfrom
nabramovitz:norm/feature/mask-app-env-vars
Aug 21, 2026
Merged

Mask secret-looking app environment variable values#5834
norman-abramovitz merged 10 commits into
cloudfoundry:developfrom
nabramovitz:norm/feature/mask-app-env-vars

Conversation

@nabramovitz

Copy link
Copy Markdown
Contributor

What

Masks secret-looking values on the app Variables tab so they are only displayed on explicit request:

  • Variables list: sensitive values render as •••••••• with a per-row Show/Hide toggle in the Value cell.
  • All Variables block: values are deep-masked (including leaves inside VCAP_SERVICES and friends), with a single Show secrets / Hide secrets toggle in the card header.
  • The edit dialog is intentionally left unmasked — opening Edit on a named variable is the explicit request, and masking there would break editing.

A value is considered sensitive when:

  • its name matches pass|secret|token|private|key|cred (full mask), or
  • it embeds credentials as scheme://user:pass@host (only the password is redacted, so host/port/path stay readable), or
  • it contains a PEM private-key block (-----BEGIN … PRIVATE KEY-----, any variant) — masked under any variable name. Certificate blocks are public material and stay visible.

These are the same heuristics the Service Keys page already uses; they now live in one shared module (toCredentialField / maskEnvValue), so both surfaces stay in lockstep. As a side effect this change also removes an existing leak: the old Value cell exposed the full raw value in its hover title tooltip.

Also in this PR

  • Deleted the env-var-view dialog component — orphaned by the earlier variable-editor rework, zero references (grep-verified with a positive control).
  • Accessible names for the new toggles (Show value for <name>, Show secrets in All Variables).

Testing

  • Unit: new specs for the classifier, the deep masker (nested objects/arrays, precedence, PEM variants, immutability), and the tab's masking projections. Full suite green.
  • e2e: two new Playwright tests (per-row toggle and block toggle) asserting the mask literal is shown and the seeded secret value is absent from the DOM until revealed; both pass against a live CF.
  • Live-verified twice in the running console against a real CF, including the add-variable flow: a secret-named variable and a PEM private key under an innocuous name (SERVER_CRT) both masked on first render.
  • make check gate green end to end.

Deliberate ceilings, recorded in code comments: masking is leaf-based (a credentials container is recursed, not blanket-masked — matching Service Keys), and PEM detection keys on the armor header, so raw base64/DER key material under an innocuous name is not caught.

@norman-abramovitz norman-abramovitz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@norman-abramovitz
norman-abramovitz merged commit fde6137 into cloudfoundry:develop Aug 21, 2026
23 checks passed
@nabramovitz
nabramovitz deleted the norm/feature/mask-app-env-vars branch August 21, 2026 06:31
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.

2 participants