You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
per review, buildOpenApiUrl now returns a java.net.URI instead of a String, and the URI is passed through generateSwaggerUIHtml / generateSwaggerUIScript right up to the point it's embedded in the html, so the url is parsed and validated at construction rather than being a raw string. the original escapeJs approach and its test are dropped.
Hey,
thanks for looking into this, but I don't think this is valid. First of all, the operator of the axis instance chooses the server name, that is not in our threat model (since the administrator can obviously change the behavior of axis, it's kind of their job). Secondly, even if they wanted to deploy the server to a malicious host name, that would still have to be a valid host name in order for any of this to work, and you just can't put a script tag inside of a host name (see the relevant RFCs for details).
I'd agree though that it would look nicer (and be more obviously correct) if buildOpenApiUrl would return a URI instead of a String (and we would pass that around right until we embed it into the html). If you want to improve the clarity of the code in that way I'd be open to reviewing such an MR.
fair enough on the threat model. reworked it along the lines you suggested: buildOpenApiUrl now returns a java.net.URI that gets passed around until it's embedded in the html, so the url is parsed and validated at construction instead of being a raw string. dropped escapeJs and its test, and updated the title/body to match. mvn -pl modules/openapi test passes.
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
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.
per review,
buildOpenApiUrlnow returns ajava.net.URIinstead of aString, and theURIis passed throughgenerateSwaggerUIHtml/generateSwaggerUIScriptright up to the point it's embedded in the html, so the url is parsed and validated at construction rather than being a raw string. the originalescapeJsapproach and its test are dropped.