Skip to content

fix: mask WORKOS_API_KEY in debug env output - #277

Open
willporter-workos wants to merge 3 commits into
mainfrom
devin/1795032402-mask-debug-env-secrets
Open

willporter-workos wants to merge 3 commits into
mainfrom
devin/1795032402-mask-debug-env-secrets

Conversation

@willporter-workos

@willporter-workos willporter-workos commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

workos debug env printed WORKOS_API_KEY in full in both human and --json output, so pasting its output into a support ticket, issue, or CI log leaked a live management key. debug state already masks secrets by default behind --show-secrets; debug env now does the same.

  • ENV_VAR_CATALOG entries take an optional secret: true (set on WORKOS_API_KEY); runDebugEnv({ showSecrets }) passes those values through the existing maskSecret() unless --show-secrets is set.
  • JSON shape is unchanged; only the value is masked (sk_t****mnop).

From a bug bounty report (Plain T-26250), triaged as Low (the user has to share the output themselves). The report's other claim, that an existing credentials file with loose permissions is never tightened, doesn't hold up: every CLI version has written that file with 0o600.

Tests: added specs for human and JSON masking and for --show-secrets. lint, format, typecheck, and build pass. In the full bun run test run, ai-analysis.spec.ts failed once; it passes when run alone, both on main and on this branch.


Bug Bounty Triage opened this PR for Will
Implemented in session Triage CLI debug env API key leak report
Review with Devin · Open in Devin Desktop


Mask the key in human and JSON output by default, matching debug state,
and add --show-secrets to print it unredacted.

Co-Authored-By: Will Porter <will.porter@workos.com>
@greptile-apps

greptile-apps Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

workos debug env masks WORKOS_API_KEY in human and JSON output unless --show-secrets is supplied.

  • debug env masks the API key unless a user asks to show it.

Reviews (2) · Last reviewed commit: "fix: keep empty WORKOS_API_KEY reported ..." · Reviewed by Greptile

Comment thread src/commands/debug.ts Resolved
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Prompt hidden (unlisted session)

Comment thread src/commands/debug.spec.ts Outdated
process.env.WORKOS_FORCE_TTY = '1';

await runDebugEnv();
await runDebugEnv({ showSecrets: false });

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.

Can we add a test (or somehow otherwise ensure) that runDebugEnv() has showSecrets: false as the default? Right now it reads as thought true is the default because it's being explicitly passed.

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.

Done in 16c32fb. runDebugEnv now defaults to showSecrets = false, and the specs call runDebugEnv() with no argument, so the masking test checks the default directly. Only the --show-secrets test passes { showSecrets: true }.

devin-ai-integration Bot and others added 2 commits November 20, 2026 22:27
Co-Authored-By: Will Porter <will.porter@workos.com>
Co-Authored-By: Will Porter <will.porter@workos.com>

@devin-ai-integration devin-ai-integration Bot 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.

Devin Review found 1 finding. Devin automatically fixed it.

Fixed by Devin (1)
  • Empty API key reported as unset — An empty value now skips maskSecret, so it stays '' and counts as set. Added a spec for it.

View findings in Devin Review · Follow Devin's work

Devin Review

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants