Scan IaC from a Pull Request
Once wired, every push and pull request triggers a scan. You see the result as a PR comment and an optional CI status check.
Step 1, generate a webhook URL in Ctadel
- Settings, Git, Add repository.
- Pick the provider: GitHub / GitLab / Bitbucket.
- Paste the repo URL or pick from the list (if you connected a Git org).
- Choose:
- Branches to scan: usually
mainplus all PR branches. - Severity threshold for CI failure:
CRITICAL,HIGH,MEDIUM,none(warn only). - Comment on PRs: yes / no.
- Branches to scan: usually
- Save. Ctadel generates a unique webhook URL and a secret token.
Step 2, configure the webhook in your git provider
GitHub
- Repo, Settings, Webhooks, Add webhook.
- Payload URL: paste from Ctadel.
- Content type:
application/json. - Secret: paste from Ctadel.
- Events: Pushes, Pull requests.
- Add webhook.
GitLab
- Repo, Settings, Webhooks, Add new webhook.
- URL: paste from Ctadel.
- Secret token: paste from Ctadel.
- Trigger: Push events, Merge request events.
- Add webhook.
Bitbucket
- Repo, Repository settings, Webhooks, Add webhook.
- URL: paste from Ctadel.
- Triggers: Push, Pull request.
- Save.
Step 3, push a test commit
Make a trivial change and push. Ctadel:
- Receives the webhook.
- Clones the affected branch (read-only, ephemeral).
- Walks IaC files (
*.tf,*.yaml,Dockerfile, ...). - Runs the IaC rule library.
- Posts results.
You should see:
- A PR comment summarising findings, severity-grouped, with file/line links.
- A CI status check on the commit (
Ctadel: PASS / FAIL). - A scan row in IaC, Scans in Ctadel.
Step 4, fail CI on threshold (optional)
If you set the severity threshold to anything other than none, the CI check fails
when a finding at or above the threshold matches. The PR cannot merge until findings
are resolved or marked IGNORED.
To unblock a specific PR with a known false positive:
- Mark the finding
IGNOREDin Ctadel with a reason. - The CI check re-runs and passes (the finding is no longer counted as OPEN).
Step 5, drift correlation
Once IaC is scanning, every CSPM/KSPM finding gets a drift_status field. See
CSPM module, drift status for what each value means and how to
react.
Common pitfalls
- Webhook doesn't fire. Check the git provider's webhook delivery log. Common causes: wrong URL, secret mismatch, IP-allowlisting on a self-hosted git server.
- Scan succeeds but no findings. Verify the path globs in Settings, Git match where your IaC actually lives.
- PR comments spam. If you have many short-lived branches, set "Comment on PRs: no" and rely on the CI status check + the IaC module instead.