Skip to content

Commit

Permalink
Escape any HTML in user provided param.
Browse files Browse the repository at this point in the history
  • Loading branch information
tdonohue committed Jul 27, 2020
1 parent 53df081 commit c323b98
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -34,6 +34,7 @@
import org.dspace.content.service.CommunityService;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
import org.dspace.core.Utils;
import org.dspace.discovery.DiscoverQuery;
import org.dspace.discovery.DiscoverResult;
import org.dspace.discovery.IndexableObject;
Expand Down Expand Up @@ -103,7 +104,8 @@ public void search(HttpServletRequest request,

// do some sanity checking
if (!openSearchService.getFormats().contains(format)) {
String err = "Format " + format + " is not supported.";
// Since we are returning error response as HTML, escape any HTML in "format" param
String err = "Format " + Utils.addEntities(format) + " is not supported.";
response.setContentType("text/html");
response.setContentLength(err.length());
response.getWriter().write(err);
Expand Down

0 comments on commit c323b98

Please sign in to comment.