Skip to content

fix(connector): treat aliyun hk sms numbers as overseas#9111

Open
sjh9714 wants to merge 1 commit into
logto-io:masterfrom
sjh9714:sjh9714-fix-aliyun-hk-phone-detection
Open

fix(connector): treat aliyun hk sms numbers as overseas#9111
sjh9714 wants to merge 1 commit into
logto-io:masterfrom
sjh9714:sjh9714-fix-aliyun-hk-phone-detection

Conversation

@sjh9714

@sjh9714 sjh9714 commented Jun 29, 2026

Copy link
Copy Markdown

Summary

Fixes #5889.

The Aliyun SMS connector treated any bare 11-digit phone number as a mainland China number in non-strict mode. This keeps backward-compatible bare mainland mobile numbers (1 + 10 digits), while routing Hong Kong numbers such as 85268326366 to the overseas template.

Changes

  • Narrowed Aliyun China-number detection to mainland mobile number shape with optional China region code.
  • Added helper and connector-level coverage for the reported Hong Kong number.
  • Added a connector patch changeset.

Testing

Unit tests

  • corepack pnpm@10.33.4 --dir packages/connectors/connector-aliyun-sms test

Verification

  • corepack pnpm@10.33.4 install --frozen-lockfile
  • pnpm prepack
  • corepack pnpm@10.33.4 --dir packages/connectors/connector-aliyun-sms lint
  • corepack pnpm@10.33.4 --dir packages/connectors/connector-aliyun-sms check

Copilot AI review requested due to automatic review settings June 29, 2026 15:27
@github-actions

Copy link
Copy Markdown

COMPARE TO master

Total Size Diff 📈 +807 Bytes

Diff by File
Name Diff
.changeset/fix-aliyun-hk-phone.md 📈 +116 Bytes
packages/connectors/connector-aliyun-sms/src/index.test.ts 📈 +338 Bytes
packages/connectors/connector-aliyun-sms/src/utils.test.ts 📈 +154 Bytes
packages/connectors/connector-aliyun-sms/src/utils.ts 📈 +199 Bytes

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 pull request fixes Aliyun SMS connector region detection so that bare 11-digit phone numbers are no longer universally treated as mainland China, preventing Hong Kong numbers like 85268326366 from being incorrectly routed to the China template.

Changes:

  • Refined China-number detection to match mainland mobile number shape (1 + 10 digits) with optional China region code (+86/86/0086).
  • Added unit coverage for the reported Hong Kong number at both helper-level (isChinaNumber) and connector-level (template selection).
  • Added a patch changeset for @logto/connector-aliyun-sms.

Reviewed changes

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

File Description
packages/connectors/connector-aliyun-sms/src/utils.ts Tightens China phone number regex logic to mainland mobile-number shape with optional/required region code based on strictness.
packages/connectors/connector-aliyun-sms/src/utils.test.ts Adds test coverage ensuring Hong Kong number 85268326366 is not considered China in both strict and non-strict modes.
packages/connectors/connector-aliyun-sms/src/index.test.ts Verifies connector uses the overseas template code for 85268326366.
.changeset/fix-aliyun-hk-phone.md Publishes the fix as a patch changeset for the Aliyun SMS connector package.

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

@simeng-li

Copy link
Copy Markdown
Contributor

@sjh9714 please check the failed integration tests

@sjh9714

sjh9714 commented Jul 1, 2026

Copy link
Copy Markdown
Author

I checked the failed integration jobs. The failures appear outside this connector change:\n\n- run-logto (experience, false) failed in WebAuthn/passkey MFA navigation: one timeout and one URL assertion around /mfa-binding/WebAuthn vs /create-passkey.\n- run-logto (experience, true) failed in a password-policy alert assertion and another MFA/passkey navigation timeout.\n\nThe Aliyun SMS connector unit/build/lint checks and Codecov checks are passing, and the failed tests don't touch the changed connector files. I also tried rerunning the failed workflow, but GitHub rejected it because I don't have admin rights to this repository.

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

Development

Successfully merging this pull request may close these issues.

bug: Aliyun SMS Connector incorrectly identifies a Hong Kong mobile phone number as a mainland Chinese mobile phone number

5 participants