jmestwa-coder commented on code in PR #4316:
URL: https://github.com/apache/logging-log4j2/pull/4316#discussion_r4083235520


##########
log4j-taglib/src/main/java/org/apache/logging/log4j/taglib/DumpTag.java:
##########
@@ -60,8 +61,8 @@ public int doEndTag() throws JspException {
                 final String name = names.nextElement();
                 final Object value = this.pageContext.getAttribute(name, 
this.scope);
 
-                this.pageContext.getOut().write("<dt><code>" + name + 
"</code></dt>");
-                this.pageContext.getOut().write("<dd><code>" + value + 
"</code></dd>");
+                this.pageContext.getOut().write("<dt><code>" + 
escapeHtml(name) + "</code></dt>");
+                this.pageContext.getOut().write("<dd><code>" + 
escapeHtml(String.valueOf(value)) + "</code></dd>");

Review Comment:
   Already applied in 3e104a4, the call site passes `value` directly now.



##########
log4j-taglib/src/main/java/org/apache/logging/log4j/taglib/DumpTag.java:
##########
@@ -70,4 +71,10 @@ public int doEndTag() throws JspException {
 
         return Tag.EVAL_PAGE;
     }
+
+    private static String escapeHtml(final String value) {
+        final StringBuilder builder = new StringBuilder(value);
+        StringBuilders.escapeXml(builder, 0);
+        return builder.toString();
+    }

Review Comment:
   Already in 3e104a4: `escapeHtml(final Object value)` with `new 
StringBuilder().append(value)`, same as the suggestion.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to