Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JEP-223] Deprecate permissions RUN_SCRIPTS, UPLOAD_PLUGINS, and CONFIGURE_UPDATECENTER #4365

Merged
merged 35 commits into from
Feb 22, 2020

Conversation

mikecirioli
Copy link
Contributor

@mikecirioli mikecirioli commented Nov 20, 2019

See JENKINS-60406, JEP-223

The permissions RUN_SCRIPTS, UPLOAD_PLUGINS, and CONFIGURE_UPDATECENTER are effectively the same as Jenkins.ADMINISTER. This PR flags these permissions as deprecated, and updates jenkins core to instead check for Jenkins.ADMINISTER. This is intended to be a first example and that over time other plugins will follow suit.

The usage of these permissions is confusing, and has been effectively hidden (unless specifically enabled) since 2017-4-10 (https://jenkins.io/security/advisory/2017-04-10/#matrix-authorization-strategy-plugin-allowed-configuring-dangerous-permissions).

Along with this change, jenkinsci/matrix-auth-plugin#77 is proposed to help prepare any users who currently have these permissions enabled.

Proposed changelog entries

  • The permissions Overall/RunScripts, Overall/UploadPlugins, and Overall/ConfigureUpdateCenter permissions are now deprecated. Custom authorization strategy implementations that grant Overall/Administer without implying one or more of these three permissions and as configurations that grant any of these permissions to users without Overall/Administer will will no longer work as expected.

Submitter checklist

  • JIRA issue is well described
  • Changelog entry appropriate for the audience affected by the change (users or developer, depending on the change). Examples
    * Use the Internal: prefix if the change has no user-visible impact (API, test frameworks, etc.)
  • Appropriate autotests or explanation to why this change has no tests
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@daniel-beck
@jglick

@daniel-beck daniel-beck self-requested a review November 21, 2019 08:52
@oleg-nenashev oleg-nenashev added the work-in-progress The PR is under active development, not ready to the final review label Nov 21, 2019
…that is (effectively)"

This change broke existing tests involving the matrix-auth plugin when legacy behavior for SECURITY-410 is enabled.

This reverts commit e7bc69d.
Copy link
Member

@daniel-beck daniel-beck left a comment

Choose a reason for hiding this comment

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

Almost there, just a bit more cleanup please 👍

core/src/main/java/jenkins/model/Jenkins.java Outdated Show resolved Hide resolved
core/src/main/java/hudson/PluginManager.java Outdated Show resolved Hide resolved
core/src/main/java/hudson/PluginManager.java Outdated Show resolved Hide resolved
core/src/main/resources/hudson/PluginManager/tabBar.jelly Outdated Show resolved Hide resolved
@@ -317,6 +317,7 @@ public void testDoScript() throws Exception {
wc.withBasicApiToken(User.getById("bob", true));
wc.assertFails("script", HttpURLConnection.HTTP_FORBIDDEN);

//TODO: remove once RUN_SCRIPTS is finally retired
Copy link
Member

Choose a reason for hiding this comment

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

It is unclear why the permission above was changed, and why this comment is necessary.

Copy link
Contributor Author

@mikecirioli mikecirioli Feb 20, 2020

Choose a reason for hiding this comment

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

The permission was changed back to RUN_SCRIPTS because that part of the test doesn't make sense if charlie has Jenkins.ADMINISTER. Since RUN_SCRIPTS still technically exists I thought it made more sense to leave the test as-is for now, and to add the comment to remove that block when its properly retired.

Copy link
Member

Choose a reason for hiding this comment

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

changed back … leave the test as-is for now

But then this PR wouldn't show a difference…?

Copy link
Member

@daniel-beck daniel-beck Feb 20, 2020

Choose a reason for hiding this comment

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

Ah, now I get it.

It probably makes sense to convert this test to demonstrate that granting RUN_SCRIPTS does not allow accessing the script console anymore, since all the permission checks are now looking at ADMINISTER instead.

Copy link
Member

Choose a reason for hiding this comment

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

It probably makes sense to convert this test to demonstrate

… which is exactly what this does now 🤦‍♂

@@ -1634,7 +1634,7 @@ public HttpResponse doProxyConfigure(StaplerRequest req) throws IOException, Ser
@RequirePOST
public HttpResponse doUploadPlugin(StaplerRequest req) throws IOException, ServletException {
try {
Jenkins.get().checkPermission(UPLOAD_PLUGINS);
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
Copy link
Member

Choose a reason for hiding this comment

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

Strictly speaking, none of the permission checks in this file matter, but if System Read is about to land, it probably makes sense to keep them.

@daniel-beck daniel-beck added squash-merge-me Unclean or useless commit history, should be merged only with squash-merge and removed ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback labels Feb 20, 2020
@daniel-beck
Copy link
Member

Please remove all localizations of Hudson.RunScriptsPermission.Description, PluginManager.ConfigureUpdateCenterPermission.Description and PluginManager.UploadPluginsPermission.Description.

@daniel-beck daniel-beck changed the title Deprecate permissions RUN_SCRIPTS, UPLOAD_PLUGINS, and CONFIGURE_UPDATECENTER [JEP-223] Deprecate permissions RUN_SCRIPTS, UPLOAD_PLUGINS, and CONFIGURE_UPDATECENTER Feb 20, 2020
@mikecirioli
Copy link
Contributor Author

@daniel-beck apparently my local system munged the italian localization. I will see if i can fix that up in the morning

@daniel-beck
Copy link
Member

I will see if i can fix that up in the morning

Do the editing in a very basic text editor, not an IDE that understands the properties format.

@daniel-beck daniel-beck added the needs-comments-resolved Comments in the PR need to be addressed before it can be considered for merging label Feb 21, 2020
@mikecirioli
Copy link
Contributor Author

Should be good now @daniel-beck

Copy link
Contributor

@EstherAF EstherAF left a comment

Choose a reason for hiding this comment

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

lgtm

@timja timja added ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback and removed needs-comments-resolved Comments in the PR need to be addressed before it can be considered for merging labels Feb 21, 2020
@daniel-beck daniel-beck added the upgrade-guide-needed This changes might be breaking in rare circumstances, an entry in the LTS upgrade guide is needed label Feb 21, 2020
@mikecirioli
Copy link
Contributor Author

FYI upgrade guide work has been planned separately from this PR

@mikecirioli
Copy link
Contributor Author

FYI: jenkinsci/matrix-auth-plugin#77 to update admin monitors shown to users who currently have these permissions enabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted squash-merge-me Unclean or useless commit history, should be merged only with squash-merge upgrade-guide-needed This changes might be breaking in rare circumstances, an entry in the LTS upgrade guide is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants