fix: add missing comma separator in stateful domains configuration#566
Closed
exileum wants to merge 1 commit intolaravel:4.xfrom
exileum:4.x
Closed
fix: add missing comma separator in stateful domains configuration#566exileum wants to merge 1 commit intolaravel:4.xfrom exileum:4.x
exileum wants to merge 1 commit intolaravel:4.xfrom
exileum:4.x
Conversation
The sprintf call in config/sanctum.php was missing a comma separator between the base domain list and application URL, causing domains to merge incorrectly. This resulted in CORS failures and stateful authentication issues.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem
The default
statefuldomains configuration inconfig/sanctum.phpcontains a bug in thesprintfcall that concatenates the base domain list with the application URL without a proper comma separator. This causes domains to merge incorrectly, potentially breaking CORS and stateful authentication.Root Cause
In lines 18-23 of the default Sanctum configuration, the
sprintfformat string uses'%s%s'instead of'%s,%s':Impact
This results in malformed domain lists. For example:
localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1example.com:8080localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1,example.com:8080The missing comma causes:
::1) and the application URL to merge into a single invalid domainSolution
Add a comma in the
sprintfformat string:Testing
explode(',', ...)now correctly splits all domains including the application URLBreaking Changes
None. This is a bug fix that corrects existing behavior without changing the API or expected functionality.