Skip to content

fix(auth): only accept http(s) appBaseUrl for auth redirects - #376

Open
theunreal wants to merge 1 commit into
mainfrom
fix/validate-app-base-url
Open

theunreal wants to merge 1 commit into
mainfrom
fix/validate-app-base-url

Conversation

@theunreal

Copy link
Copy Markdown
Collaborator

Summary

createClient now keeps appBaseUrl only when it parses to an http: or https: URL. Any other value becomes "", so login and logout URLs stay relative to the current origin.

appBaseUrl is used to build every auth navigation target (redirectToLogin, loginWithProvider, logout, loginViaPopup), so a non-http(s) value should never reach window.location. Valid values pass through unchanged.

  • New internal helper sanitizeAppBaseUrl in utils/auth-utils.ts. It is not added to the public exports.
  • One call site in client.ts. createAuthModule is only created there, so this covers every auth sink.

Testing

  • npm run lint: clean.
  • npm test: type tests clean, 457 unit tests pass.
  • The new test.each in client.test.js fails on the three non-http(s) cases without the fix and passes with it.

🤖 Generated with Claude Code

…te to javascript:

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/sdk@0.8.60-pr.376.c2b0448

Prefer not to change any import paths? Install using npm alias so your code still imports @base44/sdk:

npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.60-pr.376.c2b0448"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "@base44/sdk": "npm:@base44-preview/sdk@0.8.60-pr.376.c2b0448"
  }
}

Preview published to npm registry — try new features instantly!

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.

1 participant