claude-code: remove the guard on the agent's shell
The operator asked for the shell guard to go (2026-11-20): the plugin no longer carries a PreToolUse hook or guard.json, the binary no longer has a guard verb, and the claude_code_guard tool, its record and the refusal-ranked order of the instead-of table are gone. The SessionStart and Stop hooks of the wait list stay, run by the same binary at the same path, which is also the home-fs helper's. The rendered rule against ssh to a mesh machine stays as the session's own and no longer claims a guard enforces it; claude-agent no longer passes the guard's override.
This commit is contained in:
@@ -261,12 +261,13 @@ func TestTheOperatorsManagedSettingsAreWhatSessionsObey(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// The plugin's only hooks are the guard, the session-start hook and the Stop hook (novox/hq ADR 0245, ADR
|
||||
// 0489) — never a hook a registration named, whatever the configuration given holds (novox/hq issue 340).
|
||||
func TestThePluginsOnlyHooksAreTheGuardTheSessionStartHookAndTheStopHook(t *testing.T) {
|
||||
// The plugin's only hooks are the session-start hook and the Stop hook (novox/hq ADR 0489) — no guard on the
|
||||
// shell (the operator, 2026-11-20), and never a hook a registration named, whatever the configuration given holds
|
||||
// (novox/hq issue 340).
|
||||
func TestThePluginsOnlyHooksAreTheSessionStartHookAndTheStopHook(t *testing.T) {
|
||||
c := Config{Mesh: []Item{{Kind: KindHook, Name: "planted", Scope: ScopeMesh, Event: "PreToolUse", Matcher: "Bash",
|
||||
Command: "${HOOK_DIR}/x.sh", Files: map[string]string{"x.sh": "#!/bin/sh\n"}}}}
|
||||
plugin := MarketplaceWith(c, &GuardFiles{Exe: "/bin/true", WaitsDir: "/home/agent/.claude/nox-mesh/waits"})
|
||||
plugin := MarketplaceWith(c, &HookFiles{Exe: "/bin/true", WaitsDir: "/home/agent/.claude/nox-mesh/waits"})
|
||||
root := "plugins/" + Plugin + "/"
|
||||
var hooks struct {
|
||||
Hooks map[string][]struct {
|
||||
@@ -279,9 +280,14 @@ func TestThePluginsOnlyHooksAreTheGuardTheSessionStartHookAndTheStopHook(t *test
|
||||
if err := json.Unmarshal([]byte(plugin[root+"hooks/hooks.json"].Content), &hooks); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(hooks.Hooks) != 3 || len(hooks.Hooks["PreToolUse"]) != 1 || hooks.Hooks["PreToolUse"][0].Matcher != GuardMatcher ||
|
||||
hooks.Hooks["PreToolUse"][0].Hooks[0].Command != GuardCommand() {
|
||||
t.Fatalf("the guard's hook: %s", plugin[root+"hooks/hooks.json"].Content)
|
||||
if len(hooks.Hooks) != 2 || hooks.Hooks["PreToolUse"] != nil {
|
||||
t.Fatalf("a hook beside the session-start and Stop hooks: %s", plugin[root+"hooks/hooks.json"].Content)
|
||||
}
|
||||
if plugin[root+GuardDir+"/guard"].From != "/bin/true" {
|
||||
t.Fatalf("the binary the hooks run is not placed: %+v", plugin[root+GuardDir+"/guard"])
|
||||
}
|
||||
if _, ok := plugin[root+GuardDir+"/guard.json"]; ok {
|
||||
t.Fatal("the guard's data is placed")
|
||||
}
|
||||
if len(hooks.Hooks["SessionStart"]) != 1 || hooks.Hooks["SessionStart"][0].Matcher != "startup|resume|clear|compact" ||
|
||||
hooks.Hooks["SessionStart"][0].Hooks[0].Command != SessionStartCommand("/home/agent/.claude/nox-mesh/waits") {
|
||||
|
||||
Reference in New Issue
Block a user