webhook

package
v0.27.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

Functions

func Post

func Post(requestPayload *WebhookRequestPayload) error

Post posts the message to webhook endpoint.

func PostAsync

func PostAsync(requestPayload *WebhookRequestPayload)

PostAsync posts the message to webhook endpoint asynchronously. It enqueues the request for bounded asynchronous dispatch and does not wait for the response.

func ValidateURL

func ValidateURL(rawURL string) error

ValidateURL checks that rawURL:

  1. Parses as a valid absolute URL.
  2. Uses the http or https scheme.
  3. Does not resolve to a reserved/private IP address.

It returns a gRPC InvalidArgument status error so callers can return it directly.

Types

type WebhookRequestPayload

type WebhookRequestPayload struct {
	// The target URL for the webhook request.
	URL string `json:"url"`
	// The type of activity that triggered this webhook.
	ActivityType string `json:"activityType"`
	// The resource name of the creator. Format: users/{user}
	Creator string `json:"creator"`
	// The memo that triggered this webhook (if applicable).
	Memo *v1pb.Memo `json:"memo"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL