Skip to content

fix(link): identity-file refusal advice never reads as changing /tmp - #8722

Merged
lidge-jun merged 4 commits into
devfrom
fix/link-identity-file-guidance
Nov 13, 2026
Merged

lidge-jun merged 4 commits into
devfrom
fix/link-identity-file-guidance

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

Review nits from #8718 (the identity-file directory check of link.route/2). This PR changes text and tests only.

  • Fix advice cannot read as "change /tmp". For a key placed straight into /tmp, /var/tmp or /dev/shm, the identity_file_directory message said "chmod g-w,o-w on it", which reads as removing write access on /tmp (with sudo, that breaks the machine, and an agent on a cloud VM may run it). Both directory messages now offer a path that passes, or chmod go-w on a private folder of the user's or of the tool that chose the key's path. For a key whose path a tool such as GOAT chose, moving it would leave that tool without its key. They forbid any change to a shared or system directory such as /tmp (no chmod, no sticky bit) or to another user's symlink, even when the Home runs as root and could make it. The ancestor text is 441 characters.
  • go-w instead of g-w for a directory above the key: a 0777 directory is still refused after g-w. The umask 002 sentence now says such a folder is group-writable and refused for that reason, which stays true whichever chmod fixes it.
  • identity_file_unreadable is also the answer for a path that is too long or has too many symlinks. Its text now names both and says what to do: use a shorter path without symlink loops, and fix read access only on the user's own file or folder.
  • identity_file_permissions now adds: use a key file of this user's own; never chown another user's or the system's key.
  • Ownership qualifier: structure/remote-link.md's umask 002 example is now a folder the Home user owns. chmod go-w clears only its mode; the owner and every other path component must pass too.
  • Docs: the capability text, skill reference, guides (en and es, identical code spans) and structure/remote-link.md carry the same advice.
  • Tests: the exact strings for both directory messages and the symlink-loop message are pinned. The CLI refusal test asserts exit 1, and the Windows skip of the symlink-owner test states its reason (process.getuid does not exist there, so the walk trusts every owner).
  • Left as is, with a one-line comment: after a symlink target's .., the hint can name the wrong level (identity_file_directory versus identity_file_ancestor); the refusal itself still holds.

Verification

  • Final review: it found one P2, that the symlink clause said "replace it", which a Home running as root or an agent with sudo could do in a shared or system directory, plus P3s. All are fixed in the last commit. New cases pin the permissions text and a path component too long for the filesystem.

  • One review round (gpt-6.1-terra xhigh) found three issues, all fixed in the last commit. P2: "if it is yours" still fit /tmp for a Home running as root. P3: the ancestor message offered a chmod that cannot fix a symlink another user owns. P3: the structure doc's example lacked the ownership precondition. The exact-message test failed on the previous text before that commit.

  • Test-first: the exact-message and symlink-loop cases failed before the text change and pass after it. The CLI already exited 1; that assertion is tighter, not a fix.

  • bun test on the explicit-route suites (server, clients, paths, no-ssh-config, CLI), cli-link-enrollment, link-recover, skill-ocx and the Spanish docs test, with a temporary OPENCODEX_HOME: 326 pass, 1 skip (the Windows-only case), 0 fail.

  • bun run typecheck, structure:check, skill:surface:check, privacy:scan: pass.

NOT RUN: full bun run test; Windows.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

…hat is yours, or move the key

For a key placed straight into /tmp, /var/tmp or /dev/shm the directory message said 'chmod g-w,o-w on it', which reads as removing write access on /tmp. Both directory messages now say 'chmod go-w on it if it is yours, or move the key into a private directory such as ~/.ssh' (go-w, so a 0777 directory is fixed too), and identity_file_unreadable says the path may have too many symlinks. The capability text, skill reference, guides and structure carry the same advice; a comment notes that a target's '..' can make the hint name the wrong level.
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • 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

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Nov 13, 2026
…chmod on a shared or system directory

Review round on the previous wording:
- "chmod go-w on it if it is yours" still fit /tmp, /var/tmp or /dev/shm for a
  Home running as root, which owns them. Both directory messages now put moving
  the key first and allow chmod go-w only on a private directory of the user's,
  never a shared or system one, even as root.
- A symlink another user owns cannot be fixed by chmod: the ancestor message
  says to replace it or keep it off the path, and that the new path's every
  directory and symlink must pass (~/.ssh only if the home directory passes).
- structure/remote-link.md qualifies the umask 002 example: a folder the Home
  user owns, where chmod clears only the mode and the owner and every other
  path component must pass too.
…ctory or another user's symlink

Final-review round:
- The ancestor text said to replace a symlink another user owns, which a Home
  running as root or an agent with sudo could do in /tmp or a system
  directory. It now offers a path that passes, or chmod go-w on a private
  folder of this user's or of the tool that chose the path, and forbids any
  change (chmod, sticky bit, replacing) to a shared or system directory or to
  another user's symlink, even as root. 441 characters, down from 722.
- The directory text names the tool case: when a tool chose the key's path,
  fix that tool's own private folder or have it use a path that passes.
- identity_file_unreadable also covers a path that is too long, and says to use
  a shorter path without symlink loops and to fix read access only on this
  user's own file or folder.
- identity_file_permissions says to use a key of this user's own and never to
  chown another user's or the system's key.
- The Windows skip of the symlink-owner test states its one reason.
The capability text, skill reference, guides (en, es) and structure match.
@lidge-jun
lidge-jun marked this pull request as ready for review November 13, 2026 23:04
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 13, 2026 23:04
@lidge-jun
lidge-jun merged commit 68aa19a into dev Nov 13, 2026
34 of 36 checks passed
@lidge-jun
lidge-jun deleted the fix/link-identity-file-guidance branch November 13, 2026 23:04
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T23:05:52.200888Z 6a60ab5 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

lidge-jun added a commit that referenced this pull request Nov 15, 2026
…ntity-file texts; close #8694 remedy gaps (#8754)

* fix(link): refuse a route edit while a removal of the link is unfinished (#8678)

A route edit made after a failed revoke rewrote the link record without reading its retirement receipt, so every later revoke compared the edited record with the receipt copy and answered link_changed for good. handleLinkRouteEdit now refuses with 409 link_retirement_pending while a receipt is outstanding (an unreadable one counts), checked before the probe and again under the config mutation lock at the commit. ocx link routes names the way out, and the link_changed next step no longer says a current Home edit can cause it.

* docs(link): scope the identity-file refusal texts to this user (#8723)

P3-A..D from the #8722 review: chmod go-w only on a private folder this user owns (its own, or one a tool made for it), in the directory and ancestor texts and every copy; read access only with chmod u+r / u+rx and never group or other; chmod 600 only on a key of this user own, never chown or chmod another user or the system key. Updates the pinned strings and the two stale test comment/title nits.

* fix(link): close the remedy gaps the #8694 review left (#8696)

ocx-child: a bound detach accepts its own ownership record in phase cleanup complete (a detach killed inside release() between marking it and removing it), which only release() writes; covered by a kill test at that point. Residual steps name a copy placed by hand in ~/.local/bin (%USERPROFILE%\.local\bin on Windows), which discovery tries first; the plant purge says what a not-found binary means (server text, dashboard in all 11 locales, guides). The link add capability text labels Command Prompt, adds the USERPROFILE fallback, separates the lightweight step from ocx restart and says what to do when an older build refuses --expect-link. child_restart_unsupported says that ocx disconnect ends the link the machine uses now.

* test(gui): pin the residual purge not-found step in the Remote Link fixtures (#8696)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant