Skip to content

Retire SHOW_LEGACY_TOKEN_TO_ADMINS system property in ApiTokenProperty#26408

Open
Heller07 wants to merge 3 commits intojenkinsci:masterfrom
Heller07:fix/remove-obsolete-admin-check
Open

Retire SHOW_LEGACY_TOKEN_TO_ADMINS system property in ApiTokenProperty#26408
Heller07 wants to merge 3 commits intojenkinsci:masterfrom
Heller07:fix/remove-obsolete-admin-check

Conversation

@Heller07
Copy link
Contributor

@Heller07 Heller07 commented Mar 5, 2026

Fixes #26377
Removes the deprecated SHOW_LEGACY_TOKEN_TO_ADMINS system property from ApiTokenProperty.
Since the permission changes introduced after JEP-223, administrators inherently have full control and can perform actions such as running Groovy scripts. Therefore limiting what administrators can do through this property no longer makes sense.
This change removes:

  • the SHOW_LEGACY_TOKEN_TO_ADMINS system property
  • the related SystemProperties usage
  • the associated documentation block

Testing done

This change is a code cleanup that removes an unused system property and related configuration logic.
Testing performed:

  • Built Jenkins locally using: mvn -DskipTests clean install
  • Verified that the project compiles successfully after the removal.
  • Reviewed the permission logic to ensure behavior remains unchanged: administrators continue to have access as before.

Screenshots (UI changes only)

N/A

Before

After

Proposed changelog entries

  • Remove deprecated SHOW_LEGACY_TOKEN_TO_ADMINS system property from ApiTokenProperty

Proposed changelog category

/label internal

Proposed upgrade guidelines

N/A

Submitter checklist

  • The issue, if it exists, is well-described.
  • The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples). Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.
  • There is automated testing or an explanation as to why this change has no tests.
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.
  • UI changes do not introduce regressions when enforcing the current default rules of Content Security Policy Plugin. In particular, new or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation).
  • For dependency updates, there are links to external changelogs and, if possible, full differentials.
  • For new APIs and extension points, there is a link to at least one consumer.

Desired reviewers

@jenkinsci/core-pr-reviewers

Before the changes are marked as ready-for-merge:

Maintainer checklist

  • There are at least two (2) approvals for the pull request and no outstanding requests for change.
  • Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
  • Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
  • Proper changelog labels are set so that the changelog can be generated automatically.
  • If the change needs additional upgrade steps from users, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
  • If it would make sense to backport the change to LTS, be a Bug or Improvement, and either the issue or pull request must be labeled as lts-candidate to be considered.

Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

Needs a matching pull request to Jenkins documentation (here and here) to note that the properties have been removed

@MarkEWaite MarkEWaite requested a review from Copilot March 5, 2026 17:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Heller07
Copy link
Contributor Author

Heller07 commented Mar 5, 2026

Hi @MarkEWaite I want to confirm the intended behavior before updating the tests.
Since the issue says the admin restriction code can be "deleted without replacement", I interpreted it as allowing administrators to see/manage tokens like other operations they can perform. I updated canCurrentUserControlObject accordingly.
However, some existing tests (e.g., adminsShouldBeUnableToSeeTokensByDefault) assert that admins cannot see tokens. Should these tests be removed/updated to reflect the new behavior, or should the original restriction remain and only the system property be removed?
Just want to make sure I align the implementation and tests with the intended behavior.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Retire ADMIN_CAN_GENERATE_NEW_TOKENS, SHOW_LEGACY_TOKEN_TO_ADMINS, etc.

3 participants