Skip to content

Escape attestation details shown by contract info build - #2903

Open
fnando wants to merge 2 commits into
mainfrom
fix/info-build-escape-attestation-output
Open

fnando wants to merge 2 commits into
mainfrom
fix/info-build-escape-attestation-output

Conversation

@fnando

@fnando fnando commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

What

stellar contract info build now escapes control characters in the attestation details it prints: the workflow repository, ref and path, the git commit, the runner environment and the run URL. A new unit test covers all six fields.

Why

These values come from the attestation published under the repository named in the contract's source_repo metadata, and they were printed to the terminal unchanged. An attestation could include escape sequences that move the cursor, erase or rewrite earlier lines of output (such as the Source Repo line or the warning), or disguise link targets. After this change they show up as visible text like \x1b instead. The source_repo value read from the wasm metadata was already escaped.

Known limitations

The subject digest and the resolved dependency URI are compared in their raw form; the dependency URI is escaped only when it is shown in a repository-mismatch error.

@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Dec 1, 2026
@fnando
fnando requested review from a team and leighmcculloch and a lite review from Copilot December 1, 2026 00:35
@fnando fnando self-assigned this Dec 1, 2026
@fnando fnando moved this from Backlog (Not Ready) to Needs Review in DevX Dec 1, 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.

🟡 Changes recommended

A moderate active issue remains because an unescaped dependency URI can inject terminal control sequences into the CLI’s repository-mismatch error output.

1 open issue
What changed in this PR

This PR hardens stellar contract info build output by escaping control characters from author-controlled attestation fields before displaying them in the terminal. Resolved dependency URIs remain unsanitized when displayed in repository-mismatch errors.

Changes:

  • Added a reusable Serde deserializer that escapes control characters in six displayed attestation fields.
  • Applied escaping to workflow metadata, runner environment, commit, and invocation URL fields.
  • Added unit coverage for control-character sanitization across all six fields.
File Description
cmd/​soroban-cli/​src/​commands/​contract/​info/​build.rs Escapes control characters in displayed attestation metadata, adds regression coverage, and retains an unsanitized resolved dependency URI on the repository-mismatch error path.

Review effort: Lite

@fnando
fnando force-pushed the fix/info-build-escape-attestation-output branch from a170b72 to c066245 Compare December 1, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

3 participants