Skip to content

Fix/domain regex validation#384

Open
TJothiprakash wants to merge 2 commits intousesend:mainfrom
TJothiprakash:fix/domain-regex-validation
Open

Fix/domain regex validation#384
TJothiprakash wants to merge 2 commits intousesend:mainfrom
TJothiprakash:fix/domain-regex-validation

Conversation

@TJothiprakash
Copy link
Copy Markdown

@TJothiprakash TJothiprakash commented Mar 29, 2026

Summary

This PR adds regex validation to the waitlist domain field to prevent invalid inputs such as .com, https://test, or test.

Changes

  • Added regex validation to the domain field in waitlistSubmissionSchema
  • Ensures only valid domain formats (e.g., example.com, company.co.in) are accepted
  • Preserves existing length and required validations

Testing

Tested locally using the waitlist form.

Invalid inputs (rejected):

  • .com
  • https://test
  • test

Valid inputs (accepted):

  • example.com
  • company.co.in

Related 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.

  • Bug Fixes
    • Validate domain in waitlistSubmissionSchema with regex ^(?!:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$.
    • Rejects .com, https://test, test; accepts example.com, company.co.in.
    • Shows a clear error: "Please enter a valid domain (e.g. example.com)".

Written for commit d2c2ff5. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced domain field validation in the waitlist submission form to enforce proper domain formatting and reject invalid formats.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

@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.

Copy link
Copy Markdown

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 29, 2026

Walkthrough

The 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 ://), requiring dot-separated labels, and mandating a top-level domain of at least 2 characters. This change addresses cases where invalid inputs like .com, https://test, or bare text without proper domain structure were previously accepted.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix/domain regex validation' directly describes the main change: adding regex validation to the domain field in the waitlist schema.
Linked Issues check ✅ Passed The PR successfully implements the regex validation requirement from issue #307 to prevent invalid domain inputs like '.com', 'https://test', and 'test' while accepting valid formats like 'example.com'.
Out of Scope Changes check ✅ Passed The PR is focused solely on adding regex validation to the domain field as required. The commit mentions reverting an unintended marketing page change, indicating proper scope management.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between bd78ed9 and d2c2ff5.

📒 Files selected for processing (1)
  • apps/web/src/app/wait-list/schema.ts

Comment on lines +15 to +16
/^(?!:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,
"Please enter a valid domain (e.g. example.com)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Suggested change
/^(?!:\/\/)([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).

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.

🐞 - Adding domain regex to waitlist form

1 participant