Skip to content
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-11153] Improve handling special characters in the WMS OpenLayers Format #7174

Merged
merged 1 commit into from Oct 16, 2023

Conversation

sikeoka
Copy link
Contributor

@sikeoka sikeoka commented Oct 10, 2023

GEOS-11153 Powered by Pull Request Badge

This PR updates the WMS OpenLayers Format to properly escape special characters from GeoServer catalog information.

Checklist

For core and extension modules:

  • New unit tests have been added covering the changes.
  • Documentation has been updated (if change is visible to end users).
  • The REST API docs have been updated (when changing configuration objects or the REST controllers).
  • There is an issue in the GeoServer Jira (except for changes that do not affect administrators or end users in any way).
  • Commit message(s) must be in the form [GEOS-XYZWV] Title of the Jira ticket.
  • Bug fixes and small new features are presented as a single commit.
  • Each commit has a single objective (if there are multiple commits, each has a separate JIRA ticket describing its goal).

@sikeoka sikeoka added backport 2.23.x Instructs the bot to create a 2.23.x backport PR on merge backport 2.24.x Instructs the bot to create a 2.24.x backport PR on merge labels Oct 10, 2023
Copy link
Member

@aaime aaime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confused about escaping done in different places, see below.

@@ -292,7 +293,7 @@ private List<String> styleNames(WMSMapContent mapContent) {
MapLayerInfo info = mapContent.getRequest().getLayers().get(0);
result = info.getOtherStyleNames();
}
return result;
return result.stream().map(StringEscapeUtils::escapeHtml4).collect(Collectors.toList());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the other parameters escaped in the template, while this one is escaped in Java code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure what to do with this one. The FreeMarker ?html directive is deprecated in favor of auto-escaping but HTML auto-escaping will escape the contents of script tags so that they may not be entirely correct JavaScript. The ?js_string directive is not deprecated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, the explanation makes sense, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.23.x Instructs the bot to create a 2.23.x backport PR on merge backport 2.24.x Instructs the bot to create a 2.24.x backport PR on merge
Projects
None yet
2 participants