Repository navigation
fix: accept the wildcard CORS origin when credentials are allowed - #286
Merged
Merged
Conversation
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
HuiJun
approved these changes
Nov 15, 2026
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
With the shipped default
cors.allowed.origins=*, every request carrying anOriginheader answered HTTP 500, so a browser client such as View Editor could not log in.corsFilter()inExampleSecurityConfigsetsallowCredentials(true)and added each configured entry withaddAllowedOrigin; Spring rejects*in that combination (IllegalArgumentException: When allowCredentials is true, allowedOrigins cannot contain the special value "*").The
*entry is now registered as an origin pattern; every other entry is registered as before:Behaviour and trade-off
cors.allowed.origins=*: MMS echoes the caller's origin inAccess-Control-Allow-Origintogether withAccess-Control-Allow-Credentials: true. Any website may therefore make credentialed cross-origin requests to MMS. MMS is stateless and takes its token in theAuthorizationheader, so the ambient credential a foreign site could ride on is HTTP Basic credentials the browser has cached for the MMS origin; a deployment that adds cookie-based authentication in front of MMS is more exposed.Both
application.properties.exampleandapplication-test.propertiesnow say this next to the property.Verification
Compose stack (
SPRING_PROFILES_ACTIVE=test), real requests withcurl, before (develop) and after:*, before*, afterhttp://localhost:9001, before and afterOPTIONS /authentication(Origin: http://localhost:9001, request headercontent-type)Allow-Origin: http://localhost:9001,Allow-Credentials: truePOST /authenticationOPTIONS /projects(request headerauthorization)GET /projectswith the bearer tokenOrigin: http://evil.exampleNot tested: a browser session with View Editor against this build, and the Spring Boot 3 branch (#284). A trial merge of this branch with
chore/spring-boot-3-migrationis clean;addAllowedOriginPatternexists in Spring Web 6 as well.Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/c1ca43096c8046d6adec7631ee635d99
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/c1ca43096c8046d6adec7631ee635d99?variant=devin
Requested by: @HuiJun
🟢 Devin Review found nothing to fix · View findings · Follow Devin's work