Skip to content

fix: aws - cloudfront - wafv2-enabled scope, stamp .post1 - #22

Merged
jtroup merged 2 commits into
release/2026-08-26from
elmo/polite-drum
Sep 4, 2026
Merged

jtroup merged 2 commits into
release/2026-08-26from
elmo/polite-drum

Conversation

@jtroup

@jtroup jtroup commented Sep 4, 2026 •

Copy link
Copy Markdown

ENG-8730

what

Cherry-pick upstream
#11039
onto the 2026.08.26 release branch and stamp the workspace
0.9.52a5.post1+a83dda5c9.

WafV2FilterBase._get_web_acls passed the scope it wanted through
resources(query=...), which the wafv2 resource manager then
overwrote with its own. It now passes the scope as resource manager
data, where the manager reads both the API Scope and the region to
call from. DescribeWafV2.get_query_params raises
PolicyValidationError on a conflicting caller-supplied Scope
rather than discarding it, so the same mistake fails loudly.

The release workflow's Assert prerelease version guard accepts an
optional .postM between aN and +HASH. It still rejects a
version missing either the prerelease or the local segment, and a
.post that is not followed by digits.

why

CLOUDFRONT web ACLs are global and are only listed from us-east-1.
With the requested scope dropped in favour of the REGIONAL default,
wafv2-enabled never saw a distribution's web ACL, so
state: false matched distributions that are in fact protected —
false positives on aws-cloudfront-waf-disabled-inform for a
customer running that policy.

2026.08.26 shipped
#10975,
which fixed the scope for the set-wafv2 action, but the filter
regression was merged upstream after the cohort's c7n was stamped.

Fixes: 1f20e9f ("Wafv2 Refactor Scope Region Logic (cloud-custodian#10827)")

testing

The cherry-pick brings upstream's coverage: a distribution with a
CLOUDFRONT-scoped web ACL attached is not matched by
wafv2-enabled with state: false, and the filter is asserted to
have listed web ACLs with Scope: CLOUDFRONT. A second test covers
the new conflict error when a caller passes a Scope that disagrees
with the resource manager's.

docs

No docs needed.


🤖 Generated with Claude Code

@jtroup
jtroup requested a review from a team as a code owner September 4, 2026 13:23
@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR corrects CloudFront WAFv2 filter discovery by carrying CLOUDFRONT scope in resource-manager data, adds an explicit error for conflicting caller scope, and stamps the release workspace as .post1.

  • CloudFront WAFv2 discovery now derives both API scope and the required us-east-1 endpoint from the related resource manager.
  • Regression fixtures verify that an attached CLOUDFRONT Web ACL is not reported as missing.
  • Release metadata and editable lockfile entries are updated consistently.
  • The release guard accepts stamped alpha post releases, but its version grammar remains untested.

Confidence Score: 4/5

The PR appears safe to merge, with only a non-blocking request to add regression coverage for the release-version guard.

The WAFv2 scope now flows through the manager that controls both query parameters and endpoint selection, and workspace versions are consistent; the remaining concern is that the manually dispatched release guard’s new version grammar is not protected by tests.

Files Needing Attention: .github/workflows/stacklet-release.yml

Important Files Changed

Filename Overview
c7n/filters/waf.py Passes WAFv2 scope through related-manager data so scope and endpoint selection remain aligned.
c7n/resources/waf.py Rejects caller-supplied Scope values that conflict with the WAFv2 manager’s scope.
tests/test_cloudfront.py Adds regression coverage for CloudFront-scoped ACL discovery and conflicting scope validation.
.github/workflows/stacklet-release.yml Accepts .postM alpha hotfix versions, but the changed release grammar lacks automated tests.
pyproject.toml Stamps the root package with the intended .post1 prerelease version.
uv.lock Updates only editable workspace package versions consistently with their manifests.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  CF[CloudFront distribution filter] --> RM[WAFv2 resource manager]
  RM --> Scope[Scope: CLOUDFRONT]
  Scope --> Region[Endpoint: us-east-1]
  Region --> List[List CLOUDFRONT Web ACLs]
  List --> Match[Match distribution WebACL ARN]
  Match --> Result[Protected distribution excluded from state:false]
Loading

Fix all with Greploop Fix All in Claude Code

Prompt To Fix All With AI
### Issue 1
.github/workflows/stacklet-release.yml:37
**Release guard remains untested**

The new `.postM` version grammar has no automated coverage, even though this manually dispatched guard previously blocked releases after an untested regex change. This is non-blocking, but tests should cover ordinary stamped prereleases, stamped post releases, missing prerelease or local segments, and `.post` without digits to prevent another publishing failure.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "fix: aws - cloudfront - wafv2-enabled sc..." | Re-trigger Greptile

version=$(grep -m1 '^version' pyproject.toml | cut -d'"' -f2)
if [[ ! "$version" =~ a[0-9]+[+][0-9a-zA-Z.]+$ ]]; then
echo "::error::cloud-custodian-prerelease must ship a stamped prerelease version (…aN+HASH); got '$version'"
if [[ ! "$version" =~ a[0-9]+(\.post[0-9]+)?[+][0-9a-zA-Z.]+$ ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Release guard remains untested

The new .postM version grammar has no automated coverage, even though this manually dispatched guard previously blocked releases after an untested regex change. This is non-blocking, but tests should cover ordinary stamped prereleases, stamped post releases, missing prerelease or local segments, and .post without digits to prevent another publishing failure.

Knowledge Base Used: Require the release version hash stamp

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/stacklet-release.yml
Line: 37

Comment:
**Release guard remains untested**

The new `.postM` version grammar has no automated coverage, even though this manually dispatched guard previously blocked releases after an untested regex change. This is non-blocking, but tests should cover ordinary stamped prereleases, stamped post releases, missing prerelease or local segments, and `.post` without digits to prevent another publishing failure.

**Knowledge Base Used:** [Require the release version hash stamp](https://app.greptile.com/stacklet/-/custom-context/knowledge-base/stacklet/cloud-custodian-prerelease/-/reverts/incident-mitigation_10-20260821-prerelease-hash-guard-b5ad5bf.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid, but not fixing on the release branch will fix on mainline (stacklet/intergration)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. Since this PR is limited to the release-branch hotfix, keeping the release-guard coverage follow-up on stacklet/integration avoids expanding the backport. No further change is needed here.

Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 22 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/workflows/stacklet-release.yml">

<violation number="1" location=".github/workflows/stacklet-release.yml:37">
P3: Add automated coverage for this release guard's accepted and rejected version forms, including `.postM`, missing prerelease or local segments, and `.post` without digits. Without tests, a future regex edit can block or allow an invalid release unnoticed.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

version=$(grep -m1 '^version' pyproject.toml | cut -d'"' -f2)
if [[ ! "$version" =~ a[0-9]+[+][0-9a-zA-Z.]+$ ]]; then
echo "::error::cloud-custodian-prerelease must ship a stamped prerelease version (…aN+HASH); got '$version'"
if [[ ! "$version" =~ a[0-9]+(\.post[0-9]+)?[+][0-9a-zA-Z.]+$ ]]; then

@cubic-dev-ai cubic-dev-ai Bot Sep 4, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: Add automated coverage for this release guard's accepted and rejected version forms, including .postM, missing prerelease or local segments, and .post without digits. Without tests, a future regex edit can block or allow an invalid release unnoticed.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/stacklet-release.yml, line 37:

<comment>Add automated coverage for this release guard's accepted and rejected version forms, including `.postM`, missing prerelease or local segments, and `.post` without digits. Without tests, a future regex edit can block or allow an invalid release unnoticed.</comment>

<file context>
@@ -26,15 +26,16 @@ jobs:
           version=$(grep -m1 '^version' pyproject.toml | cut -d'"' -f2)
-          if [[ ! "$version" =~ a[0-9]+[+][0-9a-zA-Z.]+$ ]]; then
-            echo "::error::cloud-custodian-prerelease must ship a stamped prerelease version (…aN+HASH); got '$version'"
+          if [[ ! "$version" =~ a[0-9]+(\.post[0-9]+)?[+][0-9a-zA-Z.]+$ ]]; then
+            echo "::error::cloud-custodian-prerelease must ship a stamped prerelease version (…aN+HASH or …aN.postM+HASH); got '$version'"
             exit 1
</file context>
Fix with cubic

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid, but not fixing on the release branch will fix on mainline (stacklet/intergration)

@tvansteenburgh tvansteenburgh left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @jtroup

@jtroup
jtroup merged commit fc8d0ac into release/2026-08-26 Sep 4, 2026
4 checks passed
@jtroup
jtroup deleted the elmo/polite-drum branch September 4, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants