Skip to content

Add safety notes about docs fields in soroban-spec-rust#1650

Merged
leighmcculloch merged 4 commits intomainfrom
add-docs-field-safety-notes
Dec 17, 2025
Merged

Add safety notes about docs fields in soroban-spec-rust#1650
leighmcculloch merged 4 commits intomainfrom
add-docs-field-safety-notes

Conversation

@leighmcculloch
Copy link
Copy Markdown
Member

What

Add and update comments in soroban-spec-rust explaining why the "docs" fields from spec entries are intentionally not output as rustdocs in generated Rust code.

Why

Rustdocs can contain Rust code that gets executed. Generated code may come from untrusted WASMs with untrusted spec docs, creating a code execution risk.

We already have a comment about this in one of the files, but I wanted to put this important note at the top of all the files in this crate so it's present to anybody who's reading any of them.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances security documentation in the soroban-spec-rust crate by adding and updating comments that explain why the "docs" fields from spec entries are not output as rustdocs in generated Rust code. The changes address a critical security concern: rustdocs can contain and execute Rust code, and since generated code may originate from untrusted WASM files with untrusted spec documentation, outputting these docs as rustdocs would create a code execution vulnerability.

Key Changes:

  • Updated existing security comment in types.rs with clearer wording about the code execution risk
  • Added identical security comments to trait.rs and lib.rs to ensure the warning is visible in all files

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.

File Description
soroban-spec-rust/src/types.rs Updated the existing IMPORTANT comment with clearer explanation of the security risk
soroban-spec-rust/src/trait.rs Added new IMPORTANT comment at top of file to document security rationale
soroban-spec-rust/src/lib.rs Added new IMPORTANT comment at top of file to document security rationale

Comment thread soroban-spec-rust/src/lib.rs Outdated
Comment thread soroban-spec-rust/src/types.rs Outdated
Comment thread soroban-spec-rust/src/trait.rs Outdated
Comment thread soroban-spec-rust/src/lib.rs Outdated
Comment thread soroban-spec-rust/src/types.rs Outdated
Comment thread soroban-spec-rust/src/lib.rs Outdated
Comment thread soroban-spec-rust/src/types.rs Outdated
Comment thread soroban-spec-rust/src/trait.rs Outdated
Comment thread soroban-spec-rust/src/trait.rs Outdated
@leighmcculloch leighmcculloch marked this pull request as ready for review December 17, 2025 03:01
@leighmcculloch leighmcculloch added this pull request to the merge queue Dec 17, 2025
Merged via the queue into main with commit 500fa07 Dec 17, 2025
95 checks passed
@leighmcculloch leighmcculloch deleted the add-docs-field-safety-notes branch December 17, 2025 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants