mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-29 12:35:19 +00:00
[FIXED SECURITY-77] XSS in iconSize cookie.
This commit is contained in:
1 parent
535c1115bb
commit
a0b00508ee
4 files changed
+15
-7
No files matched your search
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user