Skip to content

Rpc header secret leak fix#2522

Merged
fnando merged 4 commits intomainfrom
rpc-header-secret-leak-fix
Apr 24, 2026
Merged

Rpc header secret leak fix#2522
fnando merged 4 commits intomainfrom
rpc-header-secret-leak-fix

Conversation

@fnando
Copy link
Copy Markdown
Member

@fnando fnando commented Apr 24, 2026

What

# BEFORE
$ STELLAR_RPC_HEADERS="Authorization Bearer secret" stellar network add foo
--rpc-url https://example.com --network-passphrase test
error: invalid value 'Authorization Bearer secret' for '--rpc-header <RPC_HEADERS>': invalid HTTP header: must be in the form 'key:value'

For more information, try '--help'.

# AFTER
$ STELLAR_RPC_HEADERS="Authorization Bearer secret" target/debug/stellar network add foo --rpc-url https://example.com --network-passphrase test
❌ error: invalid HTTP header: must be in the form 'key:value'

Why

Close https://github.com/stellar/stellar-cli-internal/issues/75

Known limitations

N/A

@fnando fnando self-assigned this Apr 24, 2026
Copilot AI review requested due to automatic review settings April 24, 2026 16:34
@fnando fnando added this to DevX Apr 24, 2026
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Apr 24, 2026
@fnando fnando enabled auto-merge (squash) April 24, 2026 16:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a secret-leak scenario where clap error messages could echo raw STELLAR_RPC_HEADERS / --rpc-header values by deferring header validation to application code and emitting a generic “invalid HTTP header” error instead.

Changes:

  • Change config::network::Args to collect raw RPC headers as Vec<String> and parse/validate later in Args::get.
  • Add an “always succeeds” clap value parser for Network::rpc_headers and introduce Network::validate_headers(); network add now calls it before writing config.
  • Add tests intended to ensure malformed header errors don’t expose secret values.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
cmd/soroban-cli/src/config/network.rs Defers RPC header parsing/validation to avoid clap echoing raw values; adds validation helpers and tests.
cmd/soroban-cli/src/commands/network/add.rs Validates headers before persisting a network to config.

Comment thread cmd/soroban-cli/src/config/network.rs
Comment thread cmd/soroban-cli/src/config/network.rs
Comment thread cmd/soroban-cli/src/config/network.rs
Comment thread cmd/soroban-cli/src/config/network.rs Outdated
@fnando fnando merged commit 8784259 into main Apr 24, 2026
213 checks passed
@fnando fnando deleted the rpc-header-secret-leak-fix branch April 24, 2026 18:42
@github-project-automation github-project-automation Bot moved this from Backlog (Not Ready) to Done in DevX Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants