Skip to content

Follow top-level links of harness read roots - #72

Merged
LikC1606 merged 1 commit into
mainfrom
fix/readable-root-links
Nov 29, 2026
Merged

LikC1606 merged 1 commit into
mainfrom
fix/readable-root-links

Conversation

@LikC1606

Copy link
Copy Markdown
Collaborator

Problem

The home allowlist from #71 grants each readableRoots entry (the solver app root) but does not follow symlinks inside it. A development worktree outside the home links node_modules -> ~/theorem-os/node_modules, so inside the sandbox that directory became an empty mask and import("zod") failed with Cannot find package 'zod'. Running from ~/theorem-os itself, or from the /opt/theorem-os image, was not affected.

Fix

harnessReadRoots now resolves the top-level symlinks of each extra read root and grants targets outside it. Only the top level is followed, because a full scan of a large app root would exhaust the link-scan budget. Credential paths are still masked inside every grant.

Tests

  • tests/harnessProcess.test.ts:
    • the bwrap integration test adds a worktree outside the home whose node_modules links into it, and reads a dependency through the link; a sibling secret in that checkout stays hidden;
    • the unit test checks that top-level links are followed, while nested, internal and dangling links are not.
    • Both tests fail without the fix.
  • tsc and bun scripts/build.ts pass. 51 related test files: 665 passed, 9 skipped.
  • Real-home probe: a dev worktree now sees all 48 node_modules entries and loads zod/smol-toml. sub2api files, ~/.codex/auth.json, ~/.ssh/known_hosts and math.env stay unreadable.

🤖 Generated with Claude Code

An app worktree outside the home links node_modules to a checkout inside
it. The allowlist granted the worktree but not the link target, so the
sandbox masked the dependencies and `import("zod")` failed. Resolve the
top-level symlinks of each extra read root; deeper links are not scanned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LikC1606
LikC1606 merged commit 46fe1ae into main Nov 29, 2026
4 checks passed
@LikC1606
LikC1606 deleted the fix/readable-root-links branch December 1, 2026 20:12
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