Skip to content

Hide the home from harness shells except an allowlist - #71

Merged
LikC1606 merged 1 commit into
mainfrom
fix/harness-home-allowlist
Nov 29, 2026
Merged

LikC1606 merged 1 commit into
mainfrom
fix/harness-home-allowlist

Conversation

@LikC1606

Copy link
Copy Markdown
Collaborator

Problem

Harness shells (Claude Code, OpenCode, CLI, isolated Codex, the Lean health check, and Codex worker shells) read / read-only and masked only a fixed list of credential stores (HOST_CREDENTIAL_PATHS). A secret anywhere else in the home stayed readable, for example ~/services/sub2api/*.

Change

The bwrap launch (prepareHarnessProcess) and the Codex math-worker permission profile (mathWorkerPermissionConfig) now mask each home around an allowlist (harnessReadRoots + hostPrivateRoots). The allowlist contains:

  • the launch's workspace, profile, executable and Lean lock;
  • PATH entries, with the installation prefix of each bin (never a home or its .local); every hop of user-owned launcher symlinks; node package trees;
  • the Lean, cache, tool, retrieval and proof-environment roots the environment names; ~/.elan when ELAN_HOME is unset; and the new deployment setting DEEPSCIENTIST_MATH_SANDBOX_READ_ROOTS;
  • a script launcher's #! interpreter;
  • symlink targets inside the workspace and profile (.lake/packages, git worktree metadata);
  • the new readableRoots session option. Solver sessions (research.ts, agentTeam.ts ×2) set it to the app root and the research tool directory, because worker shells run bun <root>/bin/math.ts and out/main/check-lean.js.

Credential stores stay masked even inside allowed paths. User-owned link targets outside the home are masked at their real paths; root-owned targets (e.g. /usr/bin) are left alone. Codex does not reopen read under none, so the home is denied entry by entry around the allowed paths. The isolation receipt gains homeReadRoots.

Known limits: only homes are allowlisted. /data/... content not reached through a home link stays readable, and home entries created after launch are not masked. The sealed (readIsolation) path is unchanged.

Verification

  • tsc --noEmit passes, and bun scripts/build.ts passes.
  • Vitest over the 99 test files that import the changed modules: 1970 passed, 5 failed. The 5 failures are all in tests/formalizationReviewCli.test.ts and fail the same way on origin/main d4da8caa.
  • New tests: bwrap integration (unlisted home secrets, credential stores and linked stores are unreadable; PATH tool, default elan and readableRoots stay readable); unit tests for harnessReadRoots and hostPrivateRoots; an updated Codex profile expectation.
  • Real-home probe inside bwrap on this host (539 masks):
    • Unreadable: ~/services/sub2api/*, ~/.ssh/known_hosts, ~/.bashrc, ~/.codex/auth.json.
    • Working: lean 4.31.0, lake, node, bun, gp, cvc5, math-python (sympy), python3, git, codex --version, claude --version, bun ~/theorem-os/bin/math.ts --help, reading out/main/check-lean.js.

Not deployed. Running solvers were not touched.

🤖 Generated with Claude Code

Harness shells ran with `/` read-only and masked a fixed list of credential
stores, so a secret in any other home directory (for example a relay's
key files) stayed readable. Both the outer bwrap launch and the Codex
math-worker permission profile now mask every home around an allowlist:

- the launch's workspace, profile, executable and Lean lock;
- PATH entries with the installation prefix of each bin directory, every
  hop of user-owned launcher symlinks and their node package trees;
- Lean, cache, tool, retrieval and proof-environment roots the environment
  names, the default ~/.elan when ELAN_HOME is unset, and
  DEEPSCIENTIST_MATH_SANDBOX_READ_ROOTS;
- a script launcher's #! interpreter;
- symlink targets in the workspace and profile (.lake packages, git
  worktree metadata);
- the new readableRoots session option, which solver sessions set to the
  application root and research tool directory.

Credential stores stay masked inside allowed paths, and user-owned link
targets outside the home are masked at their real paths. The isolation
receipt records homeReadRoots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LikC1606
LikC1606 merged commit b7c8c56 into main Nov 29, 2026
4 checks passed
@LikC1606
LikC1606 deleted the fix/harness-home-allowlist 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