Skip to content

Commit

Permalink
Merge #2902 into 1.1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
pderop committed Sep 25, 2023
2 parents ec5e1de + b6aa478 commit 13c727d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.coyote.AbstractProtocol;
import org.apache.coyote.ProtocolHandler;
import org.apache.coyote.http11.AbstractHttp11Protocol;
import org.apache.tomcat.util.security.Escape;

import javax.servlet.MultipartConfigElement;
import javax.servlet.ServletException;
Expand Down Expand Up @@ -183,7 +184,10 @@ protected void service(HttpServletRequest req, HttpServletResponse resp) throws
}
resp.setStatus(Integer.parseInt(path));

writer.print(path);
// Use Tomcat's HTML escaping method, to avoid cross-site scripting Github security alert.
String sanitizedPath = Escape.htmlElementContent(path);

writer.print(sanitizedPath);
writer.flush();
}
}
Expand Down

0 comments on commit 13c727d

Please sign in to comment.