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: 0 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
buildPlugin(useContainerAgent: true, configurations: [
[platform: 'linux', jdk: '11'],
[platform: 'linux', jdk: '17'],
[platform: 'linux', jdk: '21']
])
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.88</version>
<version>5.17</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -94,7 +94,7 @@ THE SOFTWARE.
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>3696.vb_b_4e2d1a_0542</version>
<version>4710.v016f0a_07e34d</version>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lowest bound of the bom

<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -110,8 +110,8 @@ THE SOFTWARE.

<properties>
<changelist>999999-SNAPSHOT</changelist>
<jenkins.baseline>2.452</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.4</jenkins.version>
<jenkins.baseline>2.504</jenkins.baseline>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lowest LTS where the MANAGE permission is not Beta

<jenkins.version>${jenkins.baseline}.1</jenkins.version>
</properties>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private static String getItemsVerbage(final int length) {

@RequirePOST
public void doPurge(final StaplerRequest request, final StaplerResponse response) throws ServletException, IOException {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
Jenkins.get().checkPermission(Jenkins.MANAGE);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch to MANAGE as this does not allow arbirary command execution or esclation of privalledges

final Queue queue = Jenkins.get().getQueue();

if (queue != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@

<?jelly escape-by-default='false'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
<l:hasPermission permission="${app.ADMINISTER}">
<l:hasAdministerOrManage>
<l:task icon="symbol-trash-outline plugin-ionicons-api" confirmationMessage="${%Purge the build queue?}"
href="purge-build-queue/purge/" post="true" requiresConfirmation="true"
title="${%Purge Build Queue}" permissions="${it.ADMINISTER}">

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

permissions="${it.ADMINISTER}" was the bug that caused this not to be compatable.

it is not Jenkins in all current versions as such it.ADMINISTER would return null and then the permission would not be checked.
In Future version it will be an instance of Jenkins and as such this becomes valid, but it is a single permission when permissions is expecting an array.

Given this is already protected by the permission check in layout we can simply rmeove the extra check.

destructive="true"
title="${%Purge Build Queue}">
</l:task>
</l:hasPermission>
</l:hasAdministerOrManage>
</j:jelly>