Skip to content

Fix wildcard cookie domain for multi-label public suffixes (2.4.1)#16

Merged
luke-owen-crowdhandler merged 1 commit into
mainfrom
feature/cookie-scoping
May 1, 2026
Merged

Fix wildcard cookie domain for multi-label public suffixes (2.4.1)#16
luke-owen-crowdhandler merged 1 commit into
mainfrom
feature/cookie-scoping

Conversation

@luke-owen-crowdhandler
Copy link
Copy Markdown
Contributor

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.

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>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 detectWildcardAndRoot to 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.

@luke-owen-crowdhandler luke-owen-crowdhandler merged commit 23dba31 into main May 1, 2026
4 checks passed
@luke-owen-crowdhandler luke-owen-crowdhandler deleted the feature/cookie-scoping branch May 1, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants