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

Function TestHandler_NotOwner

internal/ws/handler_test.go:204–219  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

202}
203
204func TestHandler_NotOwner(t *testing.T) {
205 hub := NewHub()
206 defer hub.Close()
207 store := &mockStore{
208 user: newTestUser(),
209 agent: newTestAgent("other_user"),
210 }
211 handler := NewHandler(hub, store)
212 srv := startServer(t, handler)
213
214 resp := doHTTP(t, srv, "bot@agents.e2a.dev", "valid_key")
215 defer resp.Body.Close()
216 if resp.StatusCode != http.StatusForbidden {
217 t.Fatalf("expected 403, got %d", resp.StatusCode)
218 }
219}
220
221// HIGH-1 regression: an agent-scoped credential pinned to agent A must NOT be
222// able to open agent B's stream, even when both agents share the same owner.

Callers

nothing calls this directly

Calls 7

CloseMethod · 0.95
NewHubFunction · 0.85
newTestUserFunction · 0.85
newTestAgentFunction · 0.85
NewHandlerFunction · 0.85
startServerFunction · 0.85
doHTTPFunction · 0.85

Tested by

no test coverage detected