Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .github/workflows/alert-delivery-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Independent Scheduled Alert-Delivery Verification (POAM-2026-230 Property 4)
#
# Runs outside GKE, Cloud Monitoring, and Cloud Pub/Sub using keyless GitHub OIDC
# Workload Identity Federation (`google_service_account.alert_verifier` in
# `infra/targets/gcp-gke/wif.tf`). Any failure in:
# - runtime AlertPolicy channel bindings or channel-set equality,
# - synthetic `alert_pipeline_heartbeat` delivery to the terminal Pub/Sub sink, or
# - periodic in-cluster `compliance-bridge` notifier heartbeat freshness
# fails this GitHub Actions workflow run directly — surfacing through GitHub's
# independent workflow-failure channel rather than depending on the alert
# channels under test.

name: Scheduled Alert Delivery Verification

on:
schedule:
- cron: "17 */6 * * *"
workflow_dispatch:
inputs:
emit_ondemand_bridge_probe:
description: "Also publish an immediate synthetic compliance-bridge probe to CAGE_ALERT_VERIFY_PUBSUB_TOPIC"
required: false
type: boolean
default: false

permissions:
contents: read
id-token: write

concurrency:
group: alert-delivery-check
cancel-in-progress: false

jobs:
verify-alert-delivery:
name: Verify Cloud Monitoring & Notifier Pub/Sub Delivery
if: github.repository == 'google/cybernetic-agent-governance-engine' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-24.04
timeout-minutes: 10

steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Fail closed if verifier WIF or target variables are unset
env:
WIF_PROVIDER: ${{ vars.CAGE_ALERT_VERIFIER_WIF_PROVIDER }}
WIF_SA: ${{ vars.CAGE_ALERT_VERIFIER_SERVICE_ACCOUNT }}
TARGET_PROJECT: ${{ vars.CAGE_ALERT_VERIFY_GCP_PROJECT }}
TARGET_SUBSCRIPTION: ${{ vars.CAGE_ALERT_VERIFY_PUBSUB_SUBSCRIPTION }}
run: |
set -euo pipefail
missing=()
[[ -z "${WIF_PROVIDER}" ]] && missing+=("CAGE_ALERT_VERIFIER_WIF_PROVIDER")
[[ -z "${WIF_SA}" ]] && missing+=("CAGE_ALERT_VERIFIER_SERVICE_ACCOUNT")
[[ -z "${TARGET_PROJECT}" ]] && missing+=("CAGE_ALERT_VERIFY_GCP_PROJECT")
[[ -z "${TARGET_SUBSCRIPTION}" ]] && missing+=("CAGE_ALERT_VERIFY_PUBSUB_SUBSCRIPTION")
if (( ${#missing[@]} > 0 )); then
echo "::error::[POAM-2026-230] Missing required repository variables for independent alert-delivery verification: ${missing[*]}"
exit 1
fi

- name: Mint short-lived GCP access token via keyless WIF
id: gcp_auth
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
with:
workload_identity_provider: ${{ vars.CAGE_ALERT_VERIFIER_WIF_PROVIDER }}
service_account: ${{ vars.CAGE_ALERT_VERIFIER_SERVICE_ACCOUNT }}
token_format: access_token
create_credentials_file: false
export_environment_variables: false

- name: Verify runtime AlertPolicy bindings and terminal Pub/Sub heartbeat delivery
env:
GOOGLE_OAUTH_ACCESS_TOKEN: ${{ steps.gcp_auth.outputs.access_token }}
TARGET_PROJECT: ${{ vars.CAGE_ALERT_VERIFY_GCP_PROJECT }}
TARGET_CLUSTER: ${{ vars.CAGE_ALERT_VERIFY_CLUSTER_NAME || 'cage-staging' }}
TARGET_SUBSCRIPTION: ${{ vars.CAGE_ALERT_VERIFY_PUBSUB_SUBSCRIPTION }}
EXPECTED_CHANNEL: ${{ vars.CAGE_ALERT_VERIFY_EXPECTED_CHANNEL }}
TARGET_TOPIC: ${{ vars.CAGE_ALERT_VERIFY_PUBSUB_TOPIC }}
EMIT_PROBE: ${{ inputs.emit_ondemand_bridge_probe || false }}
run: |
set -euo pipefail
extra_args=()
if [[ -n "${EXPECTED_CHANNEL}" ]]; then
extra_args+=(--expected-channel "${EXPECTED_CHANNEL}")
fi
if [[ "${EMIT_PROBE}" == "true" && -n "${TARGET_TOPIC}" ]]; then
extra_args+=(--emit-bridge-heartbeat-topic "${TARGET_TOPIC}")
fi
python3 scripts/verify_alert_delivery.py \
--project "${TARGET_PROJECT}" \
--cluster-name "${TARGET_CLUSTER}" \
--subscription "${TARGET_SUBSCRIPTION}" \
"${extra_args[@]}"
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### Changed

- **Enforcing postures fail closed on unbound or disabled Cloud Monitoring channels and console `compliance-bridge` notifiers, single-replica rollout scrape noise and orphaned pod-series incidents are eliminated, and an independent scheduled CI workflow verifies Pub/Sub destination delivery** (`fix(infra)!`, [`alert_routing.tf`](infra/targets/gcp-gke/alert_routing.tf), [`lula_alerting.tf`](infra/targets/gcp-gke/lula_alerting.tf), [`metrics_alerting.tf`](infra/targets/gcp-gke/metrics_alerting.tf), [`wif.tf`](infra/targets/gcp-gke/wif.tf), [`compliance_bridge/main.tf`](infra/modules/compliance_bridge/main.tf), [`notifier.py`](src/compliance_bridge/notifier.py), [`verify_alert_delivery.py`](scripts/verify_alert_delivery.py), [`alert-delivery-check.yml`](.github/workflows/alert-delivery-check.yml), [`POAM.md`](docs/POAM.md)).
- Renames `lula_alert_notification_channels` and `lula_alert_owner` to target-wide `var.alert_notification_channels` and `var.alert_owner_label`, resolves every bound channel at plan time via `data.google_monitoring_notification_channel.bound`, and places an enforcing-posture `lifecycle` `precondition` directly on all nine `google_monitoring_alert_policy` resources (including the new synthetic `alert_pipeline_heartbeat` policy).
- Adds `PubSubNotifier` (`ALERT_CHANNEL=pubsub`, CAGE's reference-architecture terminal sink), enforces external notifier configuration at both Terraform plan time (`kubernetes_deployment.compliance_bridge`) and pod startup (`validate_notifier_config()` / `create_notifier()` raising `NotifierConfigError` with zero silent fallback to `ConsoleNotifier`), records `alerted` / `remediation_sent` strictly from observed destination acknowledgement (`bool`), and emits periodic non-paging SLA heartbeats.
- Eliminates orphaned per-pod incidents after ReplicaSet rotation (`REDUCE_SUM` / `REDUCE_MAX` pod-series aggregation plus `alert_strategy.auto_close = "1800s"` across all policies) and single-replica rolling-deploy scrape-liveness alert fatigue (`max by (job, namespace) (up == 0)`, `[10m]` `absent_over_time` lookback, `duration = "600s"`), which accounted for 69% (`24/35`) of `cage-staging` notifications.
- Adds pure-stdlib [`verify_alert_delivery.py`](scripts/verify_alert_delivery.py) and keyless OIDC workflow [`alert-delivery-check.yml`](.github/workflows/alert-delivery-check.yml) (`cage-alert-verifier` GSA) to verify runtime channel-set equality and observe both Cloud Monitoring and `compliance-bridge` heartbeats at the terminal Pub/Sub subscription without consuming operational alerts.
- **BREAKING — Terraform variables & notifier startup:** `lula_alert_notification_channels` (`list(string)`) and `lula_alert_owner` are replaced by `alert_notification_channels` (`list(object)`) and `alert_owner_label`, enforcing postures require `compliance_alert_channel` (`pubsub`, `slack`, `webhook`, or `pagerduty`), and `send_critical_alert()` / `send_remediation_followup()` return `bool`. See `AL-01` in [`BREAKING_CHANGES.md`](docs/BREAKING_CHANGES.md).

- **Committing runs seal, evidence and return the params the stages evaluated, and an approval is consumed only by a run whose evaluated params it covers** (`fix(governance)!`, [`governor.py`](src/gateway/governance/governor/governor.py), [`sealing.py`](src/gateway/governance/governor/sealing.py), [`approval.py`](src/gateway/governance/governor/approval.py), [`defer_queue.py`](src/gateway/governance/defer_queue.py), [`governance_envelope.py`](src/gateway/governance/governance_envelope.py), [`governance_middleware.py`](src/gateway/server/governance_middleware.py), [`cage_finance/tools/tool_provider.py`](src/cage_finance/tools/tool_provider.py), [`cage_healthcare/tools/tool_provider.py`](src/cage_healthcare/tools/tool_provider.py), [`ADR-008`](docs/adr/ADR-008-wire-phantom-gates-into-production-call-paths.md)).
- Committing runs sealed and evidenced the caller's pre-binding params instead of the params the stages evaluated. `govern()` and `revalidate_post_hitl()` now bind the action's server inputs exactly once; the stages, the seal, the `GOVERNANCE_DECISION` record, refusal receipts and deferral snapshots all name the resulting evaluated params, and the run returns them with the seal as `SealedAction(action, seal, params)`. Tools verify the seal against, and actuate, `SealedAction.params`; the finance tool no longer binds before governance and refuses a NARROW receipt that names other params.
- `revalidate_post_hitl()` checks `PostHitlApproval.covers(evaluated)` before any stage runs, refusing an uncovered request `[APPROVAL_NOT_REDEEMABLE]` without spending the approval, and spends it with `PostHitlApproval.spend(evaluated)`, whose `DeferQueue.consume_approval()` compare-and-swap re-checks coverage of the same params. The gateway's `DeferQueue.redeemable_approval()` pre-check is state-only.
Expand Down
16 changes: 9 additions & 7 deletions compliance/lula/lula-validation-ir6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
#
# Asserts that the compliance-bridge service is running and ready in the cluster.
# The compliance-bridge (src/compliance_bridge/) handles incident notification
# via audit_workflow.py and notifier.py — it is the primary incident reporting
# mechanism for this system, sending alerts to Slack/PagerDuty on critical
# compliance failures (ISO 42001 A.9.2, SC-4, AU-12 violations).
# via audit_workflow.py, sla_monitor.py, and notifier.py — in CAGE's reference
# architecture it publishes critical compliance alerts to GCP Cloud Pub/Sub
# (PubSubNotifier, verified terminal sink; POAM-2026-230), with optional
# Slack/Webhook/PagerDuty downstream fan-out, and refuses to start in enforcing
# postures if ALERT_CHANNEL is unset or set to console/mock.
#
# Domain: kubernetes → compliance-bridge Deployment
# Provider: opa (inline Rego)
Expand All @@ -36,15 +38,15 @@ component-definition:
uuid: af8c8932-9540-5dda-8799-2696a2adf618
metadata:
title: CAGE Validation — IR6
last-modified: '2026-07-01T13:18:54Z'
version: 1.0.0
last-modified: '2026-11-22T21:45:00Z'
version: 1.0.1
oscal-version: 1.1.2
remarks: |-
Auto-converted from standalone lula validation format.
Region: US_FED. Posture: nist-sp800-53.
Notes: NIST SP 800-53 Rev 5 IR-6: Incident Reporting. Namespace: governance-stack (confirmed from live cluster deployment snapshot). Automated verification that the compliance-bridge incident reporting service is live and operational. The compliance-bridge (src/compliance_bridge/) provides:
- Real-time Slack/PagerDuty alerting via notifier.py
- Compliance audit workflow with critical-failure alerting via audit_workflow.py
- Verified GCP Cloud Pub/Sub alert publishing (reference-architecture terminal sink) plus optional Slack/Webhook/PagerDuty fan-out via notifier.py, enforced fail-closed at pod startup in enforcing postures (POAM-2026-230)
- Compliance audit workflow with observed-delivery critical-failure alerting via audit_workflow.py
- The /v1/metrics/* API endpoints consumed by other Lula validations
IR-6 requires that security incidents be reported to appropriate organizational officials and external authorities within defined timeframes — the compliance-bridge is the automated first-responder for this requirement. See: compliance/continuous-monitoring/ISCM_STRATEGY.md — IR-6 monitoring cadence. See: docs/operations/JURISDICTION_INVENTORY.md — ISSO/ISSM incident response chain.
components:
Expand Down
33 changes: 32 additions & 1 deletion docs/BREAKING_CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1417,4 +1417,35 @@ All six authenticated gateway surfaces now enforce out-of-band `SC-7` workload q

---

**Last updated:** November 21, 2026
## Unreleased — Fail-Closed Cloud Monitoring Alert Channel Resolution & Compliance-Bridge Notifier Startup Contract (`POAM-2026-230`)

`infra/targets/gcp-gke/` and `src/compliance_bridge/notifier.py` remove silent empty-channel and console-fallback alerting in enforcing postures, rename the misleadingly Lula-prefixed target-wide alert variables, and return observed boolean delivery confirmations from notifier methods.

| Item | Area | Clean Break Description | Architectural Rationale | Failure Mode on Stale Caller |
|---|---|---|---|---|
| **AL-01** | Target-wide Cloud Monitoring channel resolution, `compliance-bridge` notifier startup validation, and observed delivery return types ([`variables.tf`](../infra/targets/gcp-gke/variables.tf), [`alert_routing.tf`](../infra/targets/gcp-gke/alert_routing.tf), [`lula_alerting.tf`](../infra/targets/gcp-gke/lula_alerting.tf), [`metrics_alerting.tf`](../infra/targets/gcp-gke/metrics_alerting.tf), [`compliance_bridge/main.tf`](../infra/modules/compliance_bridge/main.tf), [`notifier.py`](../src/compliance_bridge/notifier.py)) | Renames `lula_alert_notification_channels` (`list(string)`) to `var.alert_notification_channels` (`list(object({ display_name, type, labels, name }))`), resolved at plan time via `data.google_monitoring_notification_channel.bound` and guarded by a `lifecycle` `precondition` on all nine `google_monitoring_alert_policy` resources. Renames `lula_alert_owner` to `var.alert_owner_label`. Requires `var.compliance_alert_channel` (`pubsub`, `slack`, `webhook`, or `pagerduty`) plus its destination topic/secret in enforcing postures at both Terraform plan time (`kubernetes_deployment.compliance_bridge` precondition) and pod startup (`validate_notifier_config()` / `create_notifier()` raising `NotifierConfigError`, with zero silent fallback to `ConsoleNotifier`). `send_critical_alert()` and `send_remediation_followup()` now return `bool` (`ConsoleNotifier` returns `False`). | Defaulting `lula_alert_notification_channels = []` without plan-time resolution and pinning `alert_channel = "console"` shipped silent alerting across every enforcing profile (`POAM-2026-230`), handing adopters enabled policies that route nowhere and `alerted = True` audit records backed only by stdout logs. | 1. **Stale variable names (`lula_alert_notification_channels` / `lula_alert_owner`):** Passing `-var=lula_alert_notification_channels=...` or `-var=lula_alert_owner=...` on the CLI fails with `Error: Value for undeclared variable` (`The root module does not declare a variable named "lula_alert_notification_channels"`). Keeping either key in `.tfvars` / `terraform.auto.tfvars` emits `Warning: Value for undeclared variable` and ignores the value, leaving `var.alert_notification_channels = []` so `terraform plan` fails closed on the `[POAM-2026-230]` `google_monitoring_alert_policy` preconditions. Migrate to the structured object list below. 2. **Out-of-band channel deletion or disablement:** If a channel listed in `alert_notification_channels` is deleted out-of-band in GCP, `data.google_monitoring_notification_channel.bound` fails plan refresh with `Cannot find notification channel with display_name=...`; recreate the channel (`gcloud beta monitoring channels create`) to apply, or pass `-var='alert_notification_channels=[]'` to `terraform destroy` during teardown. If disabled (`enabled = false`), re-enable via `gcloud beta monitoring channels update <CHANNEL_ID> --enabled`. 3. **Unset / `console` notifier in `staging` or `prod`:** Fails at `terraform plan` (`kubernetes_deployment.compliance_bridge` precondition) and at pod startup (`NotifierConfigError`). 4. **Test doubles:** `send_critical_alert()` / `send_remediation_followup()` mocks must return `True` (`AsyncMock(return_value=True)`) when simulating confirmed delivery. |

**Migration (gitignored `terraform.auto.tfvars`, see [`terraform.auto.tfvars.example`](../infra/targets/gcp-gke/terraform.auto.tfvars.example)):**
```hcl
# Before (retired — triggers 'Value for undeclared variable' + [POAM-2026-230] precondition):
# lula_alert_owner = "secops-oncall"
# lula_alert_notification_channels = ["projects/<PROJECT_ID>/notificationChannels/<CHANNEL_ID>"]

# After (AL-01):
alert_owner_label = "secops-oncall"
alert_notification_channels = [
{
display_name = "cage-staging-alerts-pubsub"
type = "pubsub"
name = "projects/<PROJECT_ID>/notificationChannels/<CHANNEL_ID>" # optional pin
}
]
compliance_alert_channel = "pubsub"
alert_pubsub_topic = "projects/<PROJECT_ID>/topics/cage-staging-alerts"
alert_verify_pubsub_subscription = "cage-staging-alerts-verify"
```

---

**Last updated:** November 22, 2026

Loading
Loading