Skip to content

fix(cli): mask the api key typed at the nf login prompt - #334

Merged
Exeloo merged 2 commits into
mainfrom
fix/login-key-echo
Nov 22, 2026
Merged

Exeloo merged 2 commits into
mainfrom
fix/login-key-echo

Conversation

@Exeloo

@Exeloo Exeloo commented Nov 22, 2026

Copy link
Copy Markdown
Member

What does this PR do?

No linked issue: found during the testing-phase audit.

nf login asked for the API key with a plain text prompt, so the key stayed on screen as typed. It now uses a masked prompt (askSecret, password from @inquirer/prompts): each character shows as *, Ctrl+T can't reveal it, and an empty key is still refused. --api-key and the no-terminal behavior are unchanged. The registry docs page says so.

Merge danger

Low. Only the nf login prompt changes. Users get it with the next CLI release.

Follow-up issues

None.

Quality gate

Lane Result
Docs Pass: docs/docs/commands/registry.mdx
Correctness Pass after fixes (Ctrl+T reveal turned off, empty-key test added)
Performance Pass: same module already imported
Accessibility Pass: the error says what is wrong in words
Security Pass
Style Pass

How do you test this PR?

  • pnpm test:unit: 299 passed (askSecret: masked prompt, no reveal, empty answer refused, no terminal).
  • pnpm lint, tsc --noEmit: clean.
  • Manual: nf login in a terminal: the key shows as ***.

The prompt echoed the key, so it stayed on screen and in terminal recordings.
Ctrl+T showed the masked key in plain text. Also test that an empty key is rejected.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Nov 22, 2026
@Exeloo
Exeloo merged commit 5e843d1 into main Nov 22, 2026
9 checks passed
@Exeloo
Exeloo deleted the fix/login-key-echo branch November 22, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant