Merge branch 'security-stable-1.642' into security-stable-1.651

This commit is contained in:
Jesse Glick committed 2016-04-29 12:09:09 -04:00
commit 4baafc0951
10 files changed
+235 -11

No files matched your search

+10 -1
View File
@@ -1752,7 +1752,16 @@ public class Functions {
*/
public String getPasswordValue(Object o) {
if (o==null) return null;
if (o instanceof Secret) return ((Secret)o).getEncryptedValue();
if (o instanceof Secret) {
StaplerRequest req = Stapler.getCurrentRequest();
if (req != null) {
Item item = req.findAncestorObject(Item.class);
if (item != null && !item.hasPermission(Item.CONFIGURE)) {
return "********";
}
}
return ((Secret) o).getEncryptedValue();
}
if (getIsUnitTest()) {
throw new SecurityException("attempted to render plaintext ‘" + o + "’ in password field; use a getter of type Secret instead");
}