integration-controller¶
The single internet-facing entry point, driven by Integration custom resources. It does two kinds of work.
Inbound, it validates provider webhooks and ingests scanner alerts into Finding resources, including accumulation and
duplicate merge. The webhook routes are:
POST /github/webhooks(per-Integration HMAC secrets)POST /google-cloud/webhooks(Pub/Sub-signed OIDC tokens)POST /wiz/webhooks(per-Integration bearer tokens)POST /generic/<name>/webhooks(each generic Integration's own HMAC secret)
Outbound, it projects Findings to their tracking issues (body, labels, enrichment and report comments). It also applies
human signals back onto Findings: issue close and reopen, /approve comments, and PR merge or close. It holds no GitHub
credential itself. The credentials live in the Secrets your Integrations reference, and it reads them when it needs
them.
Flags¶
The shared flags, plus:
| Flag | Env | Default | Purpose |
|---|---|---|---|
--accumulation-window |
PATCHY_ACCUMULATION_WINDOW |
1h |
How long alerts of one finding family accumulate into a single Finding |
--projection-concurrency |
PATCHY_PROJECTION_CONCURRENCY |
2 |
Findings projected to tracking issues in parallel (each projection may spend GitHub requests) |
The webhook receiver¶
There is one route per provider on --listen-addr. Each route authenticates the request on the provider's own terms
before it does anything else:
POST /github/webhooksvalidatesX-Hub-Signature-256(constant-time HMAC) against thewebhookSecretof every configured github Integration.POST /google-cloud/webhooksvalidates the OIDC token that a Pub/Sub push signs, against the SCC Integration's audience and service account.POST /wiz/webhooksvalidates the bearer token against every wiz Integration'swebhookToken(also constant-time).POST /generic/{name}/webhooksis the exception to one route per provider. This wildcard route serves every generic Integration. It validatesX-Patchy-Signature-256against only the named Integration'swebhookSecret, never against every candidate. So one integration's secret cannot admit a delivery addressed to another.
All of them answer the same way:
| Response | Meaning |
|---|---|
202 |
Accepted and queued (duplicates by delivery ID also get 202) |
204 |
ping |
401 |
No Integration's webhook secret matched the signature |
503 |
The internal delivery queue is full; the delivery is dropped |
GitHub does not retry a 503 (or any failed delivery) on its own. Enable
spec.github.redelivery on the Integration to sweep the
delivery log for anything that never got a 2xx. Other senders redeliver on their own terms.
Bodies are capped at 25 MiB (GitHub's own limit). Delivery IDs are deduplicated over a window of the last 1024 IDs, and each is remembered for at most 5 minutes. A lost delivery never loses pipeline progress. The reconcile loops do the retrying, and the webhook path only carries ingestion and human signals.
Behavior¶
- Ingestion: scanner deliveries go through the matching
pkg/sourcehandler, which normalizes them into findings. A first alert creates a Finding atOpened. Later alerts of the same advisory family against the same repository fold into that Finding until the accumulation window closes. TheAccumulationCompletecondition tracks this. Accumulation runs at the same time as enhancement, so it is a condition and not a phase. Alerts after the window closes open a new Finding. - Projection: a Finding reconciler renders each Finding to its tracking issue. That covers the templated body, the projected labels, enrichments and investigation reports as comments, and the issue's open or closed state. Projection is one-way only.
- Human signals: these are issue close (
→ HandedOff), issue reopen (Dismissed → HandedOff), accepted/approvecomments (recorded onspec.approval), andpull_requestwebhooks onpatchy/<finding>branches. A merged pull request moves the findingInReview → Remediated. A pull request closed without merging moves it→ Failed. - Credential revalidation: an Integration reconciler validates each Integration's referenced Secret on its
spec.intervaland maintains itsReadycondition.