fix(authentication-oauth): allow any port on loopback OAuth origins - #3699
Merged
Conversation
Exact origin matching from the 5.0.40 security fix rejected common local dev setups where the frontend runs on a different port than the configured origin (e.g. http://localhost vs http://localhost:5173). For localhost, 127.0.0.1, and ::1 only, match on scheme + host and ignore port, then redirect using the referer origin so the token returns to the correct local port. Non-loopback hosts still require an exact origin match. Closes #3684
…in errors Include 0.0.0.0 in the loopback port-flex allowlist used for local OAuth redirects. When a referer is rejected, report the normalized origin, configured allowlist, and a short hint about ports and loopback matching.
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.
Summary
http://localhostvshttp://localhost:5173).localhost,127.0.0.1,::1,0.0.0.0), match on scheme + host and ignore port.URL(trailing slash / default port / path on the config string no longer break matching).NotAuthenticatederrors: report the normalized referer origin, list configured origins, and hint about ports and loopback matching.Closes #3684
Test plan
npm test --workspace @feathersjs/authentication-oauth(34 passing)localhost,127.0.0.1,::1,0.0.0.0localhost≠127.0.0.1