Documentation
¶
Overview ¶
Package netguard makes outbound HTTP requests to user-supplied URLs (outgoing webhooks, the audit stream) safe from server-side request forgery: the address is checked after DNS resolution, at connect time, so a hostname can't point at loopback, private, link-local or metadata addresses, and redirects are never followed. Private networks can be allowed explicitly for self-hosted setups (webhooks.allow_private_networks).
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBlocked = errors.New("address not allowed")
ErrBlocked is returned when a URL resolves to a forbidden address.
Functions ¶
Types ¶
type Policy ¶
type Policy struct {
// AllowPrivate allows loopback and RFC 1918 addresses (self-hosted receivers).
AllowPrivate bool
}
Policy decides which addresses may be dialed.
func (Policy) Client ¶
Client returns an HTTP client that refuses forbidden addresses at connect time and never follows redirects.
Click to show internal directories.
Click to hide internal directories.