Skip to content

Fix path traversal in network and alias names.#2443

Merged
fnando merged 5 commits into
mainfrom
validate-names-that-translate-to-paths
Mar 10, 2026
Merged

Fix path traversal in network and alias names.#2443
fnando merged 5 commits into
mainfrom
validate-names-that-translate-to-paths

Conversation

@fnando
Copy link
Copy Markdown
Member

@fnando fnando commented Mar 10, 2026

What

Ensure any network and alias names are properly validated everywhere.

Why

https://hackerone.com/reports/3596213

Known limitations

N/A

@fnando fnando requested review from a team and leighmcculloch March 10, 2026 18:43
@fnando fnando self-assigned this Mar 10, 2026
Copilot AI review requested due to automatic review settings March 10, 2026 18:43
@fnando fnando added bug Something isn't working cli Related to Soroban CLI labels Mar 10, 2026
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Mar 10, 2026
@fnando fnando moved this from Backlog (Not Ready) to Needs Review in DevX Mar 10, 2026
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

This PR aims to prevent path traversal by ensuring network names and contract alias names are validated before being used in config/alias file paths.

Changes:

  • Added centralized name validation plus new NetworkName/AliasName wrapper types and unit tests.
  • Switched several CLI command arguments (network add/rm, contract alias commands, contract deploy --alias) to use the validated wrapper types.
  • Added integration tests asserting path traversal inputs are rejected for key commands.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
cmd/soroban-cli/src/config/address.rs Adds validate_name and new NetworkName/AliasName types with tests.
cmd/soroban-cli/src/commands/network/add.rs Uses NetworkName for network add CLI arg parsing.
cmd/soroban-cli/src/commands/network/rm.rs Uses NetworkName for network rm CLI arg parsing.
cmd/soroban-cli/src/commands/keys/rm.rs Switches key removal name parsing to KeyName.
cmd/soroban-cli/src/commands/contract/deploy/wasm.rs Replaces old alias validator with AliasName parsing for --alias and default aliasing.
cmd/soroban-cli/src/commands/contract/deploy/asset.rs Replaces old alias validator with AliasName parsing for --alias.
cmd/soroban-cli/src/commands/contract/alias/add.rs Uses AliasName for alias CLI arg parsing and adjusts error construction.
cmd/soroban-cli/src/commands/contract/alias/remove.rs Uses AliasName for alias CLI arg parsing and adjusts error construction.
cmd/soroban-cli/src/commands/contract/alias/show.rs Uses AliasName for alias CLI arg parsing and adjusts error construction.
cmd/crates/soroban-test/tests/it/config.rs Adds integration tests ensuring traversal-like names are rejected.

Comment thread cmd/soroban-cli/src/commands/contract/alias/add.rs
Comment thread cmd/soroban-cli/src/config/address.rs Outdated
Comment thread cmd/soroban-cli/src/config/address.rs Outdated
Comment thread cmd/soroban-cli/src/commands/contract/deploy/wasm.rs
Comment thread cmd/soroban-cli/src/commands/contract/deploy/wasm.rs Outdated
Comment thread cmd/soroban-cli/src/commands/network/add.rs
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

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Comment thread cmd/soroban-cli/src/config/address.rs Outdated
Comment thread cmd/soroban-cli/src/config/address.rs Outdated
Comment thread cmd/soroban-cli/src/commands/keys/rm.rs
Comment thread cmd/soroban-cli/src/config/address.rs Outdated
Comment thread cmd/soroban-cli/src/config/address.rs Outdated
@fnando fnando enabled auto-merge (squash) March 10, 2026 20:01
@fnando fnando merged commit 78fdf1d into main Mar 10, 2026
178 of 193 checks passed
@fnando fnando deleted the validate-names-that-translate-to-paths branch March 10, 2026 20:16
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in DevX Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cli Related to Soroban CLI

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants