SECOPS

Cloudflare WAF Drift Detection Against GitHub IaC with Auto-Revert PR

Compares live Cloudflare WAF rules against the version-controlled definition in GitHub on a schedule.

CategorySecOps
Enginesim
Difficultyadvanced
Triggerschedule
Steps6
Setup~25 min

How it runs

The automated pipeline, trigger to output.

  • TriggerScheduled drift check
  • ActionFetch live WAF ruleset from CloudflareCloudflareCloudflare
  • ActionFetch committed WAF definition from GitHubGitHubGitHub
  • LogicDiff live vs. source and branch on drift
  • ActionOpen reconciliation/revert pull requestGitHubGitHub
  • OutputAlert platform team in Slack with PR linkSlack

What it does

Detects when the live Cloudflare WAF configuration has drifted from the source of truth in your GitHub IaC repo. On a mismatch it generates a corrective revert pull request and notifies the team, keeping production aligned with reviewed code.

When to use it

Use it when WAF rules are managed as code (Terraform or JSON) but emergency hotfixes or console edits happen out of band. This catches unmanaged drift before it becomes permanent and forces every change back through code review.

How it works

  1. 1A scheduled run triggers a drift check.
  2. 2The flow pulls the live WAF ruleset from the Cloudflare API and the committed definition from the GitHub repo.
  3. 3It diffs the two and branches on whether meaningful drift exists.
  4. 4If no drift, the run records a clean check and exits.
  5. 5If drift is found, it opens a GitHub pull request that reconciles the repo or reverts the live change, with the diff in the PR body.
  6. 6A Slack alert links the PR and summarizes which rules drifted so a reviewer can decide which direction to reconcile.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect CloudflareWorkers, Pages, R2, KV — the edge stack.
  2. 2
    Connect GitHubRepos, issues, pull requests, actions.
  3. 3
    Connect SlackChannels, DMs, threads, mentions.
  4. 4
    Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
  5. 5
    Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
  6. 6
    Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.

Run this workflow in your colony.

14-day trial. No DevOps. No Sales call. Provisioned in under a minute.