Schedule icon
Request icon
Return icon
Switch icon
Log icon
SlackIncomingWebhook icon

Infisical Secret Rotation Compliance Gate

Audit Infisical secret rotation age and alert Slack when a secret is overdue for rotation.

Categories
Infrastructure

A secret that is never rotated is a liability that stays invisible until an audit or an incident surfaces it. This blueprint authenticates against Infisical with a machine identity on a schedule, lists every secret in a project and environment, and pages Slack the moment one has gone longer than policy allows without its value being updated, or Infisical itself cannot be reached.

How it works

  1. login_to_infisical (io.kestra.plugin.core.http.Request) authenticates a machine identity against POST /api/v1/auth/universal-auth/login with a client ID and client secret, returning an accessToken. allowFailure: true lets the flow continue into classification instead of aborting on a bad login.
  2. list_secrets (io.kestra.plugin.core.http.Request) calls GET /api/v4/secrets scoped to project_id and environment, with the accessToken as a Bearer token, returning every secret's secretKey and updatedAt timestamp.
  3. classify_rotation_compliance (io.kestra.plugin.core.debug.Return) checks whether list_secrets.body is defined; if not, UNREACHABLE. Otherwise it uses jq to parse each secret's updatedAt (stripping sub-second precision so fromdateiso8601 can read it) and counts secrets older than rotation_threshold_days, returning NON_COMPLIANT when that count is above zero, COMPLIANT otherwise.
  4. route_by_rotation_compliance (io.kestra.plugin.core.flow.Switch) branches on that string: COMPLIANT logs a quiet confirmation, NON_COMPLIANT pages Slack with the exact overdue secret keys, UNREACHABLE pages Slack separately, and defaults logs the raw outcome.
  5. log_audit_status records a status line on every run regardless of branch, so the execution history is a continuous rotation-compliance trend.
  6. The errors block pages Slack separately if the flow itself fails outright.
  7. The secret_rotation_schedule trigger polls once a day with explicit input overrides, shipped disabled: true until you point it at a real Infisical project.

What you get

  • A scheduled, project-wide secret rotation audit with zero custom Infisical SDK code.
  • A three-way status output (COMPLIANT / NON_COMPLIANT / UNREACHABLE) you can chart or gate other flows on.
  • A Slack page naming the exact secret key(s) overdue for rotation, not just a generic warning.
  • A separate failure channel for the gate flow itself, plus a standing audit log line per run.

Who it's for

  • Security and platform teams running self-hosted Infisical who need to enforce a rotation policy (SOC 2, PCI, or internal) without manually reviewing every secret.
  • Engineering teams migrating off HashiCorp Vault to Infisical who still want the same operational guardrails.

Why orchestrate this with Kestra

A rotation policy that lives only in a wiki page gets ignored. This flow keeps every login, every secret snapshot, and every compliance classification in the execution history, turns the audit into a typed output other flows can depend on, and gives you a Switch branch to grow into real remediation (opening a ticket per overdue secret, triggering a rotation workflow) without rewriting the check itself.

Prerequisites

  • A self-hosted Infisical instance reachable at infisical_url. The free, official Docker image (infisical/infisical) with its bundled docker-compose.yml is enough to fully test this blueprint locally.
  • A machine identity configured with Universal Auth and at least read access to the target project and environment.
  • The target project's ID (from Project Settings) and the environment slug to audit.
  • A Slack incoming webhook for the non-compliant and unreachable alerts.

Secrets

  • INFISICAL_CLIENT_ID: Universal Auth client ID for the machine identity used to authenticate.
  • INFISICAL_CLIENT_SECRET: Universal Auth client secret for that machine identity.
  • SLACK_WEBHOOK_URL: Slack incoming webhook used for the non-compliant alert, the unreachable alert, and the flow-failure alert.
  • OSS note: if your Kestra instance reads secrets from environment variables instead of a secrets backend, set SECRET_INFISICAL_CLIENT_ID, SECRET_INFISICAL_CLIENT_SECRET, and SECRET_SLACK_WEBHOOK_URL as base64, for example echo -n "<your-value>" | base64.

Quick start

  1. Add the INFISICAL_CLIENT_ID, INFISICAL_CLIENT_SECRET, and SLACK_WEBHOOK_URL secrets.
  2. Set infisical_url, project_id, and environment to your Infisical project, and tune rotation_threshold_days to your policy.
  3. Run the flow once and confirm status reads COMPLIANT or NON_COMPLIANT as expected for your current secrets.
  4. Enable secret_rotation_schedule.

How to extend

  • Cross-reference secretReminderRepeatDays (Infisical's own per-secret reminder setting) instead of a single global threshold, for per-secret rotation policies.
  • Add a Loop task over the non-compliant secrets to open one ticket per overdue secret instead of a single combined Slack message.
  • Store each run's non-compliant count in a KV store to build a longer rotation-compliance trend than the execution history alone provides.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.