WMS OpenLayers output: escape angle brackets in mapserv_onlineresource#7544
Open
MarkLee131 wants to merge 1 commit into
Open
WMS OpenLayers output: escape angle brackets in mapserv_onlineresource#7544MarkLee131 wants to merge 1 commit into
MarkLee131 wants to merge 1 commit into
Conversation
The GHSA-xqj6-vjqr-33vv fix only escaped the JS quote, so a literal </script> in a forwarded host/proto header still closed the <script> block. Encode the angle brackets as their JavaScript unicode escapes so the value stays a JS string and cannot break out of the element. Add a msautotest case (wxs/wms_openlayers_xss) and make the [ENV ...] test directive repeatable so it can set the request headers it needs.
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.
GHSA-52rr-p4x5-2x6x:
The OpenLayers GetMap page (FORMAT=application/openlayers) inlines mapserv_onlineresource into a single-quoted JS string inside a <script> element. The fix for GHSA-xqj6-vjqr-33vv (edc1033) escaped only the JS single-quote, so a literal </script> in a request-controlled value (e.g. X-Forwarded-Host) still closes the script element at the HTML-parsing layer.
This encodes < and > as \u003c / \u003e after the existing JSON-string escaping, so the value cannot break out of the script block.
Adds an msautotest case (wxs/wms_openlayers_xss.map) that drives the OpenLayers output with a </script>-bearing X-Forwarded-Host and asserts the brackets come out encoded. Also extends mstestlib.py so a test can set multiple [ENV ...] variables.