GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Strip control characters from `contract read` output by fnando · Pull Request #2672 · stellar/stellar-cli

Conversation

@fnando

@fnando fnando commented Aug 6, 2026

Copy link
Copy Markdown
Member

What

Sanitizes the key/value fields in stellar contract read's default (--output string) output so control and escape sequences can no longer reach the terminal unescaped. The per-entry record building is extracted into a small entry_record helper and the String branch now wraps soroban_spec_tools::to_string with soroban_spec_tools::sanitize. A regression test covers a top-level ScVal::Symbol carrying escape bytes.

Why

soroban_spec_tools::to_string returns raw, unescaped bytes for a top-level ScVal::Symbol, and the default output writes those straight to the terminal via the CSV writer. Every other output mode (JSON/XDR) already escapes its content, and the auth-entry signing prompt was hardened the same way in #2667. This applies the same defense-in-depth to the contract read display path so untrusted ledger content cannot smuggle terminal escape sequences into a user's terminal.

Known limitations

N/A

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI balanced review requested due to automatic review settings August 6, 2026 14:45
@github-project-automation github-project-automation Bot added this to DevX Aug 6, 2026
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Aug 6, 2026
@fnando fnando self-assigned this Aug 6, 2026
@fnando fnando moved this from Backlog (Not Ready) to Needs Review in DevX Aug 6, 2026
@fnando
fnando requested review from leighmcculloch and mootz12 August 6, 2026 14:46
Copilot started reviewing on behalf of fnando August 6, 2026 14:46
View session
Copilot AI reviewed Aug 6, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pull request overview

Sanitizes contract read string output to prevent terminal control-sequence injection.

Changes:

  • Extracts ledger-entry formatting into entry_record.
  • Sanitizes string-formatted keys and values.
  • Adds a unit regression test for malicious symbols.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread cmd/soroban-cli/src/commands/contract/read.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@fnando
Strip control characters from contract read output.
6e9435d
@fnando
fnando force-pushed the sanitize-contract-read-output branch from f69f615 to 6e9435d Compare August 10, 2026 18:03
mootz12
mootz12 approved these changes Aug 10, 2026
View reviewed changes
@fnando
fnando merged commit b8ef49e into main Aug 10, 2026
229 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@fnando
fnando deleted the sanitize-contract-read-output branch August 10, 2026 20:41
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in DevX Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@mootz12 mootz12 mootz12 approved these changes
@leighmcculloch leighmcculloch Awaiting requested review from leighmcculloch

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@fnando fnando

Labels

None yet

Projects

DevX
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@fnando @mootz12
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.