Skip to content

fix: tighten URL detection in email connector to avoid false positives#8747

Merged
charIeszhao merged 3 commits into
logto-io:masterfrom
aayushbaluni:fix/8589-email-url-detection
May 20, 2026
Merged

fix: tighten URL detection in email connector to avoid false positives#8747
charIeszhao merged 3 commits into
logto-io:masterfrom
aayushbaluni:fix/8589-email-url-detection

Conversation

@aayushbaluni

Copy link
Copy Markdown
Contributor

Problem

Email connector settings validation incorrectly rejects company information like "Company p.s.a." as a URL, preventing valid configuration.

Change

Tighten the URL detection pattern to require explicit URL schemes or sufficient structural evidence, avoiding false positives on dotted abbreviations.

Fixes #8589.

Made with Cursor

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown

COMPARE TO master

Total Size Diff 📈 +2.48 KB

Diff by File
Name Diff
.changeset/nervous-bats-bow.md 📈 +97 Bytes
packages/toolkit/connector-kit/src/types/passwordless.test.ts 📈 +2.19 KB
packages/toolkit/connector-kit/src/types/passwordless.ts 📈 +199 Bytes

@charIeszhao charIeszhao requested review from Copilot and removed request for darcyYe May 6, 2026 11:11

Copilot AI left a comment

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.

Pull request overview

This PR adjusts URL detection used by the connector-kit email branding validators to avoid incorrectly flagging dotted abbreviations (e.g. p.s.a.) as URLs, and adds regression tests for the reported configuration failure (issue #8589).

Changes:

  • Tightened urlRegEx to only match http(s):// URLs or www.-prefixed hostnames.
  • Added Vitest coverage to ensure dotted abbreviations aren’t treated as URLs and the branding guard accepts the reported Polish company info.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/toolkit/connector-kit/src/types/passwordless.ts Narrows URL-detection regex used by emailServiceBrandingGuard to avoid false positives on dotted abbreviations.
packages/toolkit/connector-kit/src/types/passwordless.test.ts Adds tests covering the new URL detection behavior and a regression case for companyInformation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/toolkit/connector-kit/src/types/passwordless.ts Outdated
@simeng-li simeng-li added the pending-verification Something is still under investigation label May 14, 2026
@charIeszhao charIeszhao force-pushed the fix/8589-email-url-detection branch from bc78ae9 to c234a54 Compare May 18, 2026 10:58
@github-actions github-actions Bot added size/s and removed size/s labels May 18, 2026
@charIeszhao charIeszhao force-pushed the fix/8589-email-url-detection branch from c234a54 to 4eaa26e Compare May 18, 2026 11:09
@github-actions github-actions Bot added size/s and removed size/s labels May 18, 2026
@charIeszhao charIeszhao review requested due to automatic review settings May 19, 2026 03:33
@simeng-li simeng-li requested a review from Copilot May 19, 2026 03:55

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread packages/toolkit/connector-kit/src/types/passwordless.ts Outdated

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@charIeszhao charIeszhao merged commit 41a56f7 into logto-io:master May 20, 2026
33 checks passed
@charIeszhao

Copy link
Copy Markdown
Member

@aayushbaluni Thank you for your PR. We've made some modifications to your original commit and it's now merged to master.
The fix will be available soon in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix pending-verification Something is still under investigation size/s

Development

Successfully merging this pull request may close these issues.

bug: when adding company information to email connector, some strings are recognized as URLs

5 participants