Skip to content

Strip control characters from auth entry prompt - #2667

Merged
fnando merged 3 commits into
mainfrom
sanitize-auth-entry-display
Aug 4, 2026
Merged

Strip control characters from auth entry prompt#2667
fnando merged 3 commits into
mainfrom
sanitize-auth-entry-display

Conversation

@fnando

@fnando fnando commented Aug 4, 2026

Copy link
Copy Markdown
Member

What

Sanitize the attacker-influenced strings rendered by format_auth_entry in log/auth.rs. The function name (Fn:), each contract-function argument (Args:), and the CreateContractV2 constructor arguments are now passed through soroban_spec_tools::sanitize before display, so terminal-escape and other control bytes are escaped rather than emitted verbatim.

Why

Auth entries shown in the interactive signing prompt come from the RPC's simulateTransaction response. A top-level ScVal::Symbol argument and the function name were printed raw, so control characters (e.g. ANSI escapes) reached the terminal unescaped and could distort what the user sees before approving a signature. The rest of the codebase already sanitizes attacker-influenced output at the display site — log/event.rs, commands/events.rs, and arg_parsing.rs — so this brings the auth prompt in line with that convention. Because the escaping lives inside format_auth_entry, it covers all of its call sites at once (the prompt, --auto-sign, and both invalid-entry error messages). A regression test mirrors the existing log/event.rs test, asserting no control characters survive.

Known limitations

Sanitization is applied at the display site rather than at the boundary in soroban_spec_tools::to_string. Boundary-level hardening (sanitizing the top-level ScVal::Symbol arm, capping the rendered argument count, and resetting terminal state before the decision line) is left as possible follow-up defence in depth.

Copilot AI balanced review requested due to automatic review settings August 4, 2026 17:08
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Aug 4, 2026
@fnando fnando self-assigned this Aug 4, 2026
@fnando fnando moved this from Backlog (Not Ready) to Needs Review in DevX Aug 4, 2026

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.

Pull request overview

Sanitizes attacker-influenced auth-entry output before terminal display.

Changes:

  • Sanitizes function names, invocation arguments, and constructor arguments.
  • Adds a control-character regression test.

Comment thread cmd/soroban-cli/src/log/auth.rs
@fnando
fnando enabled auto-merge (squash) August 4, 2026 18:45
@fnando
fnando merged commit ab98bd3 into main Aug 4, 2026
229 checks passed
@fnando
fnando deleted the sanitize-auth-entry-display branch August 4, 2026 18:57
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in DevX Aug 4, 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