(t *testing.T)
| 46 | } |
| 47 | |
| 48 | func 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 |
nothing calls this directly
no test coverage detected