Warn and fall back when cookieOptions.domain is a Public Suffix List entry#70
Warn and fall back when cookieOptions.domain is a Public Suffix List entry#70pepeladeira wants to merge 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR guards cookie domain configuration against browser Public Suffix List (PSL) limitations by introducing a ChangesPublic Suffix List Cookie Domain Guard
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/script/src/base.js`:
- Around line 44-47: The PSL membership check is case-sensitive so domains like
`.Vercel.App` bypass the warning; normalize the configured domain before lookup
by lowercasing (and trimming the leading dot as already done) so the
`KNOWN_PSL_DOMAINS.includes(bare)` check is consistent—update how `bare` is
derived from `parsedOpts.domain` (used in the `if (parsedOpts.domain)` branch)
to produce a normalized lowercase domain prior to calling
`KNOWN_PSL_DOMAINS.includes`.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8b3c58ce-c9a8-47af-9a1f-92d0891d96b8
📒 Files selected for processing (3)
packages/script/src/base.jspackages/web/README.mdpackages/web/src/types.ts
| if (parsedOpts.domain) { | ||
| const bare = parsedOpts.domain.replace(/^\./, ''); | ||
| if (KNOWN_PSL_DOMAINS.includes(bare)) { | ||
| console.warn( |
There was a problem hiding this comment.
Normalize configured domain before PSL lookup.
Line 45 currently checks PSL membership case-sensitively, so values like .Vercel.App bypass the warning/fallback path. Normalize input first to keep behavior consistent.
Suggested patch
- if (parsedOpts.domain) {
- const bare = parsedOpts.domain.replace(/^\./, '');
+ if (parsedOpts.domain) {
+ const bare = parsedOpts.domain.trim().replace(/^\./, '').toLowerCase();
if (KNOWN_PSL_DOMAINS.includes(bare)) {
console.warn(📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (parsedOpts.domain) { | |
| const bare = parsedOpts.domain.replace(/^\./, ''); | |
| if (KNOWN_PSL_DOMAINS.includes(bare)) { | |
| console.warn( | |
| if (parsedOpts.domain) { | |
| const bare = parsedOpts.domain.trim().replace(/^\./, '').toLowerCase(); | |
| if (KNOWN_PSL_DOMAINS.includes(bare)) { | |
| console.warn( |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/script/src/base.js` around lines 44 - 47, The PSL membership check
is case-sensitive so domains like `.Vercel.App` bypass the warning; normalize
the configured domain before lookup by lowercasing (and trimming the leading dot
as already done) so the `KNOWN_PSL_DOMAINS.includes(bare)` check is
consistent—update how `bare` is derived from `parsedOpts.domain` (used in the
`if (parsedOpts.domain)` branch) to produce a normalized lowercase domain prior
to calling `KNOWN_PSL_DOMAINS.includes`.
Summary by CodeRabbit
Bug Fixes
Documentation