fix(kvb-org-organize): no hook runs a binary planted on the inherited PATH

Hooks run outside the sandbox but inherit a PATH whose directories
sandboxed agents of the same uid can write (a virtualenv's bin activated
first by the shell profile), so a file planted there under the name of
docker, git or notify-send ran unsandboxed. hookpath.py keeps only the
PATH directories that, with every parent, belong to another uid and that
neither group nor others can write, as real paths; inside the sandbox's
user namespace root shows as the overflow uid and still counts as sealed.
watch.py, radio.py and council.py set that PATH before they start
anything, and the cleanup child runs with -I. Both reminder hooks pin
PATH=/usr/bin:/bin, and the install registers them with /usr/bin/bash and
moves older bare bash and python3 entries to the absolute paths.

🎯 Fix: 90 %
💥 Break: 4 %
💸 Cost: 100 %
⏱️ Time: 100 %
🛡️ Security: 100 %
💰 Value: ?
🏆 Score: 86
🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 %

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-06 13:27:00 +00:00
1 parent 94542e7b92
commit 454670a77e
13 files changed
+193 -5

No files matched your search

+3
View File
@@ -9,6 +9,8 @@ Environment:
of a mayday; ~/.claude/agents-council/config.json unless set.
CLAUDE_CODE_SESSION_ID: the calling session; hooks read the payload's
session_id first, other runtimes pass --session.
PATH: filtered to the directories the kvb-org-organize hookpath.py
trusts before the notify argv runs.
Args:
send <class> "<text>" [--to <name> ...] [--wake] [--session <id>]: add a
@@ -468,6 +470,7 @@ def main() -> int:
p.add_argument("--session")
p.set_defaults(func=cmd_show)
args = parser.parse_args()
os.environ["PATH"] = organize("hookpath").trusted(os.environ.get("PATH", ""))
refused = organize("watch").guard_root(hook=args.command in ("hook", "tool", "listen"))
if refused is not None:
return refused