Conversation
|
@TJothiprakash is attempting to deploy a commit to the kmkoushik's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
WalkthroughThe domain field validation in the waitlist submission schema was enhanced by adding a regex pattern check. The existing constraints (required error, trim, min length of 1, max length of 255) remain unchanged. The new regex validation enforces a domain-like format by preventing protocols (such as 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 the current code and only fix it if needed.
Inline comments:
In `@apps/web/src/app/wait-list/schema.ts`:
- Around line 15-16: The current domain regex allows labels to start or end with
hyphens; update the label subpattern so each label must start and end with an
alphanumeric character. Replace the label token ([a-zA-Z0-9-]+) in the existing
regex with a pattern like [a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])? so the full
regex becomes
/^(?!:\/\/)([a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/ (keep the
existing negative lookahead and TLD check as-is).
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d5cde759-5d37-4d34-9f6d-d123c2f1013a
📒 Files selected for processing (1)
apps/web/src/app/wait-list/schema.ts
| /^(?!:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/, | ||
| "Please enter a valid domain (e.g. example.com)" |
There was a problem hiding this comment.
Regex still accepts invalid hyphenated labels
Line 15 currently allows invalid domains like -foo.com and foo-.com because each label is [a-zA-Z0-9-]+. Tighten each label so it cannot begin/end with -.
Proposed fix
- /^(?!:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,
+ /^(?!:\/\/)(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,📝 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.
| /^(?!:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/, | |
| "Please enter a valid domain (e.g. example.com)" | |
| /^(?!:\/\/)(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/, | |
| "Please enter a valid domain (e.g. example.com)" |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/web/src/app/wait-list/schema.ts` around lines 15 - 16, The current
domain regex allows labels to start or end with hyphens; update the label
subpattern so each label must start and end with an alphanumeric character.
Replace the label token ([a-zA-Z0-9-]+) in the existing regex with a pattern
like [a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])? so the full regex becomes
/^(?!:\/\/)([a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/ (keep the
existing negative lookahead and TLD check as-is).
Summary
This PR adds regex validation to the waitlist domain field to prevent invalid inputs such as
.com,https://test, ortest.Changes
domainfield inwaitlistSubmissionSchemaexample.com,company.co.in) are acceptedTesting
Tested locally using the waitlist form.
Invalid inputs (rejected):
.comhttps://testtestValid inputs (accepted):
example.comcompany.co.inRelated Issue
Fixes #307
Summary by cubic
Add strict domain validation to the waitlist form to block malformed inputs and only allow real domains (e.g., example.com). Existing required and length checks remain.
domaininwaitlistSubmissionSchemawith regex^(?!:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$..com,https://test,test; acceptsexample.com,company.co.in.Written for commit d2c2ff5. Summary will update on new commits.
Summary by CodeRabbit