Skip to content

fix(ssh): sign an SSH conversion's manifest as the host parses it - #32369

Merged
nwparker merged 1 commit into
mainfrom
nwparker/ssh-migration-sign-parsed-manifest
Oct 24, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/ssh-migration-sign-parsed-manifest

Conversation

@nwparker

@nwparker nwparker commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When Orca moves an SSH host's projects onto its managed server, it sends the server a list of what to move along with a fingerprint of that list. The server checks the fingerprint before accepting anything. Orca was fingerprinting one version of the list and then sending a slightly trimmed version, so the server refused it. Now Orca fingerprints exactly what it sends.

What Changed

  • Before: a conversion could fail with orcad_migration_manifest_digest_mismatch, and only worked again after Orca was restarted.
  • After: the conversion goes through. For any session that doesn't hit this case, the manifest and its digest are byte-for-byte what they were before.

Mechanism: createOrcadMigrationManifest used to hash the live export objects and then run them through parseOrcadMigrationManifest. That parser keeps only the fields it knows, so the manifest that went to the journal and the host could be smaller than what was hashed. It now hashes the parsed form of the JSON and returns that same object.

Why a restart helped: session:set stores the window's session as it arrives, without running the session schema. So a tab can carry a field the schema drops. The next load does run the schema, which removes the field, and after that the hash matches again.

Why

Hashing exactly what is sent and read back closes the whole class of mismatch: fields the parser drops, and values that serialize differently (anything with toJSON). The alternative was to list which fields to strip before hashing. That list would go stale every time the session shape changes.

Verification is unchanged. The host still checks the digest against the raw manifest it receives (orcad-migration.ts).

Mixed versions:

  • A new client with an old host works, because the host hashes the wire JSON, and the wire JSON is now exactly what was signed.
  • An old client with a new host behaves exactly as before.
  • Conversions already journaled by an older build resume from their stored manifest and are not re-signed.

Linked Issue

N/A (internal). Found while fixing the same failure in the WSL mover (#32343).

Visual Proof

N/A: no UI change. The only visible difference is that a conversion that used to fail now succeeds.

Testing

  • New test in orcad-migration-manifest-export.test.ts: a tab field the session schema drops. It fails on main with orcad_migration_manifest_digest_mismatch and passes here.

  • src/main/ssh/orcad-migration*, src/main/ssh/targets, migrating-orcad-catalog and moving-wsl-projects pass: 78 files, 715 tests.

  • The SSH golden manifest digest is unchanged.

  • The full static job passes locally.

  • The managed-orcad Docker lane runs in CI.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

  • Codex review (gpt-6.1-sol, high): clean.
  • Independent Opus review: no P0–P2. It checked:
    • that the signing and verify paths use the same canonical serializer;
    • that the size-limit check is still exact (the placeholder digest is the same length);
    • that parsing twice gives the same result;
    • that frozenSourceDigest agrees more often than before, not less.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: the digest is an integrity check. Signing and verification still use one serializer, and the host still verifies the raw wire manifest.
  • Platforms: SSH and WSL conversions share this code. macOS, Linux and Windows are unaffected otherwise.
  • Mobile: no effect.
  • Older journals: a source-cutover journal written by an older build that hit this bug keeps its old digest, so that one conversion still needs to be restarted.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 57b824dd-2575-4131-af76-08ccfae45ca5
Commits

Reviewing files that changed from the base of the PR and between 1a8798b and e453aad.

Files selected for processing: 1
  • src/main/ssh/orcad-migration-manifest-export.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Walkthrough

The export function now parses the JSON-serialized unsigned manifest with a 64-character zero digest placeholder before computing the final digest from the parsed manifest. A test covers a dormant session tab with an extra runtime-only field and verifies digest validation on the serialized manifest.

Priority: Normal

Merge Risk: Minimal · up to e453a

The new test protects against digest mismatches caused by parser-dropped session fields. No merge-blocking issue was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: signing the SSH conversion manifest after parsing it as the host does.
Description check Passed The description is complete and relevant. It explains the failure, the user-visible result, the implementation, rationale, compatibility behavior, testing, security, platform impact, and checklist sta…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is complete and relevant. It explains the failure, the user-visible result, the implementation, rationale, compatibility behavior, testing, security, platform impact, and checklist status. The internal linked-issue exception is addressed with an explicit N/A.

Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The conversion hashed the exported objects, but the manifest parser keeps only the fields it knows.
A runtime-only field in the live session (gone after the next load) made the conversion's own
journal and the host refuse the digest until the app restarted. Sign the parsed form of the JSON.
Manifests without such a field sign exactly as before.

Co-Authored-By: Claude <[email protected]>
@nwparker
nwparker force-pushed the nwparker/ssh-migration-sign-parsed-manifest branch from 1a8798b to e453aad Compare October 24, 2026 20:37
@nwparker
nwparker merged commit 7a0c7af into main Oct 24, 2026
92 of 95 checks passed
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.

1 participant