You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wrap the embedded strkey CLI so that stellar strkey decode and stellar strkey encode accept their input as an argument again, falling back to stdin when it is omitted.
Why
Updating stellar-strkey to 0.0.18 in #2614 made the embedded CLI read that input only from stdin, which breaks existing scripts that run stellar strkey decode <STRKEY> or stellar strkey encode <JSON>.
Known limitations
The argument path copies the embedded CLI's decode and encode logic, with a test checking that both paths stay in sync, until the wrapper is deleted at the next major version (v29/30).
Enforce input size limit before decoding argument values
cmd/soroban-cli/src/commands/strkey.rs:61
The embedded decoder enforces Strkey::MAX_ENCODED_LEN + 16 before trimming and returns InputTooLarge, but this argument path has no equivalent check. Consequently an oversized value can succeed here while the same bytes piped to stdin are rejected, and the argument path can make serde/strkey parsing process much more input than the embedded CLI allows. Apply the same pre-trim bound before decoding.
Reject oversized decode argv input before trimming or parsing
cmd/soroban-cli/src/commands/strkey.rs:56
This argument path bypasses the decode::Cmd input bound (Strkey::MAX_ENCODED_LEN + 16) used by the embedded v0.0.18 CLI. A sufficiently large argv is then cloned into decode::Error::Decode, allowing substantially larger intermediate allocations and making the argument and stdin paths diverge; reject oversized input with decode::Error::InputTooLarge before trimming/parsing, as the embedded command does.
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
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
Wrap the embedded strkey CLI so that
stellar strkey decodeandstellar strkey encodeaccept their input as an argument again, falling back to stdin when it is omitted.Why
Updating stellar-strkey to 0.0.18 in #2614 made the embedded CLI read that input only from stdin, which breaks existing scripts that run
stellar strkey decode <STRKEY>orstellar strkey encode <JSON>.Known limitations
The argument path copies the embedded CLI's decode and encode logic, with a test checking that both paths stay in sync, until the wrapper is deleted at the next major version (v29/30).