Skip to content

Commit 63f82f2

Browse files
committed
[SECURITY-2792]
1 parent 0fc4a19 commit 63f82f2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/jenkinsci/plugins/badge/StatusImage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
package org.jenkinsci.plugins.badge;
99

1010
import java.net.MalformedURLException;
11+
import java.util.Arrays;
1112
import java.util.logging.Level;
1213
import java.util.logging.Logger;
1314
import org.apache.commons.io.IOUtils;
@@ -105,13 +106,12 @@ class StatusImage implements HttpResponse {
105106
if (status != null) status = StringEscapeUtils.escapeHtml(status);
106107
if (animatedColorName != null) animatedColorName = StringEscapeUtils.escapeHtml(animatedColorName);
107108
if (colorName != null) colorName = StringEscapeUtils.escapeHtml(colorName);
108-
if (style != null) style = StringEscapeUtils.escapeHtml(style);
109109
if (link != null) link = StringEscapeUtils.escapeHtml(StringEscapeUtils.escapeHtml(link)); // double-escape because concatenating into an attribute effectively removes one level of quoting
110110

111111
if (baseUrl != null) {
112112
etag = Jenkins.RESOURCE_PATH + '/' + subject + status + colorName + animatedColorName + style;
113113

114-
if (style == null) {
114+
if (style == null || !Arrays.asList("flat-square", "plastic").contains(style)) { // explicitly list allowed values for SECURITY-2792
115115
style = "flat";
116116
}
117117

0 commit comments

Comments
 (0)