Webhook icon
Schedule icon
Script icon
Docker icon
If icon
SlackIncomingWebhook icon
Fail icon
Log icon

Verify a Leaver Is Really Gone Before Signing Off Offboarding

A fail-closed gate that checks every named system for a leaver, records one evidence record per run, and alerts Security on any residual or inconclusive result.

Categories
Infrastructure

How it works

  1. leaver_offboarded (io.kestra.plugin.core.trigger.Webhook, keyed with the LEAVER_GATE_WEBHOOK_KEY secret) runs the gate the moment HRIS or ITSM marks someone terminated, taking the leaver username and email from the webhook body. weekly_reverification (io.kestra.plugin.core.trigger.Schedule, cron 0 6 * * 1) is the weekly safety net and ships disabled: true until the system list and credentials are reviewed and its inputs are set to the leaver under watch.
  2. run_system_checks (io.kestra.plugin.scripts.python.Script on python:3.12-slim, standard library only) checks each system read-only: GitHub org membership (204 means still a member, 404 means gone), Slack user lookup (absent or deactivated means gone), Google Workspace user status (absent or suspended means gone), and AWS IAM login profile via a signed Query API request (NoSuchEntity means gone). A system outside the systems input is reported as skipped, never silently omitted.
  3. The verdict fails closed: BLOCKED when any system still admits the leaver, and also BLOCKED when any system cannot be checked while fail_on_inconclusive is true. Only a clean sweep across every checked system yields PASS.
  4. alert_on_residual (io.kestra.plugin.core.flow.If) posts the verdict, the residual count and the full evidence record to Slack whenever the gate does not pass, and logs the clean result otherwise. When the verdict is BLOCKED, the nested fail_when_blocked step fails the execution itself (io.kestra.plugin.core.execution.Fail), so a leaver with residual access is never signed off by a green run; an INCONCLUSIVE verdict with fail_on_inconclusive set to false only alerts, by operator choice. The flow level errors handler reports a gate failure itself, because a gate that dies silently looks exactly like a clean leaver.
  5. Flow outputs verdict and residual_count let a downstream offboarding sign-off step branch on the result: sign-off requires verdict PASS and residual count zero.

What you get

  • Proof instead of trust: one evidence record per run showing each system's verdict, not just a deprovisioning ticket marked done.
  • A fail-closed default: uncheckable systems block sign-off rather than passing quietly, unless an operator deliberately relaxes fail_on_inconclusive during a known outage.
  • A named alert: Security learns exactly which systems still admit the leaver, instead of a generic offboarding failure.
  • A re-verification cadence: the same gate re-runs at T+24h and T+7d from the schedule or a re-triggered webhook, so a reactivated account is caught after the first pass.

Who it is for

  • Identity and security teams who own joiner, mover and leaver controls and need the leaver check to survive a SOC 2 or ISO 27001 audit.
  • IT operations teams who run offboarding across several SaaS systems and want one sign-off gate instead of four console checks.
  • Compliance teams who need a timestamped evidence record per leaver, per run.

Why orchestrate this with Kestra

A leaver check done by hand in four consoles is four chances to skip a system, and a script on one laptop has no schedule, no evidence trail and no alert when it fails. Kestra gives the gate a keyed webhook trigger at the moment of termination, a disabled weekly schedule as the safety net, one version controlled file holding the system list and the fail-closed policy, a conditional branch that separates the alert from the all clear, and an execution history that proves the gate actually ran for each leaver.

Prerequisites

  • A Kestra worker with Docker access, the check runs in python:3.12-slim with only the standard library.
  • Read-only credentials for each system you check: a GitHub token that can read org membership, a Slack token for user lookup, a Google Workspace token for directory reads, and AWS keys for IAM reads.
  • A Slack incoming webhook for residual alerts and for gate failure alerts.

Secrets

  • LEAVER_GATE_WEBHOOK_KEY: key segment guarding the offboarding webhook URL, anyone holding it can trigger a leaver check.
  • GITHUB_TOKEN: token used to check GitHub org membership.
  • SLACK_TOKEN: token used for Slack user lookup.
  • GOOGLE_TOKEN: token used for Google Workspace directory reads.
  • AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY: keys used to sign the IAM login profile request.
  • SLACK_WEBHOOK_URL: Slack incoming webhook URL for residual and failure alerts.

Quick start

  1. Add the secrets above to your Kestra namespace.
  2. Run the flow once with a test leaver that is already fully deprovisioned and confirm verdict reads PASS and residual_count reads 0.
  3. Re-run with a test account that is still a GitHub org member and confirm verdict reads BLOCKED, residual_count reads 1, and the Slack alert names GitHub.
  4. Trigger leaver_offboarded from your HRIS or ITSM webhook, or set disabled: false on weekly_reverification once the system list and credentials are in place and the schedule inputs are set to the leaver under watch.

How to extend

  • Add a system by adding one check function and one row in the evidence list, keeping the same PASS, FAIL and ERROR contract so the fail-closed verdict logic does not change.
  • Point the alert at PagerDuty instead of Slack on the critical path by swapping the webhook task for a PagerDuty notification.
  • Write the evidence record to S3 or a KV namespace by adding a storage task after run_system_checks, using the evidence output as the record body.
  • Scope the system list per leaver risk tier by passing a shorter systems input for contractors and the full list for employees with production access.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.