Skip to content

wafv2: the plugin hardcodes the regional scope segment where CloudFormation derives it, so one web ACL reports two ARNs #858

Closed

Description

@scttfrdmn

v0.114.0's #827 work fixed CloudFormation's WAFv2 web-ACL ARN to derive its scope segment from the Scope property (cfn_resources_v32.go:71, strings.ToLower(scope)). The WAFv2 plugin was not touched, and it hardcodes regional:

  • emulator/wafv2_plugin.go:132 — createWebACL
  • emulator/wafv2_plugin.go:448 — createIPSet

Those two plus the CloudFormation site are the only arn:aws:wafv2 literals in non-test code. So:

  1. The same logical web ACL reports two different ARNs depending on whether CloudFormation or the WAFv2 API created it.
  2. A CLOUDFRONT web ACL or IP set created through the API still reports an ARN naming a scope it does not have — the exact defect cfn: Ref returns the physical ID for every type, but AWS returns an ARN for an ELBv2 load balancer and target group #827 fixed on the other path.

An IP-set ARN is what a caller hands to IPSetReferenceStatement, and a web-ACL ARN is what AssociateWebACL takes, so a wrong scope segment is not cosmetic: it is an identifier another operation is expected to accept.

Fix

One builder, wafv2ARN(region, accountID, scope, resourceType, name, id), used by all three sites — the "one builder, so they cannot drift" structure #826 established for SQS state keys. Two implementations of an ARN are two answers, which is how this diverged in the first place.

Recorded as unverifiable

Whether a CLOUDFRONT ARN's scope segment is cloudfront is not citable. Four sources:

  • The Service Authorization Reference page for WAFv2 returns an empty body.
  • AWS's machine-readable Service Reference gives only the unsubstituted placeholder arn:${Partition}:wafv2:${Region}:${Account}:${Scope}/<type>/${Name}/${Id}.
  • API_AssociateWebACL lists the eight protectable-resource ARN formats but no web-ACL ARN.
  • The CloudFormation Template Reference for AWS::WAFv2::WebACL gives the only substituted example AWS publishes anywhere — arn:aws:wafv2:us-east-1:ExampleAccountNumber:regional/webacl/exampleWebACL/exampleWebACLExampleID — and it is a REGIONAL ACL rendering regional, i.e. the lowercase of the Scope value.

That is consistent with strings.ToLower(scope) and is not proof for CLOUDFRONT. The value of the fix is that the three sites agree; which literal they agree on is stated in wafv2ARN's doc comment as substrate's reading, not AWS's.

Acceptance criteria

  • One function builds every arn:aws:wafv2 in non-test code.
  • A web ACL created through CreateWebACL with Scope: CLOUDFRONT reports a cloudfront scope segment, not regional.
  • A web ACL created through CloudFormation and one created through the API report the same ARN shape for the same scope.
  • CreateIPSet gets the same treatment.
  • The CLOUDFRONT segment is documented as substrate's reading with the four failed sources named.

Fixed in the same PR as #755, since both are in createIPSet.

Activity

  1. added this to the v0.115.0 milestone on Sep 14, 2026
  2. added
    type: bug
    on Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions