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 is self-contained — everything the finding needs is in the payload — 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. Whether such a finding ever gets a repository is a later question, answered by a pkg/enhance enhancer 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 exactly 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. Exported so the receiver can read the delivery id off the same body it validates, without decoding twice in two places.
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 the write-back is deliberately absent rather than present and failing.
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.