[JENKINS-36476] Underprivileged users could not use the default value of a password parameter (#2454)

* [FIXED JENKINS-36476] Do not even send the default password in encrypted form; leave the text field blank, and apply the default upon submission.

* [JENKINS-36476] Use a special token, not the empty string, as the marker for the default value.
This commit is contained in:
Jesse Glick authored and Oleg Nenashev committed 2016-07-16 22:14:48 +03:00
1 parent 7d5a2e3f36
commit c31392d140
4 files changed
+66 -2

No files matched your search

+2 -1
View File
@@ -154,6 +154,7 @@ import org.kohsuke.stapler.jelly.InternationalizedStringExpression.RawHtmlArgume
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import hudson.model.PasswordParameterDefinition;
import hudson.util.RunList;
import java.util.concurrent.atomic.AtomicLong;
import javax.annotation.CheckForNull;
@@ -1779,7 +1780,7 @@ public class Functions {
}
return ((Secret) o).getEncryptedValue();
}
if (getIsUnitTest()) {
if (getIsUnitTest() && !o.equals(PasswordParameterDefinition.DEFAULT_VALUE)) {
throw new SecurityException("attempted to render plaintext ‘" + o + "’ in password field; use a getter of type Secret instead");
}
return o.toString();