fix(models): mask paste-token input in CLI auth prompt#90893
Conversation
The interactive 'Paste token for <provider>' prompt echoed the pasted bearer/setup token in cleartext because readPastedSecret was called with masked: false. Its sibling paste-api-key command already renders bullets. Flip the flag to masked: true so the secret routes through the styled password prompt. Masking is render-only; both prompt branches share normalizeSecretInput, so the stored profile value is unchanged. Reroute the paste-token unit tests onto the password mock and add a regression test asserting the masked prompt is used. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed June 14, 2026, 4:44 AM ET / 08:44 UTC. Summary PR surface: Source 0, Tests +13. Total +13 across 2 files. Reproducibility: yes. by source inspection and supplied proof: current main and Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow masking change after normal maintainer review and CI gating; the platform verification issues can remain follow-up spot checks rather than blockers for this helper flag change. Do we have a high-confidence way to reproduce the issue? Yes by source inspection and supplied proof: current main and Is this the best way to solve the issue? Yes. Flipping the existing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b1caba590631. Label changesLabel justifications:
Evidence reviewedPR surface: Source 0, Tests +13. Total +13 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Summary
What problem does this PR solve?
openclaw models auth paste-token --provider <p>echoes the pasted bearer/setup token in cleartext at the TTY prompt, exposing the secret to anyone who can see the screen.Why does this matter now?
This is the third and last of three audited credential-prompt TTY echo leak sites. The first two were fixed in PR #76693 (onboarding) and PR #90571 (gateway password / Repro B). This closes Repro C.
What is the intended outcome?
The
paste-tokenprompt renders as masked bullets, matching the already-masked sibling commandpaste-api-key.What is intentionally out of scope?
No changes to stored values — masking is render-only; the persisted auth profile value remains the real typed string.
What does success look like?
Running
openclaw models auth paste-token --provider anthropicshows a masked (bullet) prompt instead of cleartext echo.What should reviewers focus on?
The one-line change in
modelsAuthPasteTokenCommand(masked: false → true). Test reroutes fromclackTexttoclackPasswordmock. The new regression test that locks the masked routing.Linked context
Which issue does this close?
Closes # (none — discovered during credential-prompt audit)
Which issues, PRs, or discussions are related?
Related #76693 (onboarding password mask, merged)
Related #90571 (Repro B — gateway password mask, open)
Related #91059 (Repro A — gateway token mask, open)
Related #90894 ([verify] macOS TTY rendering)
Related #90895 ([verify] Linux TTY rendering)
Was this requested by a maintainer or owner?
No — discovered and fixed as part of a self-initiated credential-prompt audit.
Real behavior proof (required for external PRs)
Behavior or issue addressed:
paste-tokenechoes typed token in cleartext at the TTY promptReal environment tested: Windows 10 (build 19045.7291), native PowerShell window
Exact steps or command run after this patch:
pnpm openclaw models auth paste-token --provider anthropic— prompt renders bulletsEvidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output):
Observed result after fix: Token input renders as masked bullets instead of cleartext
What was not tested: macOS and Linux TTY rendering (see [verify] paste-token mask renders bullets on macOS (PR #90893) #90894, [verify] paste-token mask renders bullets on Linux (PR #90893) #90895)
Proof limitations or environment constraints: Windows-only repro environment.
@clack/promptspassword()is cross-platform; verify issues track macOS/Linux rendering separately.Before evidence (optional but encouraged):
Tests and validation
Which commands did you run?
pnpm checkfailed on pre-existing TypeScript errors inextensions/discord/src/(unrelated to this diff — confirmed viagit diff origin/main --name-onlyshowing onlysrc/commands/models/auth.tsandsrc/commands/models/auth.test.ts).What regression coverage was added or updated?
Added
"reads the pasted token through the masked password prompt"test that assertsclackPasswordis called andclackTextis not called. Rerouted 9 existing paste-token tests fromclackTextmock toclackPasswordmock.What failed before this fix, if known?
After flipping
masked: true, all 9 paste-token tests that primedclackTextfailed. Fixed by rerouting each toclackPassword.If no test was added, why not?
A regression test was added.
Risk checklist
Did user-visible behavior change? (
Yes/No)Yes — the
paste-tokenTTY prompt now masks input as bullets. The stored auth profile value is unchanged (masking is render-only;normalizeSecretInputruns in both paths).Did config, environment, or migration behavior change? (
Yes/No)No.
Did security, auth, secrets, network, or tool execution behavior change? (
Yes/No)Yes — improved: token is no longer visible in the terminal during entry. No behavioral change to auth logic.
What is the highest-risk area?
readPastedSecretdispatches topassword()vstext()purely off themaskedboolean. No other call site or stored value is affected.How is that risk mitigated?
The regression test locks the masked routing. The sibling
paste-api-keyalready usesmasked: trueas the reference implementation.Current review state
What is the next action?
Confirm CI is green, then flip to Ready for Review.
What is still waiting on author, maintainer, CI, or external proof?
Which bot or reviewer comments were addressed?
None yet (draft PR).
AI-assisted PR: