Stream Kestra audit logs from Kafka to BigQuery
Stream Kestra audit logs from a Kafka topic into Google BigQuery for analytics, monitoring, and compliance reporting.
Audits GCP Secret Manager secret versions to detect unrotated credentials exceeding age policies, delivering security compliance reports via Slack.
Enterprise security compliance frameworks such as SOC 2 Type II, ISO 27001, and PCI-DSS mandate strict cryptographic lifecycle controls, requiring organizations to rotate database credentials, third-party API tokens, and encryption keys on a recurring 90-day cadence. Google Cloud Secret Manager offers secure storage for sensitive configuration payloads, versioning every update. However, without proactive monitoring, development teams frequently provision production API secrets and leave them in active use for years without rotation. When external security audits occur or employee offboarding takes place, stale credentials create serious vulnerability windows and audit non-compliance findings. This sentinel audits all secrets within a target Google Cloud project on a weekly schedule, identifies enabled versions older than the configured threshold (e.g., 90 days), and delivers actionable compliance manifests to SecOps teams on Slack.
0 9 * * 1) or runs on-demand via manual execution.ListSecrets) across the specified project namespace.ListSecretVersions for each discovered secret, isolating versions in the ENABLED state.create_time and flags versions older than max_version_age_days.io.kestra.plugin.core.flow.If flowable checks if stale secrets exist and dispatches a Slack notification to #secops-compliance-alerts.flowchart TD
A[weekly_secret_rotation_audit Schedule Trigger] --> B[scan_secret_versions Python Script]
B --> C[check_staleness_violations Flowable If]
C -- Stale Versions Found --> D[notify_slack_stale_secrets Webhook]
C -- Secrets Compliant --> E[log_compliance_state Log]
D --> E
E --> F[export_secret_manifest Return]
Secret rotation compliance requires periodic scanning across hundreds of cloud credentials, cross-referencing creation timestamps, and routing alerts to relevant teams. Kestra provides scheduled orchestration with container isolation, secure service account credential handling, and native Slack integration. Orchestrating this sentinel in Kestra bridges the gap between static cloud secrets and active security compliance governance.
| Name | Type | Default | Description |
|---|---|---|---|
gcp_project_id |
STRING |
company-prod-security |
Google Cloud project identifier containing the Secret Manager secrets to audit. |
max_version_age_days |
INT |
90 |
Maximum allowable age in days for an enabled secret version before flagging rotation staleness. |
alert_on_stale_secrets |
BOOL |
true |
Whether to dispatch automated Slack alerts when stale unrotated secret versions are identified. |
{{ outputs.scan_secret_versions.vars.project_id }}: Identifier of the evaluated Google Cloud project.{{ outputs.scan_secret_versions.vars.total_secrets }}: Total count of secrets audited in the project.{{ outputs.scan_secret_versions.vars.stale_count }}: Number of secrets with enabled versions exceeding the age threshold.{{ outputs.export_secret_manifest.value }}: Structured dictionary containing the consolidated secret rotation compliance manifest.roles/secretmanager.viewer permissions (payload access is not required).GCP_SERVICE_ACCOUNT_KEY: Service account credentials JSON with permissions to inspect Secret Manager metadata.SLACK_WEBHOOK_URL: Slack Incoming Webhook URL used to dispatch security compliance alerts.GCP_SERVICE_ACCOUNT_KEY and SLACK_WEBHOOK_URL in your Kestra secret storage.company.cloud namespace.gcp_project_id with your GCP project ID.create_time, state); granting roles/secretmanager.secretAccessor is unnecessary and violates least privilege.secretmanager.secrets.list and secretmanager.versions.list permissions.io.kestra.plugin.core.flow.ForEach loop to audit all projects in the GCP organization.