Closed
Description
Describe the bug
I am trying to accomplish something similar to #2171. The recommended solution is to use a ServerBaseUrlCustomizer to customize the URL based on the request. In OpenAPIService.setServerBaseUrl, the customized base URL is stored in a member variable of the service with no locking or other protections which is not thread safe.
To Reproduce
- Create a very basic Spring boot application
- Run in debug
- Set breakpoint 1 on the last line of OpenAPIService.setServerBaseUrl:
this.serverBaseUrl = customServerBaseUrl
- Set breakpoint 2 on the first line inside the if statement in OpenAPIService.updateServers
- Open http://localhost:8080/swagger-ui/index.html
- Advance to the 2nd breakpoint (in updateServers)
- Open http://127.0.0.1:8080/swagger-ui/index.html
- Step over the 1st breakpoin (last line in setServerBaseUrl)
- Unpause the first request and see that the returned server list contains http://127.0.0.1:8080 instead of http://localhost:8080
Expected behavior
The server base URL is not modified by unrelated requests
Metadata
Metadata
Assignees
Labels
No labels