Render image icons in the marker type menu and escape icon markup - #1827
Merged
Merged
Conversation
The Markers Overview type menu wrote each config icon as plain text, so a type whose icon is an image URL listed the URL instead of a picture, and the selector button did the same after a pick. Marker and regiment icons come straight from the map file and were spliced into innerHTML unescaped at ten sites. Add isImageIcon, use it wherever an icon is tested for being an image, escape the icon at every interpolation, and tighten the Icon Selector's URL check to the same http(s)/data:image prefixes. Thumbnails in the selector now show their own image in the tooltip and set their background via the style property.
✅ Deploy Preview for afmg ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Problem
innerHTMLunescaped at ten sites (marker editor, overview rows, markers-in-radius, generation settings, marker renderer, regiment editor, regiments overview, battle screen). A crafted.mapwith an icon such as"><img src=x onerror=…>executes as soon as the marker editor opens.Fix
<img>for URL icons, matching the overview rows.isImageIconinfileUtils.ts, requiring anhttp://,https://ordata:image/prefix. It replaces the 18 inlinestartsWith("http") || startsWith("data:image")checks and the selector's half-anchored URL regex.escapeHtml, on both the image and the glyph branch.backgroundImageproperty with quotes escaped instead ofcssText.Verification
tsc --noEmitclean, Biome clean, 944 unit tests pass (newisImageIconcases included).data:image; a thumbnail hover puts the image in the tooltip.onerrornever fired.