Skip to content

feat(hermes): sandbox macOS local terminal away from secret files (RIG-11734) - #245

Open
rigel-mintaka wants to merge 1 commit into
mainfrom
harness/rig-11734-sandbox-macos-local-terminal-away-from
Open

rigel-mintaka wants to merge 1 commit into
mainfrom
harness/rig-11734-sandbox-macos-local-terminal-away-from

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What does this do

On macOS, local terminal commands now run under sandbox-exec, with a profile that hides Hermes's secret files from the command.

  • Denies read, write and link on .env, .op.env, auth.json, auth.lock and .rr-token, in resolved and unresolved forms.
  • Denies read and write on the folders mcp-tokens/, vault/, browser-profile/ and webapp/.
  • config.yaml is write-denied, and HERMES_HOME and its parent folders are blocked from rename.
  • Covers foreground, background, PTY and code-kernel spawns. Default on: terminal.sandbox_macos_secrets: true.
  • A missing sandbox-exec logs one warning and runs without the sandbox.
  • A path containing control characters is refused.

Why do we need it

The ruling on RIG-11734 picked sandbox-exec over parsing more bash. Hiding the files at the OS level ends the bypass class, such as HOME moves (RIG-11692 and RIG-11774 on macOS).

Summary

  • tools/environments/local.py builds the profile; process_registry.py and code_kernel.py wrap their spawns with it.
  • .env, .op.env and the auth store load as absent on EPERM inside the sandbox.

Verification

  • macpro2013: 83 focused tests pass.
  • Live on macmini: secret reads, ln and ln -s of a secret, and ancestor renames all fail with EPERM. hermes config show, status, cron list, git and file creation in $HOME still work.
  • Reviewed in 3 rounds; round 3 at e388bc67 is clean.

Risks

  • vault_secret runs unsandboxed, behind the approval hook.
  • tmux and launchd IPC can escape the sandbox.
  • In profile mode, only auth.json is denied in the root home (R3-L1).
  • Touching HOME's own metadata fails (R3-L2).

Rollback: set terminal.sandbox_macos_secrets: false, or revert.

Spec impact

Spec-impact: none.

Checks skipped: nebula has no pre-push hook config; GitHub Actions ci.yaml runs its checks

Refs RIG-11734

Co-authored-by: Matt Wilkinson matt@rigel.build

…G-11734)

Known limits: tmux, launchd and other unsandboxed IPC services can execute outside the sandbox. vault_secret shell spawns are not sandboxed. Hard-link denial requires a macOS live check.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@linear-code

linear-code Bot commented Nov 23, 2026

Copy link
Copy Markdown

RIG-11734

@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

Review rounds 1-3 (RIG-11734)

  • Round 1 (90759e6c): 2 high, 4 medium, 2 low. Fixed in 38c7fc1c:
    • config.yaml write deny and secret-file write denies;
    • CLI handling for EPERM;
    • the kernel wrap.
  • Round 2 (38c7fc1c): 0 high, 4 medium, 3 low. Fixed in e388bc67:
    • file-link deny;
    • ancestor rename deny;
    • .op.env load crash;
    • credential-folder denies;
    • EPERM-only branch;
    • control-character refusal.
  • Round 3 (e388bc67): clean, 0 high, 0 medium, 2 low.
    • 83 focused tests pass on macpro2013.
    • Live Seatbelt probes on macmini confirm the R2 fixes.
    • R3-L1 (in profile mode, the root home is denied only auth.json) and R3-L2 (touching HOME metadata fails) are accepted as known limits in the body.
  • The pushed head 13137718 differs from e388bc67 only in the commit message.
  • Step-up recorded: Impl11734 ran 47 min and 209 requests, and its output deleted import re, so the slice moved to Hard11734.

The macOS live check is owed after deploy; the list is on RIG-11734.

@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

All-clear at 1313771
Base: main

@rigel-mintaka
rigel-mintaka marked this pull request as ready for review November 23, 2026 04:23

This branch had an error being deployed

1 failed deployment
ci — 13137718 Deployed Nov 23, 2026 by rigel-mintaka via CI (x86_64-linux) #1169
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-before-ready PR touches secrets or auth paths; review on the draft head before ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant