Fix path traversal in network and alias names.#2443
Merged
Conversation
Contributor
There was a problem hiding this comment.
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/AliasNamewrapper 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. |
leighmcculloch
approved these changes
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Ensure any network and alias names are properly validated everywhere.
Why
https://hackerone.com/reports/3596213
Known limitations
N/A