Documentation
¶
Overview ¶
Package scc is the Google Cloud Security Command Center source: it turns a Pub/Sub push delivery into patchy Findings.
SCC has no webhook. Its only egress is a NotificationConfig publishing to a Pub/Sub topic, so deliveries arrive as a push envelope whose message.data is a base64-encoded NotificationMessage. Unlike GHAS, the notification carries everything the finding needs, so this handler holds no API client and makes no network call.
SCC findings are about cloud resources, not repository code, so they carry a source.CloudResource and no Repo. A pkg/enhance enhancer may later assign a repository by reading ownership labels off the resource.
Index ¶
Constants ¶
const CloudProvider = "google"
CloudProvider is the platform value stamped on every finding's cloud resource.
const EventType = "scc.notification"
EventType is the event discriminator for this source. SCC's endpoint carries one kind of delivery, so unlike a GitHub webhook there is no header to read it from: the route itself is the discriminator.
const ID = "gcp-scc"
ID is the source identifier stamped into the security-source label.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode unwraps a Pub/Sub push envelope into the SCC notification it carries. Only Findings calls it; the receiver reads the delivery id with DeliveryID instead.
func DeliveryID ¶
DeliveryID reads the Pub/Sub message id from a push envelope, for the receiver's dedup window. An undecodable body yields "", which the receiver treats as "cannot dedup" rather than an error. The body is validated downstream.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the Security Command Center source plugin. It does not implement source.Resolver: muting a finding needs a Google Cloud write credential the integration-controller does not hold, so there is no write-back rather than one that always fails.
func New ¶
New builds the handler. It takes no client: an SCC notification carries everything patchy needs, so unlike the GHAS source there is nothing to fetch.
func (*Handler) Findings ¶
func (h *Handler) Findings(_ context.Context, event string, payload []byte) ([]source.Finding, error)
Findings implements source.Handler: it unwraps the Pub/Sub envelope, decodes the notification, and normalizes it into at most one Finding. Deliveries the pipeline does not act on return (nil, nil).
type Options ¶
type Options struct {
// MinSeverity drops findings below this level, using patchy's vocabulary
// (low/medium/high/critical). Empty admits everything.
MinSeverity string
// Organization is the numeric Google Cloud organization id, used to
// compose a Console link for findings that carry no externalUri.
Organization string
}
Options configure the handler.