Add approval-monitoring alarms + least-privilege emit role#4
Merged
Conversation
sudsali
force-pushed
the
appsec/approval-monitoring
branch
from
July 22, 2026 20:48
2ca09d6 to
63061c7
Compare
Adds AppSec-requested monitoring for auto-approvals: - Two CloudWatch alarms (approval-spike, high-risk-approval) aggregating the Shadow namespace via Metrics Insights, matching the existing escalation/invocation alarm pattern. - Canonical examples/auto-approve.yml with a two-job split: approve (pull-requests, no AWS) and emit (id-token only) so no job holds both GitHub-write and AWS. High-risk = first-time contributor or large diff. Bot identity (marker/login) is configurable via SHADOW_BOT_NAME / SHADOW_BOT_LOGIN vars; a dismissed approval on a SHA is never re-issued; approval metrics emit independently so one throttle can't drop the other. - ShadowMetricsRole: PutMetricData-only, trust pinned to auto-approve.yml, so the approval workflow never assumes the engine's Bedrock/Secrets/S3 role (MetricsRoleArn output -> AWS_METRICS_ROLE_ARN secret). Also fixes pre-existing bugs surfaced while canonicalizing the workflow: unpaginated listReviews, null review-body/user crashes, and a Condition-0 rename bypass (previous_filename was not checked). Trims verbose comments across the engine to WHY-only; no logic change. Contract tests pin the two new params, the alarm operator/missing-data semantics, the metrics role's least-privilege, and the emitted metric names.
sudsali
force-pushed
the
appsec/approval-monitoring
branch
from
July 23, 2026 18:18
63061c7 to
b17660c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
AppSec asked for approval-specific monitoring beyond the invocation-spike proxy. This adds it, plus the plumbing to emit approval metrics without breaking the two-job security split.
ShadowApprovalSpikeAlarm,ShadowHighRiskApprovalAlarm) aggregating theShadownamespace via Metrics Insights, matching the existing escalation/invocation alarms. High-risk = first-time contributor or large diff.examples/auto-approve.yml(previously not in the engine repo) with a two-job split:approve(pull-requests, no AWS) andemit(id-token only) — no job holds both GitHub-write and AWS.ShadowMetricsRole:PutMetricData-only, trust pinned toauto-approve.yml, so the approval workflow never assumes the engine's Bedrock/Secrets/S3 role. NewMetricsRoleArnoutput →AWS_METRICS_ROLE_ARNsecret.Also fixes (pre-existing, surfaced while canonicalizing the workflow)
listReviewsmissed the latest review on PRs with >30 reviews.previous_filename, so renaming a guarded file out of.github/bypassed human review.Tests
Contract tests pin the two new params' defaults, assert the metrics role is least-privilege (PutMetricData-only, no Bedrock/Secrets/S3, trust pinned to auto-approve.yml), and cross-check workflow-emitted metric names against the alarm SQL. 544 tests pass.