wallet: keep RPC spend credentials out of env, argv and error strings #192
Loading…
Reference in a new issue
No description provided.
Delete branch "onionwire/t_79e98511-wallet-rpc-keep-spend-credentials-out-of"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What changed
Wallet::for_bootalready tries the storedWalletConfigfirst; the env path now emits a one-time notice(
ONIONWIRE_WALLET_RPC_LOGIN: environment is readable by other processes and lands in shell history; put it in the wallet setup screen instead)only when the login actually came from the environment. App-spawned children keep taking their creds from the sealed
wallet_childrecord (WalletChild::creds) — unchanged.Endpoint::redacted()/WalletClient::redacted_url()renderhttp://<redacted>:<redacted>@127.0.0.1:<port>/json_rpc;EndpointandWalletClienthave hand-writtenDebugimpls that use it; error/status copy now redacts the wholeuser:pass(redact_login), not just the password half.The dial URL still carries the real userinfo because
Wallet::from_urlneeds it.src/wallet_child.rs):--rpc-loginis visible in/proc/<pid>/cmdlineto same-uid processes becausemonero-wallet-rpchas no other credential channel. Mitigation: loopback-only bind, strong generated login, never a remote daemon.Threat-model row I would add (docs/THREAT_MODEL.md is owned by another card this round)
Tests
tests/wallet.rs::ping_401_error_carries_no_credential— a 401 on the authenticated retry returnswallet RPC digest rejected (HTTP 401) — the login does not match the child's --rpc-login(no password, nouser:pass, no URL userinfo).wallet::tests::env_login_warns_once_per_process_and_not_for_a_stored_config— one-shot gate;from_envwarns,for_boot(Some(stored))does not.wallet::tests::redacting_an_error_drops_the_whole_login_not_just_the_password,redacted_url_keeps_the_endpoint_and_drops_the_userinfo,wallet_debug_prints_no_login.wallet_child::tests::wallet_client_debug_and_redacted_url_hide_the_login.transfers_matchconjunctive pin already exists (tests/wallet.rs::transfers_match_empty_field_is_false) and is unchanged/green.src/node.rsorsrc/store.rschange;--trusted-daemonargv pin untouched (green).Verification
cargo test --locked --target x86_64-unknown-linux-gnu— all suites green (lib 166, wallet 62, zeroize 8, etc.).cargo clippy --locked --all-targets --target x86_64-unknown-linux-gnu -- -D warnings— clean.src/wallet.rs,src/wallet_child.rs,tests/wallet.rs.