MCPcopy Create free account
hub / github.com/diillson/chatcli / TestProcAdapterEnforcesAgentPolicy

Function TestProcAdapterEnforcesAgentPolicy

cli/proc_tool_adapter_test.go:83–91  ·  view source on GitHub ↗

TestProcAdapterEnforcesAgentPolicy pins the security promise: the adapter's supervisor uses the agent's CommandValidator, so a command the one-shot exec would refuse is refused here too — @proc is not a side door.

(t *testing.T)

Source from the content-addressed store, hash-verified

81// supervisor uses the agent's CommandValidator, so a command the one-shot
82// exec would refuse is refused here too — @proc is not a side door.
83func TestProcAdapterEnforcesAgentPolicy(t *testing.T) {
84 cli := &ChatCLI{logger: zap.NewNop()}
85 t.Cleanup(cli.shutdownProcSupervisor)
86 a := &procToolAdapter{cli: cli}
87
88 if _, err := a.Start("sudo rm -rf /", ""); err == nil {
89 t.Fatal("dangerous command must be refused by the shared validator")
90 }
91}

Callers

nothing calls this directly

Calls 2

StartMethod · 0.95
CleanupMethod · 0.45

Tested by

no test coverage detected