CLI: the workstation-side controls are weaker than they look — sandbox disables approval, the control server authenticates no peer, and access.key is world-readable
Three defects on the workstation, verified against 383c9f8b. They are filed together because they compose: the first removes the human gate, the second lets a local process reach the daemon, and the third makes the credential readable by any account on the machine.
1. Enabling the sandbox disables tool approval on the path that never sandboxes. runClaude computes sandboxEnabled from configuration before an execution path is chosen (packages/happy-cli/src/claude/runClaude.ts:106), and applySandboxPermissionPolicy rewrites the mode to bypassPermissions unconditionally (packages/happy-cli/src/claude/utils/permissionMode.ts:122). On the remote path no sandbox is ever initialized, so every Bash, Write and Edit auto-approves with no prompt and no notification. Turning the feature on makes the session strictly less safe than leaving it off.
Codex already does this correctly in the same repository: its auto-approval is bound to observed state (client.sandboxEnabled, set only after initializeSandbox and wrapForMcpTransport succeed). Suggested fix: bind the bypass to an observed sandbox, and make the Claude remote path either sandboxed or prompting.
2. The daemon control server authenticates no peer. startDaemonControlServer binds 127.0.0.1 and registers every mutating route with no onRequest/preHandler hook, no token and no peer-credential check (packages/happy-cli/src/daemon/controlServer.ts:221, :131). Binding to loopback is treated as authorization. Any local process — another user on a shared machine, or the agent the sandbox is meant to confine — can call /spawn-session and /stop.
/spawn-session accepts an arbitrary child environment, filtered by a twelve-key deny-list rather than an allow-list (packages/happy-cli/src/daemon/sessionEnvironment.ts:6), and expandEnvironmentVariables resolves caller-supplied ${VAR} against the daemon's whole ambient environment (packages/happy-cli/src/utils/expandEnvVars.ts:54). NODE_OPTIONS and PATH both reach the spawn (packages/happy-cli/src/utils/spawnHappyCLI.ts:104), which makes this code execution rather than only session control. It also lets a caller read secrets the daemon holds but the caller cannot.
Suggested fix: move the control plane to a unix socket at mode 0600 inside a 0700 directory and check the peer uid; on Windows, a per-daemon token in the state file. Replace the env deny-list with an allow-list of the keys the profile system actually needs, and scope ${VAR} expansion to declared references.
Adjacent: #1279 reports --claude-env values reaching logs in plaintext.
3. ~/.happy/access.key is written group- and world-readable. Both credential writers call writeFile with no mode (packages/happy-cli/src/persistence.ts:267, :275), and ~/.happy is created with no mode (packages/happy-cli/src/configuration.ts:84). Measured under umask 022: directory 0755, file 0644. The file holds the account bearer token and, in the dataKey branch, the machine RPC key.
Three places in this repository already get this right for identical material — packages/happy-agent/src/credentials.ts uses 0700/0600. Note that writeFile's mode only applies at creation, so a fix also needs an unconditional chmod to repair existing installs.
Source: slopus/happy