Skip to content

Check redirectTo and the collection value in the cookie selector - #114

Merged
harmony7 merged 1 commit into
mainfrom
fix/cookie-selector-redirect
Oct 22, 2026
Merged

harmony7 merged 1 commit into
mainfrom
fix/cookie-selector-redirect

Conversation

@harmony7

@harmony7 harmony7 commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

collectionSelector.fromCookie() now checks two query parameters on the activate and reset paths:

  • redirectTo must be a path on the same site: it starts with one /, and it resolves to the same origin. Any other value redirects to /.
  • On the activate path, collection must have only characters that a cookie value can have (RFC 6265). Any other value gets a 400 response, and no cookie is set.

Only apps that use the cookie selector see a change. The scaffolded app does not use it. The same change for v7 is in #115.

Tests: new unit tests in test/unit/cookie-selector.test.js.

🤖 Generated with Claude Code

@harmony7
harmony7 requested review from a team and kailan and removed request for a team October 21, 2026 03:11
@harmony7
harmony7 force-pushed the fix/cookie-selector-redirect branch from 76dc93f to ab01879 Compare October 21, 2026 03:14
CookieCollectionSelector now accepts only a path on the same site for
redirectTo, on the activate and reset paths. Any other value redirects
to /. The activate path also refuses a collection value with characters
that a cookie value cannot have, and sets no cookie.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@harmony7
harmony7 force-pushed the fix/cookie-selector-redirect branch from ab01879 to 8fc1224 Compare October 22, 2026 00:11
@harmony7
harmony7 merged commit 43eda64 into main Oct 22, 2026
5 checks passed
@harmony7
harmony7 deleted the fix/cookie-selector-redirect branch October 22, 2026 00:12
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