[PR #5624] fix: urls without protocol shouldn't be able to satisfy a wildcard origin #14368

Closed
opened 2026-04-13 09:26:27 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/5624

State: closed
Merged: Yes


Summary by cubic

Hardened origin validation so URLs without a protocol can’t satisfy wildcard trusted origins, preventing malicious callback URL bypasses. Updated docs and tests, plus a small safety tweak to the user table.

  • Bug Fixes
    • Reject callback URLs without protocol for wildcard trustedOrigins; getHost returns null on parse errors and origin check fails safely.
    • Added test to block “malicious.com?.example.com” when trustedOrigins includes "*.example.com".
    • Docs: removed protocol-less wildcard example and added a warning to use a protocol (e.g., https://*.example.com).
    • DB: set user.emailVerified to input: false to prevent client-provided values.
**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5624 **State:** closed **Merged:** Yes --- <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Hardened origin validation so URLs without a protocol can’t satisfy wildcard trusted origins, preventing malicious callback URL bypasses. Updated docs and tests, plus a small safety tweak to the user table. - **Bug Fixes** - Reject callback URLs without protocol for wildcard trustedOrigins; getHost returns null on parse errors and origin check fails safely. - Added test to block “malicious.com?.example.com” when trustedOrigins includes "*.example.com". - Docs: removed protocol-less wildcard example and added a warning to use a protocol (e.g., https://*.example.com). - DB: set user.emailVerified to input: false to prevent client-provided values. <!-- End of auto-generated description by cubic. -->
GiteaMirror added the pull-request label 2026-04-13 09:26:27 -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#14368