New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GEOS-11152] Improve handling special characters in the Simple SVG Renderer #7173
Conversation
|
||
if (!styleName.startsWith("#")) { | ||
writer.write(" class=\"" + styleName + "\""); | ||
writer.write(" class=\"" + escapeXml10(styleName) + "\""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is SVGWriter.encodeAttribute as good as StringEscapeUtils
?
Also, groupId is basically the type name... why bother about the type name (admin configured) but not about the attribute names, in SVGWriter.startFeature
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SVGWriter.encodeAttribute doesn't exist. There is a AttributesSVGHandler.encodeAttribute but that is a private non-static method on a non-static inner class of SVGWriter and, even though it would prevent injection, it may not actually guarantee valid XML output.
SVGWriter has a lot dead code and I only updated code that could actually be run in a live GeoServer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are examples of where a lot of the SVGWriter functionality gets commented out:
https://github.com/geoserver/geoserver/blob/main/src/wms/src/main/java/org/geoserver/wms/svg/SVGWriter.java#L142
https://github.com/geoserver/geoserver/blob/main/src/wms/src/main/java/org/geoserver/wms/svg/SVGWriter.java#L208
https://github.com/geoserver/geoserver/blob/main/src/wms/src/main/java/org/geoserver/wms/svg/SVGWriter.java#L250
oh my! What an oldie! that was the very first WMS output format, even before any raster image one IIRC. |
The backport to
stderr
stdout
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.23.x 2.23.x
# Navigate to the new working tree
cd .worktrees/backport-2.23.x
# Create a new branch
git switch --create backport-7173-to-2.23.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick da8046ab019dd5e65c8d440ddfeafefe0f7193d4
# Push it to GitHub
git push --set-upstream origin backport-7173-to-2.23.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.23.x Then, create a pull request where the |
Eventual backport to 2.23.x will have to be manual |
This PR updates the Simple SVG renderer to properly escape special characters from GeoServer catalog information.
NOTE: This PR only updates code that could be executed through actual GeoServer WMS GetMap requests and ignores any potential issues in dead code.
Checklist
main
branch (backports managed later; ignore for branch specific issues).For core and extension modules:
[GEOS-XYZWV] Title of the Jira ticket
.