Home/Templates/Pipeline security findings in front of responders
Pipeline security findings in front of responders
Secret scanning, push protection, and dependency alerts switched on and sent to the SIEM, so a leaked key is an incident.
Terraform
Why bother
A secret pushed to a repository is usually found by someone else first. Secret scanning and push protection catch most of them. Dependency alerts flag known-vulnerable packages. None of it helps if the findings sit in a tab nobody opens, so the second half of this template is getting them to responders.
Push a test token to a branch. Push protection blocks it. Bypass the block, and the alert reaches your collector.
How it works
Set it up
Pick your platform, then open the level you want. Each level is complete on its own. Read the comments in the files as you go. Anything with a real consequence is explained on the line where it happens.
Terraform. Organisation security settings with the GitHub provider, and a signed webhook that sends security alerts to your collector
What you need first
- A token or GitHub App with admin rights on the organisation, set as GITHUB_TOKEN.
- A collector with an HTTPS address that accepts GitHub webhooks and checks their signature, and a shared secret for it.
- For private repositories, GitHub Secret Protection and Code Security licences. Public repositories get secret scanning and push protection free.
What it creates
- Secret scanning, push protection, Dependabot alerts and updates, and the dependency graph on for every new repository
- A read-only default token for Actions workflows
- An organisation webhook that delivers secret, dependency, and code scanning alerts, security setting changes, and visibility changes
- Alerts for named existing repositories, a security manager team, and a limit on which actions workflows may use (Standard)
- An optional rule refusing actions that are not pinned by commit (Standard)
- supply-chain.yml, a workflow for each repository that builds an image. It writes a CycloneDX SBOM, signs the image keyless with cosign, attaches the SBOM as a signed attestation, and records build provenance (Standard)
See the six alerts this creates
The code
Quick startReady
webhook_secret. Shared secret GitHub signs each delivery with, so the collector can reject forgeries. Set it with TF_VAR_webhook_secret. It is stored in state.organization = "your-org"main.tf, line 20billing_email = "billing@example.com"main.tf, line 21collector_url = "https://collector.example.com/github/webhook"main.tf, line 22
# terraform.tfvars webhook_secret = ""
Create this file beside the others and fill in your values. Terraform reads it on its own.terraform init
Downloads the provider. Run it once per folder.terraform plan
Shows what will be created. Changes nothing. Read it.terraform apply
Shows the plan again and waits for you to type yes.terraform destroy
When you have finished. If it refuses, How to undo it below explains why.
Formatting passedValid passedLint passed
Security scan: zero checks passed, and none flagged.
Last run 2026-10-02 with OpenTofu v1.12.6 against integrations/github 6.13.0.
Open main.tf as plain text
StandardReady
organization. The GitHub organisation.billing_email. The organisation's billing address, which its settings resource requires.collector_url. HTTPS address of the collector that receives security events and checks their signature.webhook_secret. Shared secret GitHub signs each delivery with. Set it with TF_VAR_webhook_secret. It is stored in state.
# terraform.tfvars organization = "" billing_email = "" collector_url = "" webhook_secret = ""
Create this file beside the others and fill in your values. Terraform reads it on its own.terraform init
Downloads the provider. Run it once per folder.terraform plan
Shows what will be created. Changes nothing. Read it.terraform apply
Shows the plan again and waits for you to type yes.terraform output verify
Prints the commands that prove it worked.
Formatting passedValid passedLint passed
Security scan: zero checks passed, and none flagged.
Last run 2026-10-02 with OpenTofu v1.12.6 against integrations/github 6.13.0.
Open main.tf as plain text
Open outputs.tf as plain text
Open supply-chain.yml as plain text
Open variables.tf as plain text
Open versions.tf as plain text
HardenedReady
organization. The GitHub organisation.billing_email. The organisation's billing address, which its settings resource requires.collector_url. HTTPS address of the collector that receives security events and checks their signature.webhook_secret. Shared secret GitHub signs each delivery with. Set it with TF_VAR_webhook_secret. It is stored in state.
# terraform.tfvars organization = "" billing_email = "" collector_url = "" webhook_secret = ""
Create this file beside the others and fill in your values. Terraform reads it on its own.terraform init
Downloads the provider. Run it once per folder.terraform plan
Shows what will be created. Changes nothing. Read it.terraform apply
Shows the plan again and waits for you to type yes.terraform output verify
Prints the commands that prove it worked.
Formatting passedValid passedLint passed
Security scan: zero checks passed, and none flagged.
Last run 2026-10-02 with OpenTofu v1.12.6 against integrations/github 6.13.0.
Open .checkov.yml as plain text
Open guard.yml as plain text
Open main.tf as plain text
Open outputs.tf as plain text
Open variables.tf as plain text
Open versions.tf as plain text
How to check it worked
In a new repository, push a fine-grained personal access token with no permissions. Push protection blocks it. Bypass the block, and the alert reaches your collector. Revoke the token.
The organisation settings resource manages every setting it covers, so in a real organisation read the plan before applying. The quick start is built for a scratch one.
The new-repository settings leave existing repositories as they are. Standard switches alerts on for the ones you list.
The webhook's signing secret is stored in Terraform state, so the state needs the same protection as the secret.
Requiring actions pinned by commit stops every workflow that uses a tag, so Standard leaves it off until your workflows are pinned.
The supply-chain workflow signs with a certificate issued to the workflow run, so the signature names the repository and workflow file. The admission policy's subject pattern has to match that, which is why both templates use https://github.com/your-org/*.
How to undo it
terraform destroy removes the webhook, the Actions limits, and the security manager assignment. Organisation settings keep their last values, because GitHub has no way to delete them.
What it costs
Nothing for public repositories. Private repositories need GitHub's security licences for secret scanning and push protection.
Good to know
- A leaked key found by push protection costs nothing. The same key found in a public repository a week later is an incident, so the alert feed treats every bypass as one.
- The webhook also reports when someone switches a scanner off or makes a repository public, which is how a quiet exposure usually starts.