[PR #6904] [MERGED] fix: correct wildcard pattern matching for trustedOrigins #23858

Closed
opened 2026-04-15 22:01:33 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6904
Author: @bytaesu
Created: 12/20/2025
Status: Merged
Merged: 12/23/2025
Merged by: @himself65

Base: canaryHead: 2025-12-20/fix/wildcard-pattern


📝 Commits (5)

  • c0993a2 fix: update mathcesOriginPattern for supporting '?' wildcard
  • 5b6c9e9 docs: explain the wildcard behavior clearly
  • 07849cc docs: update trusted origins section
  • ecd417a docs: update custom schemes wildcard example
  • 6e9dbd9 simpler explanation

📊 Changes

4 files changed (+35 additions, -10 deletions)

View changed files

📝 docs/content/docs/integrations/expo.mdx (+5 -5)
📝 docs/content/docs/reference/options.mdx (+25 -2)
📝 docs/content/docs/reference/security.mdx (+2 -2)
📝 packages/better-auth/src/auth/trusted-origins.ts (+3 -1)

📄 Description

This PR updates the following:

  • Adds support for the already implemented "?" wildcard in matchesOriginPattern().
  • Adds a section in the docs reference explaining wildcard behavior.
  • Updates wildcard-based trustedOrigins examples in the docs.

Summary by cubic

Fixes trustedOrigins wildcard matching to include the “?” wildcard and clarifies how patterns work. Updates docs and examples (especially custom schemes like exp://) to reflect the correct behavior.

  • Bug Fixes
    • matchesOriginPattern now supports “?” alongside “*” and “**”; protocol patterns match the full origin.
    • Docs: added Pattern Syntax and examples; updated trustedOrigins examples to use exp://** and exp://192.168..:*/**; linked Expo guide to the reference.

Written for commit 6e9dbd95f0. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/6904 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 12/20/2025 **Status:** ✅ Merged **Merged:** 12/23/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `2025-12-20/fix/wildcard-pattern` --- ### 📝 Commits (5) - [`c0993a2`](https://github.com/better-auth/better-auth/commit/c0993a214c5ec416d6c742afcbb8b900f2408147) fix: update mathcesOriginPattern for supporting '?' wildcard - [`5b6c9e9`](https://github.com/better-auth/better-auth/commit/5b6c9e9556d24c7c4189105aed8247ae5787a303) docs: explain the wildcard behavior clearly - [`07849cc`](https://github.com/better-auth/better-auth/commit/07849cc071a9758a6f461b610b246677d767bdc7) docs: update trusted origins section - [`ecd417a`](https://github.com/better-auth/better-auth/commit/ecd417a5bd65e844bf1e4436ce10e3119a53e69b) docs: update custom schemes wildcard example - [`6e9dbd9`](https://github.com/better-auth/better-auth/commit/6e9dbd95f0c159a69f238a2bb9246941a87e8cba) simpler explanation ### 📊 Changes **4 files changed** (+35 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/integrations/expo.mdx` (+5 -5) 📝 `docs/content/docs/reference/options.mdx` (+25 -2) 📝 `docs/content/docs/reference/security.mdx` (+2 -2) 📝 `packages/better-auth/src/auth/trusted-origins.ts` (+3 -1) </details> ### 📄 Description This PR updates the following: - Adds support for the already implemented "?" wildcard in `matchesOriginPattern()`. - Adds a section in the docs reference explaining wildcard behavior. - Updates wildcard-based trustedOrigins examples in the docs. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes trustedOrigins wildcard matching to include the “?” wildcard and clarifies how patterns work. Updates docs and examples (especially custom schemes like exp://) to reflect the correct behavior. - **Bug Fixes** - matchesOriginPattern now supports “?” alongside “*” and “**”; protocol patterns match the full origin. - Docs: added Pattern Syntax and examples; updated trustedOrigins examples to use exp://** and exp://192.168.*.*:*/**; linked Expo guide to the reference. <sup>Written for commit 6e9dbd95f0c159a69f238a2bb9246941a87e8cba. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 22:01:33 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#23858