Fix WordPress exclusion regex bypassing WooCommerce checkout URLs#18
Merged
Merged
Conversation
The wc_order query parameter on checkout order-received pages was matching the WordPress exclusion regex, causing the worker to skip CrowdHandler entirely for checkout confirmation pages. Added (?!order) negative lookahead so wc_order_* keys no longer trigger the bypass while all other wp-*/wc-* exclusions still work. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the WordPress URL/query exclusion logic used by the Cloudflare Worker so WooCommerce “order-received” / checkout confirmation traffic isn’t accidentally bypassing CrowdHandler due to wc_order* query args matching the WordPress exclusion regex.
Changes:
- Updated the
wordpressExclusionsregex to add anordernegative lookahead afterwp-*/wc-*style prefixes. - Regenerated the built
dist/artifacts to include the updated regex.
Reviewed changes
Copilot reviewed 1 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| helpers/misc.js | Adjusts the WordPress exclusion regex intended to stop wc_order* from triggering bypass. |
| dist/index.js | Compiled worker output reflecting the updated exclusion regex. |
| dist/index.js.map | Updated source map reflecting rebuilt output. |
| dist/README.md | Updates the build timestamp for the generated dist/ assets. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| ], | ||
| //regex for matching wordpress urls and query strings | ||
| wordpressExclusions: /(w[cp][-_](?![-_]).*|xmlrpc\.php|readme\.html|license\.txt|trackback|feed(?:\/.*)?|comments\/feed(?:\/.*)?)(\?.*)?/, | ||
| wordpressExclusions: /(w[cp][-_](?![-_])(?!order).*|xmlrpc\.php|readme\.html|license\.txt|trackback|feed(?:\/.*)?|comments\/feed(?:\/.*)?)(\?.*)?/, |
(?!order) was too broad — would also prevent bypassing legitimate WooCommerce admin paths like wc-orders. Narrowing to (?!order_) targets only the wc_order_ key prefix used in checkout URLs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
The wc_order query parameter on checkout order-received pages was matching the WordPress exclusion regex, causing the worker to skip CrowdHandler entirely for checkout confirmation pages.
Added (?!order) negative lookahead so wc_order_* keys no longer trigger the bypass while all other wp-/wc- exclusions still work.