Repository navigation
fix(container-gateway-hook): run in bash privileged mode; fail closed without a home - #1793
Merged
Merged
Conversation
… without a home Bash honours BASH_ENV, exported functions and SHELLOPTS before the hook's first line runs, and all three come from an environment project settings can set. The shebang is now #!/bin/bash -p, which ignores them; it only applies when the hook is executed directly, so setup, verify and the docs wire it by absolute path, never through bash/sh or a ~ that the launching shell would expand from $HOME. Refuse to start when the account home cannot be determined. Generated-by: Claude Opus 5
potiuk
enabled auto-merge (squash)
October 24, 2026 22:27
potiuk
added a commit
that referenced
this pull request
Oct 25, 2026
Since #1793 the gateway hook is registered by its absolute path, which differs between macOS (/Users/<you>) and Linux (/home/<you>). In a ~/.claude/settings.json synced across machines that path points at nothing on the next machine and the gateway never starts. The setup guide and install Step L now put the hook in ~/.claude/settings.local.json when the user settings are synced, with a "Fixing your other machines" passage (move the entries, then a jq one-liner per machine). Verify check 12a and the update skill flag a registered path that does not exist on the machine they run on, and a synced registration as drift. Generated-by: Claude (Opus 5.5)
potiuk
added a commit
that referenced
this pull request
Oct 25, 2026
Ships the fixes merged since 0.9.0.dev202610241347 to marketplace installs: the container-gateway hook hardening (#1784, #1789, #1790, #1793, #1804), host-only uv state (#1785), session-start cleanup of the stale uv grant (#1788), the trusted session-start interpreter (#1791), the sandboxed prek home (#1792) and per-machine gateway hook registration (#1797). Generated-by: Claude (Opus 5.5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1789. The container-gateway session hook runs outside the sandbox; two more inputs to it came from the session environment, which project settings can set:
BASH_ENV(a file bash executes), exported functions (BASH_FUNC_git%%would replacegit) andSHELLOPTSall applied. The shebang is now#!/bin/bash -p: privileged mode ignores all three. That only holds when the hook is executed directly — asbash <path>nothing inside the script can undo what the shell already imported (an exported function can shadow evenexec) — so the setup, verify and docs now wire it by its absolute path, executed directly: a~in the hook command is also expanded from$HOMEby the launching shell.isolated-setup-verifyflags a~/$HOMEorbash/shhook command.$HOMEalone.Type of change
isolated-setup-install/isolated-setup-verify: absolute, direct hook command)secure-agent-setup.md)Test plan
prek runon the changed files passespytest tools/agent-isolation/tests/test_container_gateway_hook.py(outside/tmp/claude*, where the suite does not skip): 71 passedBASH_ENV, exportedgit,SHELLOPTSeach fail on the hook before this change; exportedexecguards the re-exec trap rejected during reviewroborevreview cleanRFC-AI-0004 compliance
Gen-AI disclosure: drafted with Claude Code (Opus 5); reviewed by the submitter.
🤖 Generated with Claude Code