Documentation
¶
Index ¶
- Variables
- func ConfigurePrivateDestinationAllowlist(entries []string) error
- func GenerateSigningSecret() (string, error)
- func Post(requestPayload *Request) error
- func PostAsync(requestPayload *Request)
- func ValidateSigningSecret(secret string) error
- func ValidateURL(rawURL string) error
- type Request
Constants ¶
This section is empty.
Variables ¶
var AllowPrivateIPs bool
AllowPrivateIPs controls whether webhook URLs may resolve to reserved/private IP addresses. When true, the SSRF protection is disabled. This is useful for self-hosted deployments where webhooks target services on the local network.
Deprecated: use ConfigurePrivateDestinationAllowlist to allow only the destinations that the deployment needs.
Functions ¶
func ConfigurePrivateDestinationAllowlist ¶ added in v0.31.0
ConfigurePrivateDestinationAllowlist replaces the deployment's webhook allowlist. Each entry must be an exact hostname, an IP address, or a CIDR. Hostnames are matched case-insensitively, IP addresses are treated as single-address CIDRs, and CIDRs are masked to their network address.
The new policy is published only after every entry is valid, so a failed configuration leaves the previous policy intact. Passing an empty slice clears the allowlist.
func GenerateSigningSecret ¶ added in v0.30.0
GenerateSigningSecret returns a new Standard Webhooks signing secret in the "whsec_<base64>" form, backed by 32 cryptographically-random bytes — comfortably within the spec's 24–64 byte range.
func PostAsync ¶
func PostAsync(requestPayload *Request)
PostAsync enqueues the request for bounded asynchronous delivery and does not wait for the response.
func ValidateSigningSecret ¶ added in v0.30.0
ValidateSigningSecret checks that secret is either empty (allowed) or contains only printable ASCII characters (0x20–0x7E), excluding all control characters such as \r and \n, which would corrupt the webhook signature headers. When the secret uses the Standard Webhooks "whsec_<base64>" serialization, the base64 body must decode cleanly so signing cannot silently fall back to the wrong key.
func ValidateURL ¶
ValidateURL checks that rawURL:
- Parses as a valid absolute URL.
- Uses the http or https scheme.
- Does not resolve to a reserved/private IP address.
It returns a gRPC InvalidArgument status error so callers can return it directly.
Types ¶
type Request ¶ added in v0.31.0
type Request struct {
// URL is the destination endpoint.
URL string
// Label identifies the delivery in logs, for example an activity type.
Label string
// SigningSecret enables Standard Webhooks HMAC-SHA256 signing when non-empty.
SigningSecret string
// Payload is the value encoded as the JSON request body.
Payload any
}
Request is one webhook delivery: Payload is JSON-encoded and posted to URL, signed with SigningSecret when one is set.