Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶ added in v0.3.0
NewHandler returns an implementation of the http.Handler interface that can handle webhooks (events) from GitHub by delegating to a transport-agnostic Service interface.
func NewSignatureVerificationFilter ¶ added in v0.3.0
func NewSignatureVerificationFilter( config SignatureVerificationFilterConfig, ) libHTTP.Filter
NewSignatureVerificationFilter returns a component that implements the http.Filter interface and can conditionally allow or disallow a request based on the ability to verify the signature of the inbound request.
Types ¶
type Service ¶
type Service interface {
// Handle handles a GitHub webhook (event).
Handle(
ctx context.Context,
appID int64,
eventType string,
payload []byte,
) (core.EventList, error)
}
Service is an interface for components that can handle webhooks (events) from GitHub. Implementations of this interface are transport-agnostic.
func NewService ¶
func NewService( eventsClient core.EventsClient, config ServiceConfig, ) Service
NewService returns an implementation of the Service interface for handling (events) from GitHub.
type ServiceConfig ¶
type ServiceConfig struct {
// GitHubApps is a map of GitHub App configurations indexed by App ID.
GitHubApps map[int64]ghlib.App
// CheckSuiteAllowedAuthorAssociations enumerates the author associations who
// are allowed to have their PR events and "/brig check" or "/brig run"
// comments trigger the creation of a GitHub CheckSuite. Possible values are:
// COLLABORATOR, CONTRIBUTOR, OWNER, NONE, MEMBER, FIRST_TIMER, and
// FIRST_TME_CONTRIBUTOR.
CheckSuiteAllowedAuthorAssociations []string
// CheckSuiteOnPR specifies whether eligible PR events (see
// CheckSuiteAllowedAuthorAssociations) should trigger a corresponding suite
// of checks. Note that GitHub AUTOMATICALLY triggers such suites in response
// to push events, but as a security measure, does NOT do so for PR events,
// given that a PR may have originated from an untrusted user. Setting this
// field to true, when used in conjunction with the
// CheckSuiteAllowedAuthorAssociations field allows classes of trusted user
// (only) to have their PRs trigger check suites automatically.
CheckSuiteOnPR bool
// CheckSuiteOnComment specifies whether eligible comments (ones containing
// the text "/brig check" or "/brig run") should trigger a corresponding suite
// of checks. Note that this privilege is extended only to trusted classes of
// user specified by the CheckSuiteAllowedAuthorAssociations field.
CheckSuiteOnComment bool
// EmittedEvents enumerates specific event types that, when received by the
// gateway, should be emitted into Brigade's event bus. The value "*" can be
// used to indicate "all events." ONLY specified events are emitted. i.e. An
// empty list in this field will result in NO EVENTS being emitted into
// Brigade's event bus. This field is one of several useful controls for
// cutting down on the amount of noise that this gateway propagates into
// Brigade's event bus. (Another would be to configure the Brigade App itself
// to only send specific events to this gateway.)
EmittedEvents []string
}
ServiceConfig encapsulates configuration options for webhook-handling service.
type SignatureVerificationFilterConfig ¶ added in v0.3.0
type SignatureVerificationFilterConfig struct {
// GitHubApps is a map of GitHub App configurations indexed by App ID.
GitHubApps map[int64]ghlib.App
}
SignatureVerificationFilterConfig encapsulates configuration for the signature verification based auth filter.