feat(pairing-cli): source --nsec - reads the key from stdin, never argv - #11
Open
lodar wants to merge 1 commit into
Open
feat(pairing-cli): source --nsec - reads the key from stdin, never argv#11lodar wants to merge 1 commit into
source --nsec - reads the key from stdin, never argv#11lodar wants to merge 1 commit into
Conversation
…argv
`buzz-pair source` transfers a real secret key. Today its only form is
`--nsec <bech32>`: an argv element, and argv is world-readable in
`/proc/<pid>/cmdline` for the entire life of the process — which for a `source`
session is up to the 120s it spends waiting for the target to show up. Any
local user, and anything that snapshots the process table, gets the key.
`--nsec -` takes the key from the first line of stdin instead. It is read before
any session I/O and through the same buffered `io::stdin()` handle the SAS
prompt already uses, a line at a time, so the interactive y/n answer is simply
the next line and the existing flow is unchanged:
{ printf '%s\n' "$nsec"; cat; } | buzz-pair source --nsec - --relay wss://...
`--nsec <bech32>` keeps working exactly as before; this only adds the `-` form.
The clap help text names both `-` and the word stdin so a caller can probe
`source --help` and refuse to hand a key to a build that does not support it.
Signed-off-by: lodar <markounik@gmail.com>
lodar
force-pushed
the
upstream-pr/pair-nsec-stdin
branch
from
August 26, 2026 03:05
b22f440 to
e73efa2
Compare
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.
buzz-pair sourcetransfers a real secret key. Today its only form is--nsec <bech32>— anargv element, and argv is world-readable in
/proc/<pid>/cmdlinefor the entire life of theprocess. For a
sourcesession that is up to the 120s it spends waiting for the target to showup. Any local user, and anything that snapshots the process table, gets the key.
The change
--nsec -takes the key from the first line of stdin instead. It is read before any sessionI/O and through the same buffered
io::stdin()handle the SAS prompt already uses, a line at atime — so the interactive y/n answer is simply the next line and the existing flow is unchanged:
{ printf '%s\n' "$nsec"; cat; } | buzz-pair source --nsec - --relay wss://relay.example.com--nsec <bech32>keeps working exactly as before; this only adds the-form.The clap help text names both
-and the word stdin, so a caller can probesource --helpandrefuse to hand a key to a build that does not support it. Help text and behaviour have to move
together, in both directions.
Testing
Graded on the original tree by a 10-arm harness, each arm a measurement rather than an assertion.
The two non-vacuity guards are (a) a released binary without the change failing the help probe,
and (b) a positive leak control that passes the key literally and does find it in
/proc/<pid>/cmdline— without that arm, "no key in argv" would prove only that the probe is blind.resolve_payloadreads real stdin, so the-path is not reachable from a unit test withoutrefactoring the read behind a trait; the harness covers it as a subprocess instead. Happy to add
that refactor if you'd prefer the coverage in-tree.