Repository navigation
fix(cli): never take secretKey or the facilitator key as an argument - #111
Merged
Merged
Conversation
`nirium config set secretKey <key>`, `config set facilitatorApiKey <key>` and `serve --api-key <key>` all put a credential in shell history and in `ps`. They now exit 1, save or use nothing, and say why. The values come from the environment (NIRIUM_SECRET_KEY / FACILITATOR_API_KEY), a hidden prompt on a terminal, or stdin when there is none. Same reasoning as #108. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Without a terminal and without FACILITATOR_API_KEY, `serve` read stdin until EOF, so an open pipe that never closed made it hang. It now stops waiting after 10 s and exits 1 with the missing-key error. NIRIUM_STDIN_TIMEOUT_MS overrides the 10 s (used by the test). `config set` still reads stdin without a limit: a slow secret manager piping into it is legitimate there. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Eras256
force-pushed
the
fix/cli-config-secret-no-argv
branch
from
October 11, 2026 08:48
0d0d094 to
9a41c6f
Compare
Eras256
marked this pull request as ready for review
October 11, 2026 08:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #108. Three more places took a credential as a command-line argument, where it stays in shell history and shows up in
ps:nirium config set secretKey <key>nirium config set facilitatorApiKey <key>nirium serve --api-key <key>/-kAll three now exit 1, save or use nothing, and explain why (including that the value just typed should be treated as exposed).
--api-keyis kept only as a hidden option so it can be refused with that message instead of commander's bare "unknown option"; it no longer shows inserve --help.Where the values come from now:
secretKey:NIRIUM_SECRET_KEY, ornirium config set secretKeywith no value (hidden prompt on a terminal, stdin otherwise). Only a validS...seed is saved.FACILITATOR_API_KEY,nirium config set facilitatorApiKey(same prompt/stdin), or a hidden prompt whenserveruns in a terminal and nothing else is set.The two "how to provide a key" messages and the README no longer suggest passing either key as an argument.
Breaking for anyone scripting these flags; it ships in 2.0.0 together with #108 and #109.
Stdin timeout
servewith no terminal and noFACILITATOR_API_KEYused to read stdin until EOF, so a pipe that never closes made it hang. It now waits at most 10 s, then exits 1 with the usual "Missing facilitator API key" error (measured: 10.9 s).NIRIUM_STDIN_TIMEOUT_MSoverrides the 10 s; the test uses it.config setstill reads stdin without a limit on purpose: a slow secret manager piping into it is legitimate there.Tests
npm testinpackages/cli: 26 pass, 0 fail (11 existing doctor tests, 8 config tests, 7 serve tests). Each test runs with its own temporaryHOME, so it never touches a real~/.niriumrc.json, andserveuses port 0 with no payment.The hidden-prompt path can't run under
node:test(no pseudo-terminal), so I checked it by hand throughscriptfor bothconfig set secretKeyandserve: the prompt shows, the value is used or saved, and it appears 0 times in the captured output.No CI runs on
packages/cli/**yet (#103), so the results above are local.Co-Authored-By: Claude Sonnet 5.5 noreply@anthropic.com
🤖 Generated with Claude Code