Repository navigation
fix: mask WORKOS_API_KEY in debug env output - #277
willporter-workos wants to merge 3 commits into
Conversation
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>
[Low impact] The PR appears safe to merge. Summary
Reviews (2) · Last reviewed commit: "fix: keep empty WORKOS_API_KEY reported ..." · Reviewed by Greptile |
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
Prompt hidden (unlisted session) |
| process.env.WORKOS_FORCE_TTY = '1'; | ||
|
|
||
| await runDebugEnv(); | ||
| await runDebugEnv({ showSecrets: false }); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 }.
Co-Authored-By: Will Porter <will.porter@workos.com>
Co-Authored-By: Will Porter <will.porter@workos.com>
There was a problem hiding this comment.
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.
Summary
workos debug envprintedWORKOS_API_KEYin full in both human and--jsonoutput, so pasting its output into a support ticket, issue, or CI log leaked a live management key.debug statealready masks secrets by default behind--show-secrets;debug envnow does the same.ENV_VAR_CATALOGentries take an optionalsecret: true(set onWORKOS_API_KEY);runDebugEnv({ showSecrets })passes those values through the existingmaskSecret()unless--show-secretsis set.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 fullbun run testrun,ai-analysis.spec.tsfailed once; it passes when run alone, both on main and on this branch.Implemented in session Triage CLI debug env API key leak report
Review with Devin · Open in Devin Desktop