Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<jenkins.version>2.414.3</jenkins.version>
<release.skipTests>false</release.skipTests>
<tagNameFormat>v@{project.version}</tagNameFormat>
<useBeta>true</useBeta> <!-- For Jenkins.MANAGE permission -->
</properties>

<repositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ public String getDisplayName() {
@SuppressWarnings("unused")
public ListBoxModel doFillCredentialsIdItems(@QueryParameter String apiUrl,
@QueryParameter String credentialsId) {
if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) {
if (!Jenkins.getInstance().hasPermission(Jenkins.MANAGE)) {
return new StandardListBoxModel().includeCurrentValue(credentialsId);
}
return new StandardListBoxModel()
Expand All @@ -367,7 +367,7 @@ public ListBoxModel doFillCredentialsIdItems(@QueryParameter String apiUrl,
public FormValidation doVerifyCredentials(
@QueryParameter String apiUrl,
@QueryParameter String credentialsId) throws IOException {
Jenkins.getActiveInstance().checkPermission(Jenkins.ADMINISTER);
Jenkins.getActiveInstance().checkPermission(Jenkins.MANAGE);

GitHubServerConfig config = new GitHubServerConfig(credentialsId);
config.setApiUrl(apiUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public String getDisplayName() {

@SuppressWarnings("unused")
public ListBoxModel doFillCredentialsIdItems(@QueryParameter String credentialsId) {
if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) {
if (!Jenkins.getInstance().hasPermission(Jenkins.MANAGE)) {
return new StandardListBoxModel().includeCurrentValue(credentialsId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ public void shouldNotAllow_CredentialsLeakage_usingVerifyCredentials() throws Ex
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());

GlobalMatrixAuthorizationStrategy strategy = new GlobalMatrixAuthorizationStrategy();
strategy.add(Jenkins.ADMINISTER, "admin");
Jenkins.MANAGE.setEnabled(true);
strategy.add(Jenkins.MANAGE, "admin");
strategy.add(Jenkins.READ, "admin");
strategy.add(Jenkins.READ, "user");
j.jenkins.setAuthorizationStrategy(strategy);

Expand All @@ -121,7 +123,7 @@ public void shouldNotAllow_CredentialsLeakage_usingVerifyCredentials() throws Ex

assertThat(attackerServlet.secretCreds, isEmptyOrNullString());
}
{ // only admin can verify the credentials
{ // only admin (with Manage permission) can verify the credentials
JenkinsRule.WebClient wc = j.createWebClient();
wc.getOptions().setThrowExceptionOnFailingStatusCode(false);
wc.login("admin");
Expand Down