Skip to content

security(cli): prefer file/stdin/env over --private-key argv (#4032) - #4096

Open
Chessing234 wants to merge 6 commits into
block:mainfrom
Chessing234:security/private-key-file-deprecation
Open

security(cli): prefer file/stdin/env over --private-key argv (#4032)#4096
Chessing234 wants to merge 6 commits into
block:mainfrom
Chessing234:security/private-key-file-deprecation

Conversation

@Chessing234

Copy link
Copy Markdown
Contributor

Summary

  • Adds --private-key-file and --private-key-stdin; keeps BUZZ_PRIVATE_KEY.
  • Warns when --private-key appears on argv (shell history / ps).
  • Docs: CLI README, SECURITY.md, AGENTS.md, TESTING.md.

Fixes #4032

Test plan

  • cargo test -p buzz-cli private_key
  • cargo test -p buzz-cli cli_definition_is_valid
  • buzz --private-key-file /tmp/nsec channels list (with valid key)
  • printf '%s' "$NSEC" | buzz --private-key-stdin channels list
  • buzz --private-key nsec1… … prints deprecation warning

Made with Cursor

@Chessing234
Chessing234 requested a review from a team as a code owner August 1, 2026 11:19
@Chessing234
Chessing234 force-pushed the security/private-key-file-deprecation branch from 5a71669 to 62b1396 Compare August 1, 2026 11:52
@Chessing234

Copy link
Copy Markdown
Contributor Author

Rebased with Signed-off-by so DCO Check is green.

Implements preference order and argv detection so --private-key can be
deprecated without dropping BUZZ_PRIVATE_KEY support (block#4032).

Signed-off-by: Taksh <takshkothari09@gmail.com>
Wires the new flags through clap and run(), warning when the secret is
passed on argv into shell history / process listings.

Signed-off-by: Taksh <takshkothari09@gmail.com>
Documents the safer identity sources and links block#4032 for the argv leak.

Signed-off-by: Taksh <takshkothari09@gmail.com>
Cross-links block#4032 next to the existing BUZZ_PRIVATE_KEY keyring guidance.

Signed-off-by: Taksh <takshkothari09@gmail.com>
Keeps the manual test script aligned with the safer auth sources.

Signed-off-by: Taksh <takshkothari09@gmail.com>
Keeps agent docs aligned with the block#4032 argv deprecation.

Signed-off-by: Taksh <takshkothari09@gmail.com>
@Chessing234
Chessing234 force-pushed the security/private-key-file-deprecation branch from 62b1396 to e9ee13a Compare August 2, 2026 03:58
@Chessing234

Copy link
Copy Markdown
Contributor Author

Rebased onto latest upstream/main with Signed-off-by on all commits and force-pushed. CI should re-run shortly — still ready for @block/buzz-oss-team review when you have bandwidth.

@Chessing234

Copy link
Copy Markdown
Contributor Author

@tlongwell-block @wesbillman @wpfleger96 mind taking a look when you get a chance?

@Chessing234

Copy link
Copy Markdown
Contributor Author

still green on tip — this one is the argv private-key leak fix. @tlongwell-block if you get a spare slot on security-ish cli stuff, a look would help a lot.

@Chessing234

Copy link
Copy Markdown
Contributor Author

@atishpatel @michaelneale if you have a minute — this is the --private-key argv leak fix (#4032). small, focused, dco green. a quick look would help a lot.

@Chessing234
Chessing234 force-pushed the security/private-key-file-deprecation branch from e9ee13a to d0069a6 Compare August 5, 2026 10:34
@Chessing234

Copy link
Copy Markdown
Contributor Author

@wesbillman this is the --private-key argv leak fix — small and security-relevant. mind reviewing / merging if it still looks good?

@idk-its-unknown

Copy link
Copy Markdown

We hit the same need and independently implemented essentially this design on a fork — --private-key-file on the CLI plus a BUZZ_PRIVATE_KEY_FILE env fallback — and it is now running in production.

Context: we run a 12-agent Buzz fleet on one host, each agent a systemd service. Env-passed BUZZ_PRIVATE_KEY was our biggest operational sore spot: our agent harness sanitizes secret env vars out of tool subprocesses, and env-visible keys are one /proc/<pid>/environ read away from cross-agent identity forgery (we had a real incident of one agent publishing as another). A file-based key (0600) referenced per-unit via Environment=BUZZ_PRIVATE_KEY_FILE=… drop-ins fixed both.

Verification on our fork (fleet-fixes-2026-08-15, base 78cbffeb): 358 buzz-cli tests green on Linux including a keyfile-permissions test; deployed 2026-08-16; every agent's publishing re-verified with its own key (reply signatures checked on the relay wire), zero auth errors.

Two notes that may help this land:

The branch also ships patch-maint/ — the drop-on-adoption carry tooling we use to track exactly this PR and drop our commit the day it merges — plus deployment notes (systemd drop-ins, rollout order), if useful as a reference for anyone running a patched build pre-merge. Would love to see this reviewed — for multi-agent fleets it's a real security boundary, not a convenience flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security: --private-key as a CLI argument leaks the key into shell history and process listings

2 participants