Schedule icon
Request icon
Switch icon
SlackIncomingWebhook icon
If icon
Log icon

Cerbos Authorization Policy Drift & Canary Health Gate

Audit Cerbos PDP authorization policies against canary test vectors, detect policy drift, and alert via Slack.

Categories
Infrastructure

Continuously verifies Cerbos Policy Decision Point (PDP) availability and enforces authorization accuracy against canary test vectors, detecting unauthorized privilege escalations, policy drift, and breaking permission regressions before they impact production microservices.

How it works

  1. periodic_policy_audit (io.kestra.plugin.core.trigger.Schedule) executes every 15 minutes, passing target host, port, and canary test parameters through its inputs block. Shipped disabled by default for safe initial inspection.
  2. probe_cerbos_health (io.kestra.plugin.core.http.Request) invokes the Cerbos REST endpoint GET /api/health to confirm engine initialization and runtime readiness.
  3. probe_canary_authorization (io.kestra.plugin.core.http.Request) calls POST /api/check/resources with a synthetic principal (canary_standard_user) asserting standard view (expected: ALLOW) and delete (expected: DENY) actions on a canary resource.
  4. classify_authorization_verdict (io.kestra.plugin.core.flow.Switch) evaluates the response payload:
    • PDP_UNHEALTHY: Fires when Cerbos health status differs from CERBOS_STATUS_OK, dispatching a high-severity alert to #platform-alerts via io.kestra.plugin.slack.notifications.SlackIncomingWebhook.
    • PRIVILEGE_ESCALATION_DETECTED: Fires when the canary standard user role is granted EFFECT_ALLOW on destructive actions, alerting #security-alerts to security boundary breaches. If auto_reload_store is enabled and dry_run is false, triggers POST /api/reload to restore canonical policies.
    • POLICY_REGRESSION_DETECTED: Fires when legitimate view actions evaluate to EFFECT_DENY, alerting on policy syntax errors that cause false-positive access rejections.
    • HEALTHY: Confirms correct permission boundaries and logs compliant status via io.kestra.plugin.core.log.Log.
  5. log_audit_complete always records execution completion, host address, and verified canary results for regulatory audit lineage.
  6. The global errors block intercepts socket timeouts and connection drops to immediately notify on-call engineers when the Cerbos container is down.

What you get

  • Automated Day 2 regression testing for authorization policies managed via GitOps repositories or Cerbos Hub.
  • Dual detection of both security escalation vulnerabilities (unauthorized actions permitted) and availability outages (authorized actions denied).
  • Stateful dual-condition remediation gate (auto_reload_store: true and dry_run: false) ensuring automated reloads never execute unexpectedly.
  • Clean observability history capturing exactly when policy behavior diverged from expectations.

Who it's for

  • Security and Compliance Engineers maintaining RBAC and ABAC access control policies across distributed services.
  • Platform and DevOps teams operating Cerbos PDP sidecars or centralized authorization clusters.
  • Backend microservice developers relying on external authorization services for zero-trust API security.

Why orchestrate this with Kestra

Authorization policy engines require continuous health checks combined with stateful semantic evaluation. Static health probes only verify whether the HTTP port responds, missing subtle policy syntax bugs, accidental allow rules, or stale GitOps syncs. Kestra orchestrates the synthetic authorization payload, parses multi-action decision trees with Pebble, dispatches structured Slack alerts, and provides a centralized audit log.

Prerequisites

  • A running Cerbos PDP instance (version 0.30+), reachable over HTTP. Cerbos publishes an official open-source container image (ghcr.io/cerbos/cerbos:latest) requiring no license key or enterprise account.
  • A Slack incoming webhook URL configured for security and operational notifications.

Secrets

  • SLACK_WEBHOOK_URL: Slack incoming webhook URL used by alert_privilege_escalation, alert_policy_regression, alert_pdp_unhealthy, and the global errors block.

Quick start

  1. Start a local Cerbos container with sample policies:
    docker run -d --name cerbos-test -p 3592:3592 ghcr.io/cerbos/cerbos:latest
    
  2. Configure the SLACK_WEBHOOK_URL secret in your Kestra namespace.
  3. Import this blueprint into Kestra and trigger an execution with default inputs (dry_run: true).
  4. Confirm that log_healthy_authorization logs successful permission evaluation (view=ALLOW, delete=DENY).
  5. Test alert routing by evaluating an unconfigured role or intentionally triggering drift:
    curl -X POST http://localhost:3592/api/check/resources -H 'Content-Type: application/json' -d '{"principal":{"id":"test","roles":["admin"]},"resources":[{"resource":{"kind":"document","id":"1"},"actions":["delete"]}]}'
    
  6. Enable periodic_policy_audit once verified.

How to extend

  • Add multiple resource kinds and roles to probe_canary_authorization to validate matrix-wide authorization coverage across your entire data model in a single execution.
  • Wire a downstream PagerDuty escalation via io.kestra.plugin.pagerduty.notifications.PagerDutyAlert when PRIVILEGE_ESCALATION_DETECTED fires in production environments.
  • Integrate with Git webhook triggers (io.kestra.plugin.core.trigger.Webhook) to automatically execute this sentinel immediately after policy pull requests merge.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.