Skip to content

Conversation

@tdgroot
Copy link
Member

@tdgroot tdgroot commented Jul 27, 2023

Description (*)

When accepting purge requests within a network, it's easier to just supply a CIDR range.

Related Pull Requests

None.

Fixed Issues (if relevant)

None.

Manual testing scenarios (*)

  1. Go to Advanced -> System -> Full Page Cache -> Varnish Configuration
  2. Configure a CIDR range like 172.16.0.1/24
  3. Value should be valid and saved

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Resolved issues:

  1. resolves [Issue] PageCache/AccessList: Add CIDR support #39953: PageCache/AccessList: Add CIDR support

@m2-assistant
Copy link

m2-assistant bot commented Jul 27, 2023

Hi @tdgroot. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.

Add the comment under your pull request to deploy test or vanilla Magento instance:
  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@tdgroot tdgroot force-pushed the page_cache_acl_cidr branch from 24526c2 to 1c7183c Compare July 27, 2023 15:10
@engcom-Hotel engcom-Hotel added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Aug 1, 2023
@engcom-Hotel
Copy link
Contributor

@magento run all tests

@engcom-Hotel
Copy link
Contributor

@magento create issue

@github-project-automation github-project-automation bot moved this to Pending Review in Pull Requests Dashboard May 30, 2025
@engcom-Hotel engcom-Hotel moved this from Pending Review to On Hold in Pull Requests Dashboard May 30, 2025
@engcom-Hotel engcom-Hotel added Triage: Need PO Confirmation Requirements should be clarified/approved/confirmed with Product Manager. Not ready for fix/delivery and removed Progress: on hold labels May 30, 2025
@engcom-Hotel
Copy link
Contributor

Hello @tdgroot,

Thanks for the contribution!

But as this is feature enhancement, we need a PO confirmation to proceed with this PR. We have started the process for the same. Meanwhile we are moving this PR On Hold.

Thanks

@engcom-Hotel
Copy link
Contributor

@magento run all tests

@engcom-Hotel
Copy link
Contributor

Hello @tdgroot,

We have received an approval for this PR for further evaluation. Hence moving it to appropriate bucket.

Thanks

@engcom-Hotel engcom-Hotel moved this from On Hold to Review in Progress in Pull Requests Dashboard Jun 3, 2025
Copy link
Contributor

@engcom-Hotel engcom-Hotel left a comment

Choose a reason for hiding this comment

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

Hello @tdgroot,

Thank you for your contribution to add CIDR notation support to PageCache access lists. This is a valuable enhancement that would allow for more flexible IP-based access control.

However, the PR currently only modifies the validation pattern without implementing the actual CIDR functionality. For full CIDR support, we need changes in:

  • The component that performs IP matching against the access list
  • A utility method to properly compare an IP against a CIDR range

Thanks

@@ -24,7 +24,7 @@ public function beforeSave()
parent::beforeSave();

$value = $this->getValue();
if (!is_string($value) || !preg_match('/^[\w\s\.\-\,\:]+$/', $value)) {
if (!is_string($value) || !preg_match('/^[\w\s\.\-\,\:(\/\d+)?]+$/', $value)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. The pattern places (\/\d+)? inside a character class ([...]), which means these are treated as individual characters rather than a sequence.
  2. The pattern remains overly permissive and would validate strings like "this is: a more / or less, valid string.... oh, lets add numbers 12345" which aren't valid IP addresses or CIDR notations

Copy link
Contributor

Choose a reason for hiding this comment

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

The extra CIDR validation regex should indeed be moved outside of the character class, so should become something like this: ^[\w\s\.\-\,\:]+(\/\d+)?$
Good remark!

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated. The suffix is now outside of the character class and the regex is now applied for each item in the CSV list. Instead of accepting any /\d+, it is now limited from 0-32.

@engcom-Hotel engcom-Hotel removed the Triage: Need PO Confirmation Requirements should be clarified/approved/confirmed with Product Manager. Not ready for fix/delivery label Jun 3, 2025
@engcom-Hotel engcom-Hotel moved this from Review in Progress to Changes Requested in Pull Requests Dashboard Jun 3, 2025
@hostep
Copy link
Contributor

hostep commented Jun 7, 2025

However, the PR currently only modifies the validation pattern without implementing the actual CIDR functionality. For full CIDR support, we need changes in:

The component that performs IP matching against the access list
A utility method to properly compare an IP against a CIDR range

That's not really true, the only place where we use this configuration value is over here:


Which is used to output the access list into the VCL file that Magento generates for Varnish.
Varnish already supports CIDR notation in ACL's, so there is no need for extra matching or parsing.

One thing that I'm not sure about, but maybe @tdgroot can clarify, is that the Varnish docs say to put the IP address in double quotes and the CIDR part outside of those quotes: https://varnish-cache.org/docs/trunk/users-guide/vcl-example-acls.html#acls
In this Magento code, the CIDR part would be included inside the double quotes. I have no idea if this will cause issues or will just work as expected?

@engcom-Charlie
Copy link
Contributor

@magento run all tests

@engcom-Charlie
Copy link
Contributor

@magento run all tests

@engcom-Charlie
Copy link
Contributor

@magento run all tests

@engcom-Charlie
Copy link
Contributor

@magento run all tests

@engcom-Charlie
Copy link
Contributor

@magento run Functional Tests B2B, Functional Tests EE

@engcom-Charlie
Copy link
Contributor

I have fixed all the static test failures, moving it to review again.

@engcom-Bravo
Copy link
Contributor

@magento run all tests

@engcom-Bravo
Copy link
Contributor

Hi @tdgroot,

Thanks for the collaboration & contribution!

✔️ QA Passed

Preconditions:

  • Install fresh Magento 2.4-develop

Manual testing scenarios

  • Go to Advanced -> System -> Full Page Cache -> Varnish Configuration
  • Configure a CIDR range like 172.16.0.1/24
  • Value should be valid and saved

Before: ✖️

Screenshot 2025-10-08 at 2 12 44 pm

After: ✔️

Configuration-Settings-Stores-Magento-Admin-10-08-2025_02_19_PM

Builds are failed. Hence, moving this PR to Extended Testing.

Thanks.

@engcom-Bravo engcom-Bravo moved this from Ready for Testing to Extended testing (optional) in Community Dashboard Oct 8, 2025
@engcom-Charlie
Copy link
Contributor

@magento run Functional Tests B2B, Functional Tests EE, Functional Tests CE, WebAPI Tests

@engcom-Charlie
Copy link
Contributor

engcom-Charlie commented Oct 9, 2025

Few Functional B2B, EE and CE failures in recent 2 builds are not consistent. They are neither part of this PR nor failing because of the PR changes, seems to be flaky. The consistent once are known issues hence moving it to Merge In Progress.

Functional B2B: Run 1:
https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/37809/b46792f8f79789f47d0f5252d4f44669/Functional/allure-report-b2b/index.html#categories
image

Run 2:
https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/37809/54f64a76950f197112a7a5be56ff0d4d/Functional/allure-report-b2b/index.html#categories/39d2dfa67879cc2330ab48837fcc9a69/552cf7be275f72ba/
image

Functional CE: Run 1:
https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/37809/280d82586ce776949380cc37509dd54b/Functional/allure-report-ce/index.html#categories/39d2dfa67879cc2330ab48837fcc9a69/503c1569de7685a8/
image

Run 2:
https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/37809/e5536f7d07e188433c76f75a1a4e9b05/Functional/allure-report-ce/index.html#categories/39d2dfa67879cc2330ab48837fcc9a69/a3314de085c9558c/
image

Functional EE: Run 1:
https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/37809/3e148d881a5ec2d65f14fd60123f41b0/Functional/allure-report-ee/index.html#categories
image

Run 2:
https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/37809/70cd03d4a607d8bdb79df6d03d333af6/Functional/allure-report-ee/index.html#categories/3418275ac42b7ca8566f7871b42bcde6/1c61058d681db22b/
image

Known Issues:

  • ACQE-8846:StorefrontGuestCreateOrderWithConfigurableProductCustomStockTest
  • ACQE-8852:StorefrontReviewAndPaymentPageWithSimpleProductCustomStockTest
  • ACQE-8845:StorefrontGuestCreateOrderWithBundleProductCustomStockTest
  • ACQE-8847:StorefrontGuestCreateOrderWithGroupedProductCustomStockTest
  • ACQE-8655:AdminRmaSettingsConfigurationTest

@engcom-Charlie engcom-Charlie moved this from Extended testing (optional) to Merge in Progress in Community Dashboard Oct 9, 2025
@magento-devops-reposync-svc magento-devops-reposync-svc merged commit b62122d into magento:2.4-develop Nov 4, 2025
1 check passed
@ct-prd-projects-boards-automation ct-prd-projects-boards-automation bot moved this from Merge in Progress to Recently Merged in Community Dashboard Nov 4, 2025
@tdgroot tdgroot deleted the page_cache_acl_cidr branch November 4, 2025 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Project: Community Picked PRs upvoted by the community

Projects

Status: Recently Merged

Development

Successfully merging this pull request may close these issues.

[Issue] PageCache/AccessList: Add CIDR support

8 participants