Push code to Git at regular intervals
Continuously push your Kestra flows and namespace files to a Git repository on a schedule for GitOps version control.
Audit a GCS bucket for objects missing a customer-managed encryption key, alert on breach, and optionally quarantine them.
Google Cloud Storage encrypts every object by default, but a Google-managed key is
not the same as a customer-managed key (CMEK) that a compliance program, a regulator,
or a customer contract actually requires - and nothing in GCS itself alerts you when an
object lands without one. This blueprint lists a bucket, flags any object whose
kmsKeyName is empty, alerts Slack on breach, and can quarantine the offending objects
by moving them under a review prefix - never deleting anything, and never attempting to
change an object's encryption key in place.
periodic_encryption_check (io.kestra.plugin.core.trigger.Schedule) runs every 6 hours, always forcing auto_remediate: "false" and dry_run: "true" through its own inputs: override regardless of this flow's defaults. Shipped disabled so you can validate a manual run first.list_bucket_objects (io.kestra.plugin.gcp.gcs.List) lists every blob under audit_prefix with listingType: RECURSIVE, filter: FILES, and maxFiles: 1000 (raised from the task's documented default of 25), returning each blob's kmsKeyName, uri, name, and other metadata.evaluate_encryption_policy (io.kestra.plugin.scripts.python.Script) reads that listing and collects every blob whose kmsKeyName is empty into non_cmek_objects, emitting non_cmek_count and non_cmek_objects through Kestra.outputs.evaluate_encryption_gate (io.kestra.plugin.core.flow.If) flags a breach whenever non_cmek_count > max_unencrypted_count.then (breach): route_remediation (io.kestra.plugin.core.flow.Switch on auto_remediate) either considers remediation ("true", gated again by dry_run through check_dry_run) or only logs that remediation is disabled ("false"). When both gates allow it, quarantine_unencrypted_objects (io.kestra.plugin.core.flow.Loop) moves each flagged object into quarantine_prefix with io.kestra.plugin.gcp.gcs.Copy (delete: true, so the source is removed once the copy succeeds). alert_encryption_risk always fires to Slack regardless of which path ran.else (compliant): log_encryption_healthy records a clean check.log_audit_complete always runs last, printing the headline numbers regardless of which branch fired.errors block alerts Slack separately if the flow itself fails - invalid credentials or an unreachable bucket must not read as "no breach".quarantine_prefix for manual re-encryption review; nothing is deleted, and no object's encryption key or content is ever modified by this flow.auto_remediate, dry_run) between "breach detected" and "object actually quarantined".List's full blob metadata (kmsKeyName, eventBasedHold, temporaryHold, retentionExpirationTime) beyond basic file transfer.GCS itself has no policy engine that compares an object's encryption key against a requirement and decides what to do about it - bucket-level default encryption only governs new writes, it does not retroactively flag or fix what already landed. Kestra fills that gap: List supplies the real metadata, the script step applies the actual policy, If/Switch make the decision a first-class, auditable branch, Loop isolates each quarantine move so one failure never blocks the rest, and the whole policy lives in version-controlled YAML instead of a bucket setting nobody audits.
GCP_PROJECT_ID / GCP_SERVICE_ACCOUNT credentials, with read access to list objects and write/delete access if remediation is enabled.Local testing (UNVERIFIED end to end - see Pitfalls):
docker run -d --name gcs-encryption-gate -p 4443:4443 fsouza/fake-gcs-server -scheme http
docker network connect YOUR_KESTRA_NETWORK gcs-encryption-gate (only needed if the Kestra Worker runs in a separate Docker network than this container).
fsouza/fake-gcs-server is a community GCS emulator; the official Google Cloud Storage client redirects to it via the STORAGE_EMULATOR_HOST environment variable, which must be set on the Kestra Worker process itself (for example STORAGE_EMULATOR_HOST=http://gcs-encryption-gate:4443 in the Worker's environment) - there is no such property on the List/Copy tasks themselves. This has not been run against a live Kestra Worker in this environment; confirm it before relying on it.
GCP_PROJECT_ID: GCP project ID, matching this plugin's own documented pattern (see gcs-download-transform-load.yaml). Against the emulator above, any non-empty placeholder value is sufficient since the emulator does not validate it.GCP_SERVICE_ACCOUNT: GCP service account JSON key. Against the emulator above, this may not be required at all depending on the client library version; a real bucket always requires a real key with list/write/delete permissions.SLACK_WEBHOOK_URL: Slack incoming webhook used by alert_encryption_risk and the errors block.SECRET_, base64-encoded, and read back in flows with {{ secret('NAME') }} - for example SECRET_SLACK_WEBHOOK_URL=$(echo -n 'https://hooks.slack.com/...' | base64). This keeps credentials out of the flow YAML but, per Kestra's own documentation, offers no encryption at rest or access control beyond the host environment; use the Enterprise secrets backend for stronger guarantees.bucket (STRING, default data-lake): bucket audited.audit_prefix (STRING, default empty): restricts the audit to this prefix; empty audits the whole bucket.max_unencrypted_count (INT, default 0): breach threshold; 0 means any non-CMEK object at all breaches.quarantine_prefix (STRING, default unencrypted-review/): destination prefix for quarantined objects.auto_remediate (SELECT: "false", "true"; default "false"): must be "true" for quarantine to even be considered.dry_run (SELECT: "true", "false"; default "true"): must be explicitly "false", together with auto_remediate: "true", for objects to actually be moved.outputs.list_bucket_objects.blobs: the raw blob listing (kmsKeyName, uri, name, size, eventBasedHold, temporaryHold, retentionExpirationTime, and more) for every run.outputs.evaluate_encryption_policy.vars.non_cmek_count / .non_cmek_objects: the computed policy result for every run.bucket and audit_prefix at a real bucket with a mix of CMEK-encrypted and default-encrypted objects (or start from the emulator setup above once verified in your own environment).GCP_PROJECT_ID, GCP_SERVICE_ACCOUNT, and SLACK_WEBHOOK_URL secrets.auto_remediate: "false") and confirm alert_encryption_risk fires naming the expected non-CMEK count, and that log_remediation_disabled logs without moving anything.auto_remediate: "true" and dry_run: "true" and confirm log_dry_run_remediation describes the quarantine without running it.auto_remediate: "true" and dry_run: "false" and confirm the flagged objects now live under quarantine_prefix and are gone from their original paths.periodic_encryption_check once you trust the check; it always runs in the safe auto_remediate: "false" / dry_run: "true" mode regardless of what you leave the flow's own defaults set to.evaluate_encryption_policy to also flag objects with eventBasedHold/temporaryHold both false (also returned by List), if your compliance program requires legal holds on certain prefixes.bucket/audit_prefix pairs with io.kestra.plugin.core.flow.Loop to audit multiple buckets in one run.Pause approval task between evaluate_encryption_gate and the quarantine branch for a human-reviewed gate instead of (or alongside) the static auto_remediate input.gsutil rewrite -k), since neither List nor Copy in this plugin expose a destination KMS key property; this blueprint deliberately only quarantines for review rather than attempting an unsupported in-place re-encryption.Copy. Verified from the plugin's own schema: from, to, delete, projectId, serviceAccount, impersonatedServiceAccount, scopes, assets are the only properties. This is why remediation quarantines non-compliant objects for manual re-encryption instead of attempting to re-encrypt them in place.List's maxFiles defaults to 25. Verified from the plugin's own documentation. This blueprint sets maxFiles: 1000; a bucket with more objects than that under audit_prefix will still be under-audited, and evaluate_encryption_policy has no way to know the listing was truncated.STORAGE_EMULATOR_HOST is a convention honored by Google's own Cloud Storage client libraries, not a documented property of this Kestra plugin's tasks; whether it is respected depends on the client library version this plugin bundles, and this has not been confirmed against a running Kestra Worker in this environment.auto_remediate and dry_run are independent gates, not a single boolean. Both must be "true"/"false" respectively for the quarantine Loop to run; setting only one leaves the other still blocking.Switch case keys "true"/"false" are quoted strings. auto_remediate renders as the literal string "true" or "false"; unquoted true:/false: YAML map keys would parse as booleans instead and would not match.