Repository navigation
fix(orcad): create the readiness file owner-only so its pairing token is not world-readable - #25809
Merged
OrcaWin merged 1 commit intoOct 6, 2026
Conversation
… 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.
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-readinessbefore 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, includingpairing.urlwith a working runtime-scope device token. The slot folder and~/.orca-remotestayed0755. 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 (
orcadLaunchCommandinsrc/main/ssh/orcad-remote-launch.ts) does the following, in order:umask 077first, so every file the launch creates is owner-only from the start.chmod 700on 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.chmod 600on the readiness file right after truncating it. This step is required: a truncating redirect keeps the mode an earlier build left, which is0644. It runs before orcad writes anything, so the token is never in a readable file.chmod 600on the PID file andorcad.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
chmodon top of the umask: slots from earlier builds already have0644files, and the umask only affects new files.~/.orca-remotealso covers readiness files in slots of older versions, which this launch never touches.chmodgates the launch.Sweep of other host-side files that carry secrets. I checked these by reading the code and found no other gaps:
<sock>.credential: created exclusively with mode0600, thenchmod 600. A file that isn't0600is never adopted. On Windows, the relay tightens it withicacls..windows-active-pipe-*markers: they hold a pipe name, not a secret.umask 077(orcad-remote-record-file.ts).0700.0600.orcad.logprints a token value.orcad.logwas already created after the umask.relay.logitself 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 anicaclsstep, 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.tsruns the real generated launch command underumask 022, with a stub entry that prints a readiness line. It covers three cases, and all three fail on the old command:0600.0644files and0755folders are tightened to0600and0700..orca-remoteis left alone.All orcad SSH suites pass (813 tests).
pnpm tc:nodeand the changed-code quality gate also pass. The lockfile is unchanged.Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)