Fix wildcard cookie domain for multi-label public suffixes (2.4.1)#16
Merged
Conversation
The previous slice(-2) heuristic in detectWildcardAndRoot truncated domains with multi-label public suffixes (e.g. .org.uk, .co.uk, .com.au) to the suffix itself, which browsers reject - leaving the cookie host-only. Use the full domain captured after the wildcard so the integrator's wildcard placement defines the cookie scope. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes incorrect cookie domain derivation for wildcard domains when the registrable domain ends with a multi-label public suffix (e.g. .co.uk, .org.uk, .com.au), ensuring cookies are scoped to the intended subdomain instead of being rejected by browsers.
Changes:
- Update
detectWildcardAndRootto use the full domain captured after the wildcard (instead of a “last two labels” heuristic). - Bump package version to
2.4.1. - Regenerate
dist/bundles to reflect the source change and version bump.
Reviewed changes
Copilot reviewed 2 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/gatekeeper/gatekeeper.ts | Fix wildcard cookie root domain calculation to avoid truncation on multi-label public suffixes. |
| package.json | Version bump to 2.4.1. |
| package-lock.json | Lockfile version bump alignment to 2.4.1. |
| dist/gatekeeper/gatekeeper.js | Built output reflecting updated wildcard cookie domain logic. |
| dist/crowdhandler.umd.min.js | Built/minified bundle version bump + updated wildcard cookie domain logic. |
| dist/crowdhandler.umd.js | Built UMD bundle version bump + updated wildcard cookie domain logic. |
| dist/crowdhandler.esm.js | Built ESM bundle version bump + updated wildcard cookie domain logic. |
| dist/crowdhandler.cjs.js | Built CJS bundle version bump + updated wildcard cookie domain logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 previous slice(-2) heuristic in detectWildcardAndRoot truncated domains with multi-label public suffixes (e.g. .org.uk, .co.uk, .com.au) to the suffix itself, which browsers reject - leaving the cookie host-only. Use the full domain captured after the wildcard so the integrator's wildcard placement defines the cookie scope.