Skip to content

fix(orcad): create the readiness file owner-only so its pairing token is not world-readable - #25809

Merged
OrcaWin merged 1 commit into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-orcad-readiness-mode
Oct 6, 2026
Merged

OrcaWin merged 1 commit into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-orcad-readiness-mode

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​105 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​105
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​24 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​21

ELI5

When Orca starts its managed server on an SSH host, the server writes a small "I'm ready" file. That file holds the login token clients connect with. Under the usual login settings, every other user on that machine could read it. Now only the owner can read it, and the folders that hold it are private too.

What Changed

Before: the launch command created .orcad-readiness before switching to owner-only file creation (umask 077). Under the common login umask of 022, the file came out -rw-r--r--. orcad then wrote its readiness line there, including pairing.url with a working runtime-scope device token. The slot folder and ~/.orca-remote stayed 0755. On a shared host with a traversable home folder, any other local account could read the token, connect to orcad's loopback port, and act as the user.

After: the launch command (orcadLaunchCommand in src/main/ssh/orcad-remote-launch.ts) does the following, in order:

  1. Runs umask 077 first, so every file the launch creates is owner-only from the start.
  2. Runs chmod 700 on the slot folder and on ~/.orca-remote. This step is best effort. The parent folder is only tightened when it really is .orca-remote, so a custom slot path never tightens an unrelated folder.
  3. Runs chmod 600 on the readiness file right after truncating it. This step is required: a truncating redirect keeps the mode an earlier build left, which is 0644. It runs before orcad writes anything, so the token is never in a readable file.
  4. Runs chmod 600 on the PID file and orcad.log. This step is best effort.

The state snapshot capture also sets its umask before creating the snapshot folder. Before, only the archive inside it was private.

Why

  • Why chmod on top of the umask: slots from earlier builds already have 0644 files, and the umask only affects new files.
  • Why also make the folders private: a private ~/.orca-remote also covers readiness files in slots of older versions, which this launch never touches.
  • Which steps are best effort: only the folder, PID and log steps. A filesystem that refuses one of them should not block a launch. The readiness file holds the secret, so its chmod gates the launch.

Sweep of other host-side files that carry secrets. I checked these by reading the code and found no other gaps:

  • Relay <sock>.credential: created exclusively with mode 0600, then chmod 600. A file that isn't 0600 is never adopted. On Windows, the relay tightens it with icacls.
  • .windows-active-pipe-* markers: they hold a pipe name, not a secret.
  • Relay and orcad install or activation locks: they hold a boot id and an empty owner file, with no tokens.
  • Activation journal and records: on POSIX they are written under umask 077 (orcad-remote-record-file.ts).
  • Hook endpoint folder: 0700.
  • Relay PID file and session snapshot: 0600.
  • Logs: neither the relay log nor orcad.log prints a token value. orcad.log was already created after the umask.

relay.log itself is still created under the login umask. It holds no secrets, so this PR leaves it alone.

Windows: the orcad launcher's native addon creates the readiness file with default security. The file therefore inherits the ACL of the user-profile folder: the owner, SYSTEM and Administrators. That matches 0600. I didn't add an icacls step, and I couldn't test this on a Windows host.

Linked Issue

Found in the Phase 3 round-9 deep review (P1, confirmed by two reviewers). There is no separate issue.

Visual Proof

N/A. This is a file-permission change on the SSH host, shown in the tests below.

Testing

  • I manually tested these changes locally

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

  • src/main/ssh/orcad-remote-launch-file-modes.test.ts runs the real generated launch command under umask 022, with a stub entry that prints a readiness line. It covers three cases, and all three fail on the old command:

    • The readiness, PID and log files come out 0600.
    • Leftover 0644 files and 0755 folders are tightened to 0600 and 0700.
    • A parent folder that isn't .orca-remote is left alone.
  • All orcad SSH suites pass (813 tests). pnpm tc:node and the changed-code quality gate also pass. The lockfile is unchanged.

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: this is the fix.
  • SSH: all of this runs on the SSH host.
  • Compatibility: an existing slot is fixed on its next launch, and nothing else changes.

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)

… is not world-readable

orcadLaunchCommand truncated .orcad-readiness before setting umask 077, so under a
login umask of 022 the file that receives the pairing offer (with a runtime-scope
device token) came out 0644. umask 077 now runs first, the readiness file is
chmod 600 after the truncate (a redirect keeps an earlier build's 0644), the pid
and log files are tightened too, and the slot dir and ~/.orca-remote are chmod
700 so files earlier builds left readable are no longer reachable. The state
snapshot capture also sets its umask before creating the snapshot directory.
@OrcaWin
OrcaWin merged commit 0fe4f48 into OrcaWin/node-rt-phase3 Oct 6, 2026
59 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