Skip to content

Accept strkey decode/encode input as an argument - #2757

Merged
leighmcculloch merged 3 commits into
mainfrom
strkey-accept-input-args
Sep 26, 2026
Merged

leighmcculloch merged 3 commits into
mainfrom
strkey-accept-input-args

Conversation

@leighmcculloch

Copy link
Copy Markdown
Member

What

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).

Copilot AI lite review requested due to automatic review settings September 26, 2026 00:07
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Sep 26, 2026
Comment thread cmd/soroban-cli/src/commands/strkey.rs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Argument-based JSON encoding bypasses the embedded CLI’s 10 KiB input limit.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Restores positional input support for stellar strkey decode and encode, with stdin fallback.

Changes:

  • Adds argument-aware strkey wrapper commands.
  • Updates command registration and help documentation.
  • Adds integration tests for argument and stdin behavior.
File Summary
FULL_HELP_DOCS.md Documents optional positional inputs.
cmd/​soroban-cli/​src/​commands/​strkey.rs Implements the compatibility wrapper; argument input must preserve the embedded 10 KiB guard.
cmd/​soroban-cli/​src/​commands/​mod.rs Registers the wrapper command.
cmd/​crates/​soroban-test/​tests/​it/​strkey.rs Tests argument and stdin paths.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/soroban-cli/src/commands/strkey.rs
Copilot AI review requested due to automatic review settings September 26, 2026 00:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Formatting and argument-size parity issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity

Open (2)
Previously missed (1)

In code that hasn't changed since last review

Medium severity 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.

Comment thread cmd/crates/soroban-test/tests/it/strkey.rs
Copilot AI review requested due to automatic review settings September 26, 2026 00:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Argument-based decode and encode paths do not enforce the embedded CLI’s input-size limits.

Review effort: Lite
Findings: None

Resolved since last review (2)
Previously missed (1)

In code that hasn't changed since last review

Medium severity 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.

@leighmcculloch
leighmcculloch enabled auto-merge (squash) September 26, 2026 02:11
@leighmcculloch
leighmcculloch merged commit 91dd041 into main Sep 26, 2026
204 of 244 checks passed
@leighmcculloch
leighmcculloch deleted the strkey-accept-input-args branch September 26, 2026 03:27
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