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

Function TestGuardedDialControl

internal/webhook/ssrf_test.go:48–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

46}
47
48func TestGuardedDialControl(t *testing.T) {
49 if err := guardedDialControl("tcp", "127.0.0.1:443", nil); err == nil {
50 t.Error("dial control allowed loopback; want blocked")
51 }
52 if err := guardedDialControl("tcp", "169.254.169.254:80", nil); err == nil {
53 t.Error("dial control allowed metadata IP; want blocked")
54 }
55 if err := guardedDialControl("tcp", "8.8.8.8:443", nil); err != nil {
56 t.Errorf("dial control blocked a public IP: %v", err)
57 }
58}
59
60// The production deliverer (requireHTTPS=true) installs the dial guard, so a
61// webhook URL that resolves to an internal IP — the DNS-rebinding payload — is

Callers

nothing calls this directly

Calls 2

guardedDialControlFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected