MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestScope_ApproveRejectIsAccountOnly

Function TestScope_ApproveRejectIsAccountOnly

internal/httpapi/scope_test.go:151–162  ·  view source on GitHub ↗

TestScope_ApproveRejectIsAccountOnly: HITL approve/reject is barred for an agent-scoped credential EVEN ON ITS OWN BOUND AGENT — self-approval would defeat the human-in-the-loop gate. (The human magic-link flow is a separate, token-gated handler and is unaffected.) requireAccountScope runs first, so

(t *testing.T)

Source from the content-addressed store, hash-verified

149// token-gated handler and is unaffected.) requireAccountScope runs first, so the
150// 403 fires before any approve/reject dependency is consulted.
151func TestScope_ApproveRejectIsAccountOnly(t *testing.T) {
152 srv := scopeTestServer(t)
153 for _, path := range []string{
154 "/v1/agents/support%40acme.com/messages/msg_1/approve",
155 "/v1/agents/support%40acme.com/messages/msg_1/reject",
156 } {
157 code, body := sendJSON(t, "POST", srv.URL+path, "agtSupport", map[string]any{})
158 if code != 403 || errCode(body) != "forbidden" {
159 t.Errorf("agent key POST %s (own bound agent): status %d body %v, want 403 forbidden", path, code, body)
160 }
161 }
162}
163
164// TestScope_AgentKeyPinnedToBoundAgent: a per-agent runtime route lets an
165// agent-scoped credential act as its bound agent but 403s on any other agent;

Callers

nothing calls this directly

Calls 3

scopeTestServerFunction · 0.85
sendJSONFunction · 0.85
errCodeFunction · 0.85

Tested by

no test coverage detected