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

Fail Promotion When the Shipped SBOM Drifts from the Build Baseline

Rebuild the shipped SBOM with Syft, diff it against the build-time baseline, and fail promotion when package drift exceeds your threshold.

Categories
Infrastructure

How it works

  1. on_artifact_promote (io.kestra.plugin.core.trigger.Webhook, keyed) accepts the artifact name from your CD pipeline. nightly_drift_sweep (io.kestra.plugin.core.trigger.Schedule) ships disabled: true as a fallback net once an operator switches it on.
  2. sbom_workspace (io.kestra.plugin.core.flow.WorkingDirectory) opens one shared filesystem so the artifact tree, the baseline, the Syft report, and the drifter all see the same files.
  3. prepare_artifact (io.kestra.plugin.scripts.shell.Commands on python:3.12-slim) writes a fixture artifact tree plus the build-time baseline.json with heredocs. Swap this task for a io.kestra.plugin.git.Clone or an artifact download to diff a real build.
  4. generate_sbom (io.kestra.plugin.scripts.shell.Commands on the io.kestra.plugin.scripts.runner.docker.Docker runner, image anchore/syft:latest) runs syft dir:./app -o syft-json=syft-report.json || true with the exit code absorbed, and falls back to a bundled fixture SBOM when the tool cannot run, so the gate behaves the same offline and online.
  5. compare_baseline (io.kestra.plugin.scripts.python.Script on python:3.12-slim) diffs the package sets, computes the churn percentage as added plus removed over the baseline size, and emits the verdict with both package lists through the outputs protocol.
  6. check_drift (io.kestra.plugin.core.flow.If) branches on the churn percentage. Above the threshold, alert_slack_drift posts the added and removed packages to Slack and fail_artifact (io.kestra.plugin.core.execution.Fail) turns the execution red so the promotion stops. At or below it, log_clean records the attestation.
  7. The errors block alerts Slack whenever the rebuild or the comparison itself breaks, because a dead SBOM job looks exactly like a clean artifact.

What you get

  • An attestation gate that fails a promotion when the shipped package set no longer matches what the build recorded.
  • A churn percentage with explicit added and removed lists, so reviewers see what changed instead of a binary flag.
  • A threshold you can tune per artifact class, strict for payment components, looser for internal tooling.
  • Gateable outputs, verdict, drift_pct, package_count, added_packages, and removed_packages for any parent pipeline.
  • A dated execution history that doubles as the SBOM attestation record for that artifact.

Who it's for

  • Release engineers who need proof the SBOM they signed still describes the bits they are promoting.
  • Security and compliance teams tracking supply chain posture against a recorded baseline.
  • Platform teams that want drift visible in Slack before it becomes an audit finding.

Why orchestrate this with Kestra

Syft builds a perfect SBOM in seconds, but the interesting question is always comparative, what changed since the build, and who decides that is acceptable. Kestra holds the comparison state in one flow, gives the check a trigger from CD, keeps the tool version hermetic in the container tag, branches on the churn threshold, and leaves a dated execution with the package lists attached. A CI script regenerating an SBOM and overwriting the old file gives you none of that, it destroys the very baseline you needed to prove drift.

Prerequisites

  • A worker with Docker access, the fixture prep and the drifter run on python:3.12-slim and the SBOM rebuild in the Syft container.
  • A Slack incoming webhook for drift alerts and for failure alerts.
  • A CD pipeline able to POST to the keyed webhook URL and to wait on the execution result.

Secrets

  • SBOM_DRIFT_WEBHOOK_KEY: key segment guarding the webhook URL, anyone holding it can trigger a drift check.
  • SLACK_WEBHOOK_URL: Slack incoming webhook URL.

Quick start

  1. Add the secrets above to your Kestra namespace.
  2. Run the flow once with the default inputs and confirm the bundled fixture produces verdict set to DRIFT with added_packages and removed_packages in the outputs.
  3. Lower the baseline churn by editing baseline.json in prepare_artifact to match the fixture SBOM, then re-run and watch the verdict flip to CLEAN.
  4. Point drift_threshold_pct at your tolerance, then trigger from CD at /api/v1/{tenant}/executions/webhook/{namespace}/syft-sbom-artifact-drift-gate/{SBOM_DRIFT_WEBHOOK_KEY}.

How to extend

  • Diff real builds by replacing the heredocs in prepare_artifact with a io.kestra.plugin.git.Clone of the repository and an artifact download for the shipped tarball.
  • Store the approved baseline in a Kestra KV store or a bucket and load it with the matching plugin task instead of the heredoc file.
  • Fan the check across many artifacts by wrapping this flow in a parent that calls it with a Subflow per artifact.
  • Archive syft-report.json to object storage with io.kestra.plugin.aws.s3.Upload so every promotion keeps its exact SBOM artifact.
  • Compare CycloneDX or SPDX formats instead by adding a second Syft output flag and teaching compare_baseline the alternate schema.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.