Skip to content

Harden MCP WebSocket frame length conversions - #29

Merged
beiwei30 merged 1 commit into
mainfrom
codex/rust-maintenance-p3-04-numeric-conversion
Aug 26, 2026
Merged

Harden MCP WebSocket frame length conversions#29
beiwei30 merged 1 commit into
mainfrom
codex/rust-maintenance-p3-04-numeric-conversion

Conversation

@beiwei30

Copy link
Copy Markdown
Owner

What changes

Replace lossy MCP WebSocket payload-length casts with checked conversions and typed protocol failures. Incoming peer-controlled lengths retain the 8 MiB limit and are rejected before platform-width conversion or allocation.

Add boundary coverage for 0, 125, 126, 65,535, 65,536, 8 MiB, 8 MiB + 1, and encoded u64::MAX, including a host-independent 32-bit bound proof.

Verification

Passed:

  • cargo test -p orbcode-mcp websocket_frame: 4 passed
  • cargo test -p orbcode-mcp: 137 unit, 27 stdio fixture, and 7 trust fixture tests passed
  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo check --workspace
  • cargo test --workspace
  • scripts/check-docs.sh
  • scripts/audit-public-surface.sh
  • scripts/audit-brand.sh
  • git diff --check

The focused cast_possible_truncation audit no longer reports the three approved WebSocket conversions. Existing deferred diagnostics in other owners remain unchanged.

Compatibility

  • No golden fixture under compat-fixtures/fixtures/ or tui/testdata/ changed.
  • No TypeScript-CLI compatibility name was renamed. scripts/audit-brand.sh passes.
  • No new public API was added. scripts/audit-public-surface.sh passes.
  • Behavioral change is covered by tests in orbcode-mcp.

Notes for the reviewer

P3-01 limits this maintenance slice to mcp/src/transport/websocket.rs. OAuth timing, tool buffers, protocol DTO widths, provider conversions, and TUI coordinates remain explicitly deferred.

CopilotAI lite review requested due to automatic review settings August 26, 2026 05:56

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@beiwei30
beiwei30 merged commit f4d0be5 into mainAug 26, 2026
2 checks passed
@beiwei30
beiwei30 deleted the codex/rust-maintenance-p3-04-numeric-conversion branch August 26, 2026 06:02
Sign up for freeto 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.

2 participants

@beiwei30