Skip to content

Fix: Handle disabled or uninstalled permissions gracefully#110

Open
csturiale wants to merge 1 commit into
jenkinsci:masterfrom
csturiale:feature/disabled-permissions-can-be-granted
Open

Fix: Handle disabled or uninstalled permissions gracefully#110
csturiale wants to merge 1 commit into
jenkinsci:masterfrom
csturiale:feature/disabled-permissions-can-be-granted

Conversation

@csturiale
Copy link
Copy Markdown

@csturiale csturiale commented Apr 10, 2026

This change improves robustness when dealing with permissions that are disabled or belong to uninstalled plugins.

Previously, the plugin would fail to start if a configured permission was not available (e.g., from a plugin that was uninstalled). Now, it logs a warning and continues, ignoring the invalid permission. This prevents a broken configuration from taking down a Jenkins instance.

Specifically, this commit:

  • Modifies PermissionWrapper to tolerate unknown or disabled permission IDs instead of throwing an exception.
  • Introduces PermissionWrapper.isValid() to check if a permission can be used for access control.
  • Filters out disabled permissions from being granted in the UI and from being applied to ACLs, improving compliance with SECURITY-3062.
  • Adds null checks in the FolderBasedAuthorizationStrategy constructor to improve compatibility with Jenkins Configuration as Code (JCasC).
  • Adds csturiale as a developer in pom.xml.

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

This change improves robustness when dealing with permissions that are disabled or belong to uninstalled plugins.

Previously, the plugin would fail to start if a configured permission was not available (e.g., from a plugin that was uninstalled). Now, it logs a warning and continues, ignoring the invalid permission. This prevents a broken configuration from taking down a Jenkins instance.

Specifically, this commit:
- Modifies `PermissionWrapper` to tolerate unknown or disabled permission IDs instead of throwing an exception.
- Introduces `PermissionWrapper.isValid()` to check if a permission can be used for access control.
- Filters out disabled permissions from being granted in the UI and from being applied to ACLs, improving compliance with SECURITY-3062.
- Adds null checks in the `FolderBasedAuthorizationStrategy` constructor to improve compatibility with Jenkins Configuration as Code (JCasC).
- Adds `csturiale` as a developer in `pom.xml`.
@csturiale csturiale requested a review from a team as a code owner April 10, 2026 13:11
@ssttehrani
Copy link
Copy Markdown

Could we please get this change merged and released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants