[FIXED SECURITY-77] XSS in iconSize cookie.

This commit is contained in:
Jesse Glick committed 2014-02-11 14:17:00 -05:00
1 parent 535c1115bb
commit a0b00508ee
4 files changed
+15 -7

No files matched your search

+11
View File
@@ -123,6 +123,8 @@ import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
/**
* Utility functions used in views.
@@ -426,6 +428,15 @@ public class Functions {
return c.getValue();
}
private static final Pattern ICON_SIZE = Pattern.compile("\\d+x\\d+");
@Restricted(NoExternalUse.class)
public static String validateIconSize(String iconSize) throws SecurityException {
if (!ICON_SIZE.matcher(iconSize).matches()) {
throw new SecurityException("invalid iconSize");
}
return iconSize;
}
/**
* Gets the suffix to use for YUI JavaScript.
*/