Repository navigation
feat(edge-security): client rules can name Cloud Armor address groups - #493
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
[Medium impact] The PR appears safe to merge; no blocking issues were found.
|
879399e to
eb7c1ce
Compare
eb7c1ce to
fe829d6
Compare
|
Status of the live proof for this PR: there will not be one from our side. The proof project stays on the Cloud Armor Standard tier (the decision was not to enrol it in Enterprise), so the address-group path remains tested by rendering only, as the description says. What that leaves unverified against Google's API: |
|
Live status: the address-group path ( |
…to an address group Review feedback on #493: replacing cidrs with address_groups, as the guide said, would drop the organisation's own ranges from the vendor rule and block its users on those paths. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
fe829d6 to
3c371f0
Compare
…to an address group Review feedback on #493: replacing cidrs with address_groups, as the guide said, would drop the organisation's own ranges from the vendor rule and block its users on those paths. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
3c371f0 to
2062737
Compare
One Cloud Armor policy holds at most 20 rules with an expression, so a
vendor's long published list (about 290 ranges) cannot be written as CIDRs in
client_ip_rules. An address group (Cloud Armor Enterprise) is one
subexpression whatever it holds.
- client_ip_rules[*].address_groups: names of existing project-scoped address
groups. Each becomes evaluateAddressGroup('<name>', origin.user_ip) in the
rule, ahead of any inline cidrs; a rule needs at least one of the two.
A vendor list then costs one admitting rule and one deny.
- The module does not create the group: the google provider below 8.0, which
the repository pins, has no purpose field on
google_network_security_address_group, and a Cloud Armor group needs purpose
CLOUD_ARMOR. README and guide give the gcloud commands, the Enterprise
enrollment command, and how to update a group when the vendor's list changes.
Rendering tests only; not yet applied to a project enrolled in Cloud Armor
Enterprise.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…to an address group Review feedback on #493: replacing cidrs with address_groups, as the guide said, would drop the organisation's own ranges from the vendor rule and block its users on those paths. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2062737 to
26f0058
Compare
Why
The live proof showed that one Cloud Armor policy holds at most 20 rules with an expression, and Google does not raise that limit (#487 makes the module refuse such a plan). A vendor's long published list, about 290 ranges, therefore cannot be written as CIDRs in
client_ip_rules: it needs about 37 rules, and an exact merge of adjacent ranges only brings 289 down to 278.A Cloud Armor address group is one subexpression in a rule whatever it holds, so the whole list costs one admitting rule and one deny.
What changes
client_ip_rules[*].address_groups: names of existing project-scoped address groups. Each becomesevaluateAddressGroup('<name>', origin.user_ip)in the rule, ahead of any inlinecidrs. A rule needs at least one ofcidrsoraddress_groups;cidrsis now optional.rule_countsreflects it: the vendor rule in the test costs 2 advanced rules.docs/gcp-install/3-EDGE-HARDENING.md: the Enterprise enrollment command, thegcloudcommands to create and fill a group, and how to update it when the vendor's list changes (no Terraform apply).Why the module does not create the group
A Cloud Armor address group needs
purpose = ["CLOUD_ARMOR"].google_network_security_address_grouponly has that field from provider 8.x; this repository pins>= 7.0, < 8.0, and 7.46.2 rejects it (An argument named "purpose" is not expected here). Moving the repository to provider 8 is a separate decision. Until then the group is created withgcloud, which also suits how it is used: a vendor's list changes without the policy changing.What it costs and requires
Address groups need the project enrolled in Cloud Armor Enterprise, which is billed and can take up to an hour to activate. The docs say so before the commands. Nothing in this PR enrolls anything.
Tests
terraform test(mock provider), 33 runs: the exact expression with two groups and an inline range; a group-only rule; a rule with no clients refused; a full path instead of a name refused; with 10 subexpressions and the 20-rule limit, vendors by address group plus a closing staff rule need 7 advanced rules. Local:terraform fmt/validate/test, tflint, terraform-docs and checkov pass. No chart change.Not proven
Rendering only. Not yet applied to a project enrolled in Cloud Armor Enterprise: that
evaluateAddressGroupaccepts the short name withorigin.user_ipin a backend policy rule (it is the form in Google's documentation), and the exactgcloud network-security address-groupsflags. The proof project is on the Standard tier today.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.