{"id":"XE-11573","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":1687,"title":"Desk CLI `keys init` / `keys show` accept the signer passphrase as a `--passphrase` command-line option — the XE-2213 class, fixed in the DAO CLI and the Go CLI but still open here","area":"other","claimed_tier":"minor","assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-13T05:54:58.784527+00:00","updated_at":"2026-11-20T13:00:00.550806+00:00","source_created_at":null,"told_at":"2026-11-20T13:00:00.575423+00:00","status_changed_at":"2026-11-20T13:00:00.558783+00:00","url":"https://bounty.xe.network/XE-11573","body":"## Relationship to XE-2213 (read before filing)\n\nXE-2213 is the **DAO CLI** instance of this defect class: a secret\ntaken on the command line is readable by every local user for as long\nas the process runs (`ps`, `/proc/<pid>/cmdline`) and is kept in shell\nhistory. It was fixed in the DAO CLI (`repos/dao/dao/cli.py`:\n`_secret()` — \"No command takes one as an option... This is the only\nfunction that reads one, so a new command cannot grow its own\") with a\nregression test (`repos/dao/tests/test_dao_core.py`,\n`test_no_command_takes_a_secret_as_an_argument`) that walks the DAO\ncommand tree and asserts zero secretish parameters — and explicitly\nasserts `keys show --passphrase x` exits 2 (rejected) on the DAO CLI.\n\nThe same class was fixed in the **Go CLI**: `repos/xe/cmd/xe/main.go:130`\nfatals with \"sign-block no longer takes a seed argument (it leaks via\nps/proc/shell history): rotate this seed and set XE_SEED instead\", and\nseeds now arrive only via the `XE_SEED` environment variable or key\nfiles (`:1252`, `:269`, `:1580`).\n\nThis report is the **desk CLI** instance — a third, separate codebase\n(`repos/desk/desk/cli.py`) with its own fix location. The desk CLI has\nno XE-2213 regression test (grep: zero mentions of XE-2213 anywhere\nunder `repos/desk`), and its `keys init` / `keys show` commands accept\nexactly the option the DAO test forbids.\n\nNearest neighbours, all different defects: XE-10207 (dao/desk\n`.env.example` ships a publicly-known signer passphrase — about the\nexample file's default value, not about a CLI option); XE-0915\n(Windows: `--passphrase` unusable, prompt hardcodes /dev/tty — about\nthe prompt transport, not about a cmdline option existing). Neither\nnames the desk CLI's `--passphrase` option.\n\nNote: XE-2213 itself is absent from the public ticket dataset\n(refreshed for this filing; neighbours XE-2157 and XE-2216 present;\nGET /v1/tickets/XE-2213 returns 404 \"no such ticket\"), so its body\ncould not be re-read here. Its scope is established from the in-repo\nevidence instead: both citations of XE-2213 in the tree are in\n`repos/dao` (`dao/cli.py` comments + the DAO regression test), and the\nfix it drove is DAO-CLI-only. Nothing in the tree suggests XE-2213\ncovered the desk CLI.\n\n## Summary\n\nThe desk CLI takes the service signer passphrase on the command line:\n`desk keys init --passphrase <secret>` and `desk keys show\n--passphrase <secret>` are accepted options\n(`repos/desk/desk/cli.py:55,72`), and `_passphrase()` (`:33-34`)\nprefers the explicit value over the environment or the prompt. The\npassphrase decrypts the desk keyfile, which holds the log-signing key\nand the vault key — the vault key seals every private report body and\nattachment on the desk. Any local user on the operator's machine or\ncontainer can read the passphrase from `/proc/<pid>/cmdline` while the\ncommand runs, and it persists in shell history afterwards. This is the\nexact failure XE-2213 named, on the one CLI that was never fixed.\n\n## Evidence (repo `desk` @ ab9df7f)\n\n1. `desk/cli.py:52-69` — `keys_init` declares `passphrase: str =\n   typer.Option(None)` (`:55`); `keys_show` (`:71-77`) declares the\n   same (`:72`). `_passphrase(explicit)` (`:33-34`) returns\n   `explicit or os.environ.get(\"DESK_SIGNER_PASSPHRASE\") or\n   getpass.getpass(...)` — the command-line value wins over both\n   safe paths.\n2. The rest of the desk CLI is clean, which makes these two options\n   the whole finding: a full parameter walk of the command tree (same\n   method as the DAO XE-2213 regression test) finds exactly two\n   secretish parameters in the entire CLI — these two. The GitHub\n   token arrives via settings/env only (`import-github`,\n   `import-internal`, `github-labels` refuse to run without\n   `GITHUB_TOKEN`); `import-triage` reads private bodies from a file.\n3. What the passphrase protects (`docs/DEPLOY.md:36`, `.env.example:32`):\n   \"it encrypts the keyfile that holds the log key and the vault key\";\n   the vault (`desk/vault.py`) seals private ticket bodies and\n   attachments with SecretBox under that key. A leaked passphrase +\n   a keyfile copy (or container access) opens every private report.\n4. Contrast with the two fixed siblings: the DAO CLI refuses the\n   option entirely (regression test asserts exit 2 for `keys show\n   --passphrase x`); the Go CLI fatals if a seed is passed as an\n   argument. The desk CLI is the only one of the three that still\n   takes a secret on its command line.\n\n## Reproduction (executed against the desk CLI at HEAD)\n\nWalked the real `desk.cli` Typer app (typer only; the CLI imports\nlazily, so no desk runtime deps were needed) and invoked it with\n`CliRunner` — the same two assertions the DAO XE-2213 test makes:\n\n```\nsecretish params: [('keys init', 'passphrase', ['--passphrase']),\n                   ('keys show', 'passphrase', ['--passphrase'])]\nkeys show --passphrase x -> exit_code: 1 (DAO XE-2213 test demands 2)\ncontrol --no-such-option -> exit_code: 2\nD5 PROVEN: desk CLI accepts --passphrase on keys init/show\n```\n\nExit 1 (not 2) means the option was accepted and parsed — the command\nproceeded past option parsing into execution (it then failed in this\nminimal environment on a missing unrelated import, `httpx`, long past\nthe point where an unknown option would have been rejected with exit\n2, as the control shows).\n\n## Why this is Minor, not higher\n\nDisclosure is local-only: it needs a second local user (or a reader of\nthe operator's shell history) on the machine or container where the\noperator runs `desk keys`. The passphrase alone is not sufficient —\nthe attacker also needs the keyfile (or equivalent access) to use it.\nAnd the exposure requires the operator to actually pass\n`--passphrase`; nothing in the docs tells them to, though the option\nis discoverable via `--help` and is the path of least resistance for\nscripted key management. Local secret disclosure with a narrow trigger\nand a partial payoff is Minor.\n\n## Suggested fix\n\nMirror the DAO CLI fix (XE-2213): delete the `passphrase` option from\n`keys_init` and `keys_show`, read the passphrase only from\n`DESK_SIGNER_PASSPHRASE` or `getpass.getpass`, and port the DAO\nregression test (`test_no_command_takes_a_secret_as_an_argument`) to\nthe desk test suite so no future command can grow a secret option.\n\n## Dup-check record\n\n- Dataset refreshed immediately before filing (1,828 tickets, max\n  XE-11557): title greps for `passphrase`, `desk CLI`, `command\n  line`, `cmdline`, `secret`, `history`, `show_locals`, `traceback`,\n  `retained`, `keys init/show`, `signer` — no desk-CLI `--passphrase`\n  ticket. Nearest: XE-10207 (.env.example default passphrase),\n  XE-0915 (Windows --passphrase prompt transport).\n- Live `q=` checks in the same session (passphrase, desk keys,\n  command line, cmdline, XE-2213, --passphrase, secret history,\n  show_locals, traceback, retained, desk CLI, ps /proc): no match.\n  `q=XE-2213` total=0; GET /v1/tickets/XE-2213 → 404.\n- Own 29 tickets: none on the desk CLI or passphrase handling.","patch_refs":[],"thread":[{"id":14378,"source":"desk","source_ref":"reply:12298","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-11573 and says what differs; it is read like any other.","created_at":"2026-11-20T13:00:00.550806+00:00"}]}