Skip to content

Commit ab91320

Browse files
🛡️ Sentinel: [CRITICAL] Fix command injection in run_bitcoin_cli
Co-authored-by: bitcoiner-dev <75873427+bitcoiner-dev@users.noreply.github.com>
1 parent 0e6cde9 commit ab91320

26 files changed

Lines changed: 1406 additions & 309 deletions

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@ All notable changes to this project will be documented in this file.
66

77
- No changes yet.
88

9+
## [0.3.0] - 2026-03-27
10+
11+
### Changed
12+
- Removed `quiet` mode from CLI surface and config plumbing:
13+
- removed `--quiet` global flag,
14+
- removed `ZINC_CLI_QUIET` env handling,
15+
- removed persisted config key `quiet`,
16+
- removed setup `--quiet-default`.
17+
- Updated command contract/docs to reflect the current global flag set.
18+
- Improved wallet/account config resolution and wallet-info consistency with effective runtime network/scheme values.
19+
- Improved wallet-info recency presentation in human output.
20+
21+
### Fixed
22+
- Fixed account-switch address preview paths to use receive index `0` consistently.
23+
- Refined offer/PSBT input-source handling and stdin conflict validation.
24+
- Updated dependency pin to `zinc-core = =0.1.2`.
25+
926
## [0.2.1] - 2026-03-26
1027

1128
### Fixed

COMMAND_CONTRACT_V1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This document defines the active `v1` command contract. It is additive with curr
2525

2626
## 3) Global Flags (Supported)
2727

28-
`--agent`, `--quiet`, `--yes`, `--password`, `--password-env`, `--password-stdin`, `--reveal`, `--data-dir`, `--profile`, `--network`, `--scheme`, `--esplora-url`, `--ord-url`, `--ascii`, `--no-images`, `--thumb`, `--no-thumb`, `--correlation-id`, `--log-json`, `--idempotency-key`, `--network-timeout-secs`, `--network-retries`, `--policy-mode`
28+
`--agent`, `--yes`, `--password`, `--password-env`, `--password-stdin`, `--reveal`, `--data-dir`, `--profile`, `--network`, `--scheme`, `--esplora-url`, `--ord-url`, `--ascii`, `--no-images`, `--thumb`, `--no-thumb`, `--correlation-id`, `--log-json`, `--idempotency-key`, `--network-timeout-secs`, `--network-retries`, `--policy-mode`
2929

3030
Global flags are supported both before and after command tokens.
3131

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "zinc-wallet-cli"
3-
version = "0.2.1"
3+
version = "0.3.0"
44
edition = "2021"
55
rust-version = "1.88"
66
license = "MIT"
@@ -76,7 +76,7 @@ tui-big-text = { version = "0.8.2", optional = true }
7676
figlet-rs = { version = "0.1.5", optional = true }
7777
supports-unicode = "3.0.0"
7878

79-
zinc-core = { version = "=0.1.1" }
79+
zinc-core = { version = "=0.1.2" }
8080
rand = { version = "0.8", optional = true }
8181
bip39 = { version = "2.1.0", optional = true }
8282
image = { version = "0.25.10", features = ["avif", "webp"] }

USAGE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ Environment defaults (optional):
3737
- `ZINC_CLI_DATA_DIR`
3838
- `ZINC_CLI_PASSWORD_ENV`
3939
- `ZINC_CLI_OUTPUT` (`human|agent`)
40-
- `ZINC_CLI_QUIET` (`1|true|yes|on`)
4140
- `ZINC_CLI_NETWORK`
4241
- `ZINC_CLI_SCHEME`
4342
- `ZINC_CLI_ESPLORA_URL`

src/cli.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ pub enum PolicyMode {
99
Strict,
1010
}
1111

12-
13-
1412
#[derive(Parser, Debug, Clone)]
1513
#[command(
1614
name = "zinc-cli",
@@ -21,13 +19,13 @@ pub struct Cli {
2119
#[command(subcommand)]
2220
pub command: Command,
2321

24-
25-
#[arg(long, global = true, help = "Agent mode (machine-readable JSON output)")]
22+
#[arg(
23+
long,
24+
global = true,
25+
help = "Agent mode (machine-readable JSON output)"
26+
)]
2627
pub agent: bool,
2728

28-
#[arg(long, global = true, help = "Suppress all non-error output")]
29-
pub quiet: bool,
30-
3129
#[arg(long, global = true, help = "Automatically say yes to prompts")]
3230
pub yes: bool,
3331

@@ -118,11 +116,7 @@ pub struct Cli {
118116
)]
119117
pub network_retries: u32,
120118

121-
#[arg(
122-
long,
123-
global = true,
124-
help = "Disable inscription thumbnails"
125-
)]
119+
#[arg(long, global = true, help = "Disable inscription thumbnails")]
126120
pub no_thumb: bool,
127121

128122
#[arg(
@@ -193,9 +187,6 @@ pub struct SetupArgs {
193187
pub default_esplora_url: Option<String>,
194188
#[arg(long)]
195189
pub default_ord_url: Option<String>,
196-
#[arg(long)]
197-
pub quiet_default: Option<bool>,
198-
199190
#[arg(long)]
200191
pub restore_mnemonic: Option<String>,
201192
#[arg(long)]

src/commands/account.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ pub async fn run(cli: &Cli, args: &AccountArgs) -> Result<CommandOutput, AppErro
2525
write_profile(&path, &profile)?;
2626

2727
let session = load_wallet_session(cli)?;
28-
let taproot_addr = session.wallet.peek_taproot_address(*index).to_string();
28+
// Display the first receive address for the active account.
29+
let taproot_addr = session.wallet.peek_taproot_address(0).to_string();
2930
let payment_addr = session
3031
.wallet
31-
.peek_payment_address(*index)
32+
.peek_payment_address(0)
3233
.map(|s| s.to_string());
3334

3435
Ok(CommandOutput::AccountUse {

src/commands/config.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub async fn run(cli: &Cli, args: &ConfigArgs) -> Result<CommandOutput, AppError
1717
"data_dir": cli.data_dir.as_ref().map(|p| p.display().to_string()).or(config.data_dir.clone()).unwrap_or_else(|| "~/.zinc-cli".to_string()),
1818
"password_env": cli.password_env.as_ref().or(config.password_env.as_ref()).cloned().unwrap_or_else(|| "ZINC_WALLET_PASSWORD".to_string()),
1919
"agent": cli.agent,
20-
"quiet": cli.quiet || config.quiet.unwrap_or(false),
2120
"defaults": {
2221
"network": config.network.clone(),
2322
"scheme": config.scheme.clone(),
@@ -35,7 +34,12 @@ pub async fn run(cli: &Cli, args: &ConfigArgs) -> Result<CommandOutput, AppError
3534
save_persisted_config(&config)?;
3635
Ok(CommandOutput::ConfigSet {
3736
key: field.as_str().to_string(),
38-
value: applied.as_str().unwrap_or("").to_string().replace("\"", "").to_string(),
37+
value: applied
38+
.as_str()
39+
.unwrap_or("")
40+
.to_string()
41+
.replace("\"", "")
42+
.to_string(),
3943
saved: true,
4044
})
4145
}

0 commit comments

Comments
 (0)