Schedule icon
Request icon
Switch icon
Log icon
SlackIncomingWebhook icon

SpiceDB Authorization Schema and Permission Drift Sentinel

Audit SpiceDB cluster readiness, detect schema drift, verify fine-grained Zanzibar permissions, and trigger automated Slack alerts with Kestra orchestration.

Categories
Infrastructure

Monitors SpiceDB fine-grained authorization cluster readiness, audits active ReBAC schema definitions, evaluates critical subject access relationships, and triggers automated Slack alerts upon permission drift or cluster outages.

How it works

  1. A recurrent Schedule trigger periodically executes the audit sentinel workflow (default every 4 hours, disabled by default for on-demand configuration).
  2. The probe_engine_readiness task performs a health check against SpiceDB's /readyz HTTP endpoint to ensure both the API service and backing datastore (e.g., PostgreSQL, CockroachDB, Spanner) are responsive.
  3. The probe_authorization_schema task calls /v1/schema/read with the configured SPICEDB_PRESHARED_KEY to pull and validate the active Zanzibar schema definition.
  4. The check_critical_permission task executes a real-time permission evaluation against /v1/permissions/check for a designated high-priority subject, permission, and target resource.
  5. The evaluate_authorization_status task uses native Pebble conditionals inside a Switch task to classify the cluster and permission state into COMPLIANT, PERMISSION_STATE_DRIFT, SCHEMA_UNAVAILABLE, ENGINE_UNHEALTHY, or CHECK_API_FAILED.
  6. Depending on the branch outcome, detailed Slack alerts are posted via io.kestra.plugin.slack.notifications.SlackIncomingWebhook with contextual diagnostics, and a comprehensive audit summary is recorded in Kestra's execution history.

What you get

  • Continuous operational visibility into SpiceDB cluster availability and datastore connectivity.
  • Proactive detection of unauthorized or unintended permission state drift for critical platform subjects.
  • Early warning against broken or missing authorization schema definitions before application microservices fail.
  • Immediate incident dispatch to on-call security and platform engineering Slack channels with diagnostic metadata.
  • Centralized audit trail of fine-grained access compliance evaluations preserved in Kestra execution records.

Who it's for

  • Security and DevSecOps engineers managing fine-grained relationship-based access control (ReBAC) policies.
  • Platform teams responsible for maintaining high-availability SpiceDB clusters across Kubernetes environments.
  • SREs requiring automated continuous verification and alerting for critical tier-0 authorization infrastructure.

Why orchestrate this with Kestra

  • Declarative Policy Governance: Define authorization monitoring intervals, target subjects, and escalation webhooks as version-controlled YAML blueprints.
  • Enterprise Secret Masking: Inject SpiceDB preshared keys and Slack incoming webhooks securely via {{ secret(...) }} without plaintext credential exposure.
  • Multi-Branch Incident Routing: Dynamically isolate infrastructure outages from policy drift using built-in Pebble expressions and Switch tasks.
  • Auditable Execution History: Retain complete execution snapshots, response codes, and evaluation timestamps for regulatory compliance drills.

Prerequisites

  • A running SpiceDB instance (local or remote) with the HTTP gateway enabled (e.g., via --http-enabled=true).
  • Network connectivity between the Kestra worker or runner and the SpiceDB HTTP endpoint.
  • A Slack Incoming Webhook URL configured with permission to publish into your operations channel.

Secrets

  • SPICEDB_PRESHARED_KEY: Preshared key or Bearer token configured for authenticating API requests to SpiceDB.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL used for routing incident and drift notifications.

Quick start

  1. Add SPICEDB_PRESHARED_KEY and SLACK_WEBHOOK_URL to your Kestra namespace secrets store.
  2. Import this blueprint into your Kestra instance (e.g., under namespace company.security).
  3. Click Execute with default parameters to test connectivity and review the probe output in the Executions tab.
  4. Activate the scheduled_sentinel_audit trigger to enforce recurrent automated authorization health monitoring.

How to extend

  • Automatic Relationship Repair: Extend the PERMISSION_STATE_DRIFT branch with an authenticated POST /v1/relationships/write task to automatically reinstate missing tuple relationships.
  • Batch Permission Matrix: Wrap the permission check in a ForEach task to audit multiple critical roles and resources in a single execution.
  • PagerDuty Escalation: Add a PagerDuty or Opsgenie task to the ENGINE_UNHEALTHY branch for immediate page-outs during datastore disconnects.
  • CI/CD Deployment Gate: Chain this flow as a pre-flight deployment gate in CI/CD pipelines to guarantee authorization schema validity prior to deploying new services.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.