Schedule icon
Webhook icon
Loop icon
Request icon
Script icon
If icon
SlackIncomingWebhook icon
OutputValues icon

Detect Stale Vault Secrets Past Their Rotation Window

Watch Vault secret age with Kestra. Detect stale credentials past rotation policy and alert Slack.

Categories
Infrastructure

Static credentials are a breach waiting to happen. This blueprint scans configurable Vault KV v2 paths every weekday morning, reads each entry's version metadata to compute credential age, and posts a Slack alert only when a secret exceeds its rotation window (default 90 days). A webhook trigger enables on-demand scans before audits.

How it works

  1. daily_scan (io.kestra.plugin.core.trigger.Schedule, cron 0 7 * * MON-FRI) launches the run; on_demand_webhook allows ad-hoc scans.
  2. scan_secrets (io.kestra.plugin.core.flow.Loop, concurrency 4) fans out across inputs.mount_paths.
  3. fetch_metadata (io.kestra.plugin.core.http.Request) reads KV v2 metadata with allowFailed: true.
  4. evaluate_age (io.kestra.plugin.scripts.python.Script) parses created_time stamps and sets stale.
  5. alert_on_stale (io.kestra.plugin.core.flow.If) posts to Slack (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) only for stale secrets.
  6. emit_rotation_metrics (io.kestra.plugin.core.output.OutputValues) exports coverage for compliance history.

What you get

  • Daily age report across any number of secret paths.
  • Rotation-window gate (default 90 days) with Slack alerts.
  • Path, age, and last-version details per offender.
  • Failure alert if the sentinel itself errors.

Who it's for

  • Security engineers enforcing credential rotation policy.
  • Platform teams owning Vault and secret lifecycle.
  • Compliance teams evidencing rotation before audits.

Prerequisites

  • A Vault cluster with KV v2 mounted at secret/.
  • A token with metadata read on the scanned paths.

Secrets

  • VAULT_TOKEN: token used to read KV metadata.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook for stale and failure alerts.
  • WEBHOOK_KEY: auth key for the on-demand webhook trigger.

Quick start

  1. Set VAULT_TOKEN, SLACK_WEBHOOK_URL, and WEBHOOK_KEY secrets.
  2. Edit vault_addr, mount_paths, and max_age_days inputs.
  3. Run once manually to verify Vault access.
  4. Enable the daily_scan schedule.

How to extend

  • Auto-trigger rotation workflows per stale path.
  • Persist age history to Postgres for MTTR-style rotation metrics.
  • Open Jira tickets per stale secret with path and owner.

Links

Inputs

  • vault_addr (STRING): base URL of the Vault cluster.
  • mount_paths (ARRAY of STRING): KV paths to scan.
  • max_age_days (INT, default 90): rotation window in days.

Outputs

  • emit_rotation_metrics.values.paths_scanned: number of paths scanned.
  • emit_rotation_metrics.values.scanned_at: run timestamp for audit reports.
See How

New to Kestra?

Use blueprints to kickstart your first workflows.