Repository navigation
fix(ssh): refuse a migration request too large for the host's sealed frame before sending it - #30249
Conversation
…frame before sending it A manifest under the 768 KiB validation cap can still overflow the host's 1 MiB inbound frame once sealed (base64 adds a third), more so when a commit carries its blob list. The host answers such a frame by closing the socket, so the move failed with a lost answer. The catalog client now measures the request against REMOTE_RUNTIME_MAX_INBOUND_REQUEST_JSON_BYTES and refuses it with the existing 'too large' guidance, unsent.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
ELI5
When Orca moves an SSH host's saved projects onto its Orca server, it sends one big description of everything (the "manifest"). The server only accepts messages up to 1 MiB, and encryption makes a message about a third bigger. So a manifest that passed Orca's own size check could still be too big once encrypted. The server would then hang up mid-move and the user got an unclear failure. Orca now measures the encrypted size first and, if it won't fit, shows the existing "too large to move" message without sending anything.
What Changed
paramsoforcad.migration.stageCatalog,commitCatalog,catalogStateandabortCatalog, sent from the desktop'sorcad-migration-catalog-client. The cap that applies is the host's inbound WebSocket frame cap,REMOTE_RUNTIME_MAX_INBOUND_FRAME_BYTES(1 MiB,ws-transport.tsmaxPayload). It has been the same in every released host. Paired requests are sealed:MAX_ORCAD_MIGRATION_MANIFEST_BYTES). 768 KiB × 4/3 is exactly 1 MiB before the envelope, so a manifest near its cap overflowed the frame. AcommitCatalogthat also carriesexpectedBlobs(one descriptor per shell history and agent session moved) overflowed sooner.src/shared/remote-runtime-memory-limits.ts(the existing shared cap module, next to the frame cap it derives from) addsREMOTE_RUNTIME_MAX_INBOUND_REQUEST_JSON_BYTES: the largest request JSON that still fits the frame once sealed, ⌊1 MiB / 4⌋ × 3 − 128.orcad-migration-catalog-client.tsmeasures the exact params it is about to send against that budget, less a 1 KiB envelope reserve. It refuses before any request, including the status preflight, using the existingdescribeOversizedOrcadMigrationPayloadmessage, which ends in(orcad_migration_manifest_too_large). That function now takes the limit to name.Why
wire-byte-budgets.ts, becauseremote-runtime-memory-limits.tsalready owns these caps and a second module would duplicate it.Linked Issue
N/A. SSH hardening round 2, slice S10 (C4: a producer doesn't know the consumer's cap). Follows #30126.
Visual Proof
N/A: no UI change. The refusal reuses the existing "too large to move" message.
Testing
New
orcad-migration-catalog-client-frame-budget.test.tscovers three cases:With the guard disabled, the two refusal tests fail.
remote-runtime-memory-limits.test.tsseals a request at the new budget with the real legacy and v2 framings, and asserts both fit 1 MiB.src/main/ssh/orcad-migration*,orcad-runtime-conversion*,ssh-target-orcad-preflight*,src/shared/remote-runtime*andsrc/shared/orcad-migration*pass single-worker: 60 files, 502 tests.Ran the full local "static analysis and typecheck" job: clean.
Codex review (gpt-6.1-sol, high): clean, two rounds (the second on the head after a test typing fix).
Not verified live: reaching the band needs a host with about 760 KiB of saved state. The unit test drives the client with the real sizes.