claude: no shell command is a marker; steps never read command text
Astra review of f03d79bb: StepPermission reserved the two certification controls (printf equipo-cert-allow / -deny) by whole-command equality, which printf "equipo-cert-deny", env printf ..., (printf ...), /usr/bin/printf or a variable all evade. A shell rule cannot stop a sandboxed command producing a string. What the markers certified, and who read them: the live gate asked the model to run each control and treated the printed text plus a person's allow/deny as evidence that the person-approval path worked (the person-native-approval and policy-escalation-denied checks). That harness (cmd/equipo-try, directlive, tryequipo, release evidence) was deleted with the certification evidence in bbf490ed (2026-11-11). No code reads the markers now; the two ask rules were left behind. So no Bash output can be mistaken for certification, and the reservation protected nothing. Fix: - The Claude policy no longer carries the two Bash ask rules. Ordinary sandboxed commands keep automatic approval; file-tool ask rules are unchanged. Every Claude policy's settings (and so its hash) change. - StepPermission never consults a command's text. A policy that reserves any shell approval for a person (any Bash ask rule) makes a step refuse every shell request, with that rule named. - Any future person-approval proof must be a harness operation on the permission channel (the request id Equipo relays and the answer it receives), never text a sandboxed command can print. Tests first: TestNoShellCommandIsAMarker (replaces TestNativeControlCommandsRequireApproval), the glance and research policy tests (no ask rules at all), and TestStepPermissionRunsSandboxedShell (printf "equipo-cert-allow", env printf ... run like any command; a Bash ask rule refuses every shell request) failed before the fix. Mutation checks (go test -run 'TestStepPermission|TestNoShellCommandIsAMarker|Glance|Research' ./internal/runner/provider/claude/), each failed, then restored: - restore the printf ask rules: "refused curl example.com" - drop the fail-closed ask-rule check: "a policy reserving shell approval for a person let a step approve" - reserve the marker by text: "sandboxed command refused or changed: printf equipo-cert-deny"
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 files changed,
+48
−37
internal/runner/provider/claude/answers.go+6 −11internal/runner/provider/claude/answers_test.go+22 −11internal/runner/provider/claude/certification_gaps_test.go+11 −4internal/runner/provider/claude/glance_policy_test.go+2 −4internal/runner/provider/claude/launcher.go+5 −3internal/runner/provider/claude/research_policy_test.go+2 −4
diff --git a/internal/runner/provider/claude/answers.go b/internal/runner/provider/claude/answers.go| index 69b76220..0236c479 100644 |
| --- a/internal/runner/provider/claude/answers.go |
| +++ b/internal/runner/provider/claude/answers.go |
| @@ -182,7 +182,7 @@ const ( |
| refuseResearch = "/research is read-only: use Read, Glob and Grep there" |
| refuseFields = "the request has a field this step does not accept" |
| refuseSandbox = "commands run only inside the sandbox; dangerouslyDisableSandbox is not available" |
| - refusePerson = "this command is kept for a person's approval, and nobody is asked during a step" |
| + refusePerson = "this step's policy keeps shell commands for a person's approval, and nobody is asked during a step" |
| refuseTool = "this tool is not available to this step" |
| refuseReadOnly = "this step only reads: use Read, Glob and Grep under /workspace" |
| refuseShell = "this step's policy does not keep commands in the sandbox, so it runs none" |
| @@ -257,8 +257,10 @@ func stepPathRule(q permissionRequest, policy provider.Policy) string { |
| // sandboxedShell names the rule refusing a shell command in a step, or "" |
| // when the step may run it: the policy keeps every command in the CLI's |
| // sandbox (enabled, no unconfined fallback or exemption, no weaker nesting), |
| -// the request cannot ask to leave it, and the command is not one an |
| -// explicit ask rule keeps for a person (the certification controls). |
| +// the request cannot ask to leave it, and the policy reserves no shell |
| +// approval for a person. The command's text is never consulted: a shell |
| +// rule cannot stop a sandboxed command producing any text, so a policy |
| +// with a Bash ask rule refuses every shell request in a step. |
| func sandboxedShell(q permissionRequest, policy provider.Policy) string { |
| var input map[string]json.RawMessage |
| var command string |
| @@ -290,14 +292,7 @@ func sandboxedShell(q permissionRequest, policy provider.Policy) string { |
| return refuseShell |
| } |
| for _, rule := range settings.Permissions.Ask { |
| - reserved, ok := strings.CutPrefix(rule, "Bash(") |
| - if !ok { |
| - continue |
| - } |
| - reserved, ok = strings.CutSuffix(reserved, ")") |
| - // Only exact command rules are known here; any other Bash ask |
| - // rule keeps every command for a person. |
| - if !ok || strings.ContainsAny(reserved, "*:") || strings.TrimSpace(command) == reserved { |
| + if rule == "Bash" || strings.HasPrefix(rule, "Bash(") { |
| return refusePerson |
| } |
| } |
diff --git a/internal/runner/provider/claude/answers_test.go b/internal/runner/provider/claude/answers_test.go| index 17aa7798..b35d27b0 100644 |
| --- a/internal/runner/provider/claude/answers_test.go |
| +++ b/internal/runner/provider/claude/answers_test.go |
| @@ -262,8 +262,9 @@ func TestStepPermissionReadsResearch(t *testing.T) { |
| // and in that mode the pinned CLI turns sandbox auto-approval off, so its |
| // ordinary shell commands reached this callback and every one was refused. |
| // The policy forces every command into the CLI's sandbox, so the step |
| -// allows them exactly as the CLI's auto-approval would; only a command an |
| -// explicit ask rule reserves for a person stays refused. |
| +// allows them exactly as the CLI's auto-approval would. No command's text |
| +// is special; a policy that reserves shell approval for a person (any |
| +// Bash ask rule) refuses every shell request in a step instead. |
| func TestStepPermissionRunsSandboxedShell(t *testing.T) { |
| f := fixtureFor(t, "Engineering") |
| // The commands the CLI escalated in that step (its reason codes: |
| @@ -277,6 +278,7 @@ func TestStepPermissionRunsSandboxedShell(t *testing.T) { |
| `/opt/go/bin/go version`, |
| `ls /opt/go/bin`, |
| `which go gofmt; ls /opt`, |
| + `printf equipo-cert-deny`, `printf "equipo-cert-allow"`, `env printf equipo-cert-deny`, |
| } { |
| input, _ := json.Marshal(map[string]any{"command": command, "description": "d", "timeout": 600000}) |
| raw, _ := json.Marshal(map[string]any{"tool_name": "Bash", "tool_use_id": "toolu_x", "input": json.RawMessage(input)}) |
| @@ -289,9 +291,6 @@ func TestStepPermissionRunsSandboxedShell(t *testing.T) { |
| } |
| } |
| for _, raw := range []string{ |
| - // The certification controls exercise the person's approval path. |
| - `{"tool_name":"Bash","input":{"command":"printf equipo-cert-allow"}}`, |
| - `{"tool_name":"Bash","input":{"command":" printf equipo-cert-deny "}}`, |
| `{"tool_name":"Bash","input":{"command":"ls","dangerouslyDisableSandbox":false}}`, |
| `{"tool_name":"Bash","input":{"command":"ls","sandbox":false}}`, |
| `{"tool_name":"Bash","input":{"command":7}}`, |
| @@ -316,6 +315,12 @@ func TestStepPermissionRunsSandboxedShell(t *testing.T) { |
| t.Fatalf("%s: shell allowed", name) |
| } |
| } |
| + reserved := withSettings(t, f.launch.Policy, func(s map[string]any) { |
| + s["permissions"].(map[string]any)["ask"] = []string{"Bash(git push:*)"} |
| + }) |
| + if stepBehavior(t, StepPermission, `{"tool_name":"Bash","input":{"command":"ls"}}`, reserved) == "allow" { |
| + t.Fatal("a policy reserving shell approval for a person let a step approve") |
| + } |
| // Review keeps its read-only callback: no shell through it. |
| r := fixtureFor(t, "Review") |
| if stepBehavior(t, ReadPermission, `{"tool_name":"Bash","input":{"command":"ls"}}`, r.launch.Policy) == "allow" { |
| @@ -336,7 +341,6 @@ func TestStepPermissionNamesTheRule(t *testing.T) { |
| {`{"tool_name":"Read","input":{"file_path":"/etc/` + secret + `"}}`, "/workspace"}, |
| {`{"tool_name":"Write","input":{"file_path":"/tool/equipo.sock","content":"` + secret + `"}}`, "protected"}, |
| {`{"tool_name":"Write","input":{"file_path":"/research/a","content":"` + secret + `"}}`, "read"}, |
| - {`{"tool_name":"Bash","input":{"command":"printf equipo-cert-deny"}}`, "person"}, |
| {`{"tool_name":"Bash","input":{"command":"ls ` + secret + `","dangerouslyDisableSandbox":true}}`, "sandbox"}, |
| {`{"tool_name":"WebFetch","input":{"url":"https://` + secret + `"}}`, "not available"}, |
| {`{"tool_name":"Edit","input":{"file_path":"/workspace/a","old_string":"` + secret + `","new_string":"b","extra":1}}`, "field"}, |
| @@ -369,17 +373,24 @@ func stepBehavior(t *testing.T, check func(json.RawMessage, provider.Policy) jso |
| // withSandboxSettings returns p with its manifest's sandbox settings |
| // changed by mutate (nil removes the sandbox key). |
| func withSandboxSettings(t *testing.T, p provider.Policy, mutate func(map[string]any)) provider.Policy { |
| + return withSettings(t, p, func(s map[string]any) { |
| + if mutate == nil { |
| + delete(s, "sandbox") |
| + } else { |
| + mutate(s["sandbox"].(map[string]any)) |
| + } |
| + }) |
| +} |
| + |
| +// withSettings returns p with its manifest's settings changed by mutate. |
| +func withSettings(t *testing.T, p provider.Policy, mutate func(map[string]any)) provider.Policy { |
| t.Helper() |
| var m map[string]json.RawMessage |
| var settings map[string]any |
| if json.Unmarshal(p.Manifest, &m) != nil || json.Unmarshal(m["Settings"], &settings) != nil { |
| t.Fatal("manifest settings unreadable") |
| } |
| - if mutate == nil { |
| - delete(settings, "sandbox") |
| - } else { |
| - mutate(settings["sandbox"].(map[string]any)) |
| - } |
| + mutate(settings) |
| m["Settings"], _ = json.Marshal(settings) |
| p.Manifest, _ = json.Marshal(m) |
| return p |
diff --git a/internal/runner/provider/claude/certification_gaps_test.go b/internal/runner/provider/claude/certification_gaps_test.go| index 3505d13b..b8e6be19 100644 |
| --- a/internal/runner/provider/claude/certification_gaps_test.go |
| +++ b/internal/runner/provider/claude/certification_gaps_test.go |
| @@ -5,6 +5,7 @@ import ( |
| "context" |
| "encoding/json" |
| "slices" |
| + "strings" |
| "testing" |
| "time" |
| ) |
| @@ -46,7 +47,13 @@ func TestHookEventFlagBoundToPolicy(t *testing.T) { |
| } |
| } |
| -func TestNativeControlCommandsRequireApproval(t *testing.T) { |
| +// TestNoShellCommandIsAMarker: the person-approval controls were shell |
| +// commands whose printed text a live-gate harness read as evidence |
| +// (printf equipo-cert-allow, printf equipo-cert-deny). That harness went |
| +// with the certification evidence (bbf490ed); nothing reads the text now, |
| +// and a shell rule could never keep a sandboxed command from printing it. |
| +// No Bash ask rule remains: no command's text means anything to Equipo. |
| +func TestNoShellCommandIsAMarker(t *testing.T) { |
| f := fixtureFor(t, "Engineering") |
| var settings struct { |
| Permissions struct{ Ask []string } |
| @@ -55,9 +62,9 @@ func TestNativeControlCommandsRequireApproval(t *testing.T) { |
| if err := json.Unmarshal(f.inputs.Settings, &settings); err != nil { |
| t.Fatal(err) |
| } |
| - for _, command := range []string{"printf equipo-cert-allow", "printf equipo-cert-deny"} { |
| - if !slices.Contains(settings.Permissions.Ask, "Bash("+command+")") { |
| - t.Errorf("native control auto-approved: %s", command) |
| + for _, ask := range settings.Permissions.Ask { |
| + if strings.HasPrefix(ask, "Bash") { |
| + t.Errorf("shell ask rule %q", ask) |
| } |
| } |
| if settings.Sandbox["autoAllowBashIfSandboxed"] != true || settings.Sandbox["allowUnsandboxedCommands"] != false { |
diff --git a/internal/runner/provider/claude/glance_policy_test.go b/internal/runner/provider/claude/glance_policy_test.go| index 57a6bd67..f04494ff 100644 |
| --- a/internal/runner/provider/claude/glance_policy_test.go |
| +++ b/internal/runner/provider/claude/glance_policy_test.go |
| @@ -46,10 +46,8 @@ func TestGlanceLaunchHasNoTools(t *testing.T) { |
| if json.Unmarshal(got.Settings, &settings) != nil || len(settings.Permissions.Allow) != 0 || !slices.Contains(settings.Sandbox.Filesystem.DenyWrite, "/workspace") { |
| t.Fatalf("settings %s", got.Settings) |
| } |
| - for _, ask := range settings.Permissions.Ask { |
| - if ask != "Bash(printf equipo-cert-allow)" && ask != "Bash(printf equipo-cert-deny)" { |
| - t.Fatalf("native ask rule %q", ask) |
| - } |
| + if len(settings.Permissions.Ask) != 0 { |
| + t.Fatalf("native ask rules %q", settings.Permissions.Ask) |
| } |
| for _, tool := range []string{"mcp__equipo__ask_person", "mcp__equipo__look", "mcp__equipo__use", "mcp__equipo__read_notes", "mcp__equipo__submit_answer", "mcp__equipo__submit_findings", "Read"} { |
| more := in |
diff --git a/internal/runner/provider/claude/launcher.go b/internal/runner/provider/claude/launcher.go| index cdeb4ef0..99bce3e7 100644 |
| --- a/internal/runner/provider/claude/launcher.go |
| +++ b/internal/runner/provider/claude/launcher.go |
| @@ -165,9 +165,11 @@ func PolicyInputs(b provider.Binding, in provider.PolicyInputs, specialist, mode |
| } |
| } |
| allow := append([]string{}, in.Tools...) |
| - // These harmless control commands must exercise the person approval path, |
| - // even though ordinary sandboxed Bash commands run without a prompt. |
| - ask := []string{"Bash(printf equipo-cert-allow)", "Bash(printf equipo-cert-deny)"} |
| + // No shell command is reserved: ordinary sandboxed Bash commands run |
| + // without a prompt, and no command's text is evidence of anything. |
| + // (Two printf "control" commands once were; the live-gate harness |
| + // that read them left with the certification evidence, bbf490ed.) |
| + ask := []string{} |
| for _, tool := range native { |
| if slices.Contains([]string{"Write", "Edit", "Read", "Glob", "Grep"}, tool) { |
| ask = append(ask, tool+"(//workspace/**)") |
diff --git a/internal/runner/provider/claude/research_policy_test.go b/internal/runner/provider/claude/research_policy_test.go| index 6183acaa..7610d572 100644 |
| --- a/internal/runner/provider/claude/research_policy_test.go |
| +++ b/internal/runner/provider/claude/research_policy_test.go |
| @@ -48,10 +48,8 @@ func TestResearchStepPolicyNoNativeTools(t *testing.T) { |
| if !slices.Equal(settings.Permissions.Allow, profile.MCPTools()) { |
| t.Fatalf("allow %v", settings.Permissions.Allow) |
| } |
| - for _, ask := range settings.Permissions.Ask { |
| - if ask != "Bash(printf equipo-cert-allow)" && ask != "Bash(printf equipo-cert-deny)" { |
| - t.Fatalf("native ask rule %q", ask) |
| - } |
| + if len(settings.Permissions.Ask) != 0 { |
| + t.Fatalf("native ask rules %q", settings.Permissions.Ask) |
| } |
| // Exactly the profile's tools: another submission, a question, a |
| // coordinator tool or a git tool is refused. |