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

JENKINS-60116: Allow 'EXTENDED_READ' permission to select credentials #165

Merged
merged 1 commit into from
Jul 12, 2020
Merged

JENKINS-60116: Allow 'EXTENDED_READ' permission to select credentials #165

merged 1 commit into from
Jul 12, 2020

Conversation

pathob
Copy link

@pathob pathob commented Jun 29, 2020

Although JENKINS-60116 already has been closed in November 2019, the faulted
behaviour has not actually been fixed yet as reported by users in that ticket
this year and reproduced by myself.

The method BitbucketSCMSource.DescriptorImpl.doFillCredentialsIdItems was
obviously still doing a check for the global 'CONFIGURE' permissions (which
already explains the wrong behaviour and is redundant to the checks in the
called method BitbucketScmFormFillDelegate.doFillCredentialsIdItems anyway).

This commit adds the wanted behaviour of a context (item) based permission
check. If a context is given, only the Item.EXTENDED_READ permission is
required which follows the approach used by other SCM plugins (Git, Subversion).
Furthermore, the redundant checks are removed and the tests have been adjusted,
to use a mock of the now necessary context parameter.

@pathob pathob marked this pull request as draft June 29, 2020 05:56
Although JENKINS-60116 already has been closed in November 2019, the faulted
behaviour has not actually been fixed yet as reported by users in that ticket
this year and reproduced by myself.

The method `BitbucketSCMSource.DescriptorImpl.doFillCredentialsIdItems` was
obviously still doing a check for the global 'CONFIGURE' permissions (which
already explains the wrong behaviour and is redundant to the checks in the
called method `BitbucketScmFormFillDelegate.doFillCredentialsIdItems` anyway).

This commit adds the wanted behaviour of a context (item) based permission
check. If a context is given, only the `Item.EXTENDED_READ` permission is
required which follows the approach used by other SCM plugins (Git, Subversion).
Furthermore, the redundant checks are removed and the tests have been adjusted,
to use a mock of the now necessary context parameter.
@pathob pathob marked this pull request as ready for review June 29, 2020 06:06
@pathob
Copy link
Author

pathob commented Jul 7, 2020

Hello @alibk0rd, @dkjellin, @mhenschke-atl

any feedback on this? Me and my client really would like to see this small but important fix in the next release. Thank you for your time!

Copy link

@dkjellin dkjellin left a comment

Choose a reason for hiding this comment

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

Hello @pathob
Thank you for this PR. We have seen it and will review it shortly.
I don't think it will make the next release (which is due very soon) but I think we can make a new release with this fix shortly after.

The changes looks good to me, and once one more team member has looked at it and approved I think we can merge this, and build a release with it.

@pathob
Copy link
Author

pathob commented Jul 8, 2020

Hello @dkjellin,

I don't think it will make the next release (which is due very soon) but I think we can make a new release with this fix shortly after.

Thank you, that sounds good!

Copy link

@mhenschke-atl mhenschke-atl left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I'm happy for it to merge.

@@ -45,8 +48,8 @@ public void testDoCheckServerId() {

@Test
public void testDoFillCredentialsIdItems() {
descriptor.doFillCredentialsIdItems("myBaseUrl", "myCredentialsId");
verify(formFill).doFillCredentialsIdItems("myBaseUrl", "myCredentialsId");
descriptor.doFillCredentialsIdItems(item, "myBaseUrl", "myCredentialsId");

Choose a reason for hiding this comment

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

I think here (and other POST methods we're testing) we should be mocking item privileges to ensure they're insufficient privileges are being rejected. That's a blind spot in the code base in general though, and I don't think it's needed to merge this PR.

@mhenschke-atl mhenschke-atl merged commit 093354e into jenkinsci:master Jul 12, 2020
@pathob pathob deleted the feature/credentials-for-non-admin-users branch July 13, 2020 04:29
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.

4 participants