Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-43524

Improve diagnostics of disabled Dangerous Permissions

      Jenkins version: 2.32.2

      Affected Role Strategy plugin version: 2.4.0

      Summary: While the goal of the 2.4.0 version is  "Dangerous permissions can be configured independently of Administer permission" there is a use case where you should consider allowable use of UploadPlugins to function without needing Administer to be checked. Within my team, we use chef to provide full configuration management of Jenkins. As such, in order to install plugins, this is done as anonymous - and chef has been able to do this without issue as long as anonymous has access to UploadPlugins. Anonymous for obvious reasons should not have Administer permissions.  With 2.3.2 installed, the chef converge happens without issue. However, if we use 2.4.0 converge will fail:

       

      Mixlib::ShellOut::ShellCommandFailed
      ------------------------------------
      Expected process to exit with [0], but received '6'
      ---- Begin output of "/usr/lib/jvm/jre/bin/java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 install-plugin /var/chef/cache/analysis-core-1.86.plugin -name analysis-core ----
      STDOUT:
      STDERR: [WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous
      ERROR: anonymous is missing the Overall/UploadPlugins permission
      ---- End output of "/usr/lib/jvm/jre/bin/java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 install-plugin /var/chef/cache/analysis-core-1.86.plugin -name analysis-core ----
      Ran "/usr/lib/jvm/jre/bin/java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 install-plugin /var/chef/cache/analysis-core-1.86.plugin -name analysis-core returned 6

       

      The error message is interesting:

      STDERR: [WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous
      ERROR: anonymous is missing the Overall/UploadPlugins permission

       

      This message is not entirely accurate, as this has already been configured for anonymous. What's going on here is that Overall/Administer has to be active in addition to Overall/UploadPlugins in order for this action to occur with this version of the plugin installed.

      The ask for this JIRA ticket is either to:

      1. Allow UploadPlugins to function without the need for Administer to also be set in order to upload plugins
      2. Update the error messaging to clearly indicate that Administer AND UploadPlugins are both required in order for the user to upload plugins.

          [JENKINS-43524] Improve diagnostics of disabled Dangerous Permissions

          Jesse Glick added a comment -

          Well, currently admin monitors are displayed in the UI only (also in support-core diagnostic bundles). If you ignore security and other warnings displayed this way, there is not much we can do.

          Jesse Glick added a comment - Well, currently admin monitors are displayed in the UI only (also in support-core diagnostic bundles). If you ignore security and other warnings displayed this way, there is not much we can do.

          Daniel Beck added a comment -

          I wonder whether an admin monitors CLI command would make sense. Unfortunately output is tailored to HTML, so would need to be limited to visible yes/no.

          Daniel Beck added a comment - I wonder whether an admin monitors CLI command would make sense. Unfortunately output is tailored to HTML, so would need to be limited to visible yes/no.

          Brenna Flood added a comment - - edited

          The original request didn't mention the UI or admin monitors. The presumption on jglick part that I'm not looking at the UI monitor is not relevant to what is being requested. I totally get if there are limitations in the console output for the case I presented - please feel free to close this request out if the addition is not possible.

          Thanks for taking the time to look at this.

          Brenna Flood added a comment - - edited The original request didn't mention the UI or admin monitors. The presumption on jglick  part that I'm not looking at the UI monitor is not relevant to what is being requested. I totally get if there are limitations in the console output for the case I presented - please feel free to close this request out if the addition is not possible. Thanks for taking the time to look at this.

          Daniel Beck added a comment - - edited

          brenna_flood

          The original request can be fixed neither in the plugin nor in core (at least not with any sort of reasonable effort). That doesn't mean you don't describe a problem it's worth investigating possible solutions for.

           

          Daniel Beck added a comment - - edited brenna_flood The original request can be fixed neither in the plugin nor in core (at least not with any sort of reasonable effort). That doesn't mean you don't describe a problem it's worth investigating possible solutions for.  

          Daniel Beck added a comment -

          brenna_flood

          FWIW, this…

          As such, in order to install plugins, this is done as anonymous - and chef has been able to do this without issue as long as anonymous has access to UploadPlugins.

          … is a good example why we felt the need to implement this, and do it in a way that gives maximum exposure to the issue to make admins aware.

          If you're able to upload plugins, then you can trivially write the give-my-user-admin-permissions.hpi plugin and upload it. Or the extract-all-valuable-data.hpi plugin.

          Therefore, Anonymous should also not have any of these three permissions either, or all the users on your network have all the permissions, and can do whatever they want if they are willing to do the effort.

          Daniel Beck added a comment - brenna_flood FWIW, this… As such, in order to install plugins, this is done as anonymous - and chef has been able to do this without issue as long as anonymous has access to UploadPlugins. … is a good example why we felt the need to implement this, and do it in a way that gives maximum exposure to the issue to make admins aware. If you're able to upload plugins, then you can trivially write the give-my-user-admin-permissions.hpi plugin and upload it. Or the extract-all-valuable-data.hpi plugin. Therefore, Anonymous should also not have any of these three permissions either, or all the users on your network have all the permissions, and can do whatever they want if they are willing to do the effort.

          Brenna Flood added a comment - - edited

          Yep, I totally agree on this point.

          The reason for opening the issue was that the current setting will drive some users towards setting UploadPlugins AND Administer as a "fix" for this.  It seems the changes made are regressive.

          Brenna Flood added a comment - - edited Yep, I totally agree on this point. The reason for opening the issue was that the current setting will drive some users towards setting UploadPlugins AND Administer as a "fix" for this.  It seems the changes made are regressive.

          Daniel Beck added a comment -

          brenna_flood

          the current setting will drive some users towards setting UploadPlugins AND Administer as a "fix" for this

          That's fair, but…

          1. We highlight the backward compatibility option both in the plugin docs (well, their wiki pages) and the directly security advisory. The idea/hope/delusion is that users who absolutely cannot go without will just do that, and nothing will have changed for them.
          2. They will be doing it very aware of what they're doing. You can't not know that you're granting Administer to anon, and setting a flag called "dangerous" to true is similarly unambiguous.

          Previously, users may has assumed that, for example, granting Run Scripts is safe. In fact, I bring proof in the form of the Scriptler Plugin documentation (and that was written by a long time contributor to the Jenkins project who still was unaware what exactly he was recommending there): https://wiki.jenkins-ci.org/display/JENKINS/Scriptler+Plugin

          You are able to configure whether you want to allow users which have only the "RunScripts" permission to execute scripts (every script has to be allowed separately). In addition you can also configure if these users should be able to change a script (which would be a security issue).

          Now, at least, the unsafe behavior is opt-in.

          Daniel Beck added a comment - brenna_flood the current setting will drive some users towards setting UploadPlugins AND Administer as a "fix" for this That's fair, but… We highlight the backward compatibility option both in the plugin docs (well, their wiki pages) and the directly security advisory. The idea/hope/delusion is that users who absolutely cannot go without will just do that, and nothing will have changed for them. They will be doing it very aware of what they're doing. You can't not know that you're granting Administer to anon, and setting a flag called "dangerous" to true is similarly unambiguous. Previously, users may has assumed that, for example, granting Run Scripts is safe. In fact, I bring proof in the form of the Scriptler Plugin documentation (and that was written by a long time contributor to the Jenkins project who still was unaware what exactly he was recommending there): https://wiki.jenkins-ci.org/display/JENKINS/Scriptler+Plugin You are able to configure whether you want to allow users which have only the "RunScripts" permission to execute scripts (every script has to be allowed separately). In addition you can also configure if these users should be able to change a script (which would be a security issue). Now, at least, the unsafe behavior is opt-in.

          Oleg Nenashev added a comment -

          danielbeck brenna_flood So do we need any actions here? From what I see, "no"

          Oleg Nenashev added a comment - danielbeck brenna_flood So do we need any actions here? From what I see, "no"

          Daniel Beck added a comment -

          I haven't seen similar requests in response to the April permission changes, and of the 4 watchers, 3 are core team. It sucks that it probably confused brenna_flood for a while, but as I commented before, there are no straightforward fixes that I can see that wouldn't e.g. cause effective regressions. So spending time on this wouldn't really be time well spent IMO.

          Daniel Beck added a comment - I haven't seen similar requests in response to the April permission changes, and of the 4 watchers, 3 are core team. It sucks that it probably confused brenna_flood for a while, but as I commented before, there are no straightforward fixes that I can see that wouldn't e.g. cause effective regressions. So spending time on this wouldn't really be time well spent IMO.

          Oleg Nenashev added a comment -

          I am closing it for now.

          If there are any particular improvements in diagnostics to be done, let's discuss them in follow-up tickets

          Oleg Nenashev added a comment - I am closing it for now. If there are any particular improvements in diagnostics to be done, let's discuss them in follow-up tickets

            oleg_nenashev Oleg Nenashev
            brenna_flood Brenna Flood
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: