-
Notifications
You must be signed in to change notification settings - Fork 245
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
Adding credentials should not require a check on CredentialsStore#isDomainsModifiable #557
Adding credentials should not require a check on CredentialsStore#isDomainsModifiable #557
Conversation
1ed70d3
to
8dc8ff6
Compare
Well this check has been there since before version 2.0 (2016) so what has changed now to cause problems? The check looks very explicit to me. |
And it looks kinda correct to me that if a domain isn't modifiable you shouldn't be able to add any credentials to it. For example you can't add an object to an unmodifiable list. |
Since the change from , we return early within the condition: Before that change, the HTTP 400 response was generated but we did not return so the rest of the method got executed as well:
Seems to me that this condition was not effective all along..
My understanding of the javadoc from this method and the usage of that method is that when a CredentialsStore is "domain-unmodifiable", you simply cannot create/delete/modify domains. But you can manage credentials within the read only domain(s). The workaround for that regression for example, is to add credentials from Manage Jenkins > Credentials for root credentials or Folder's Credentials page for folder credentials. |
I've been going back and forth on this. At first my "feeling" was that if a domain is used to categorize credentials, and we are setting that domain to unmodifiable, my expectation is that I should not be adding additional credentials to that domain. But like Alan said, the javadoc says something entirely different: It may have been misapplication of this particular check? I see there is a check if you can add a credential to a store, but really nothing else for domain. |
b933fee
to
19a767e
Compare
19a767e
to
86ddfc9
Compare
Fix a regression caused by #481. Since this PR, store implementation that define methods to manage credentials but not to manage domains cannot use the
Add
button anymore... This is the case for CloudBees implementation for Cyberark / Hashicorp Vault for example.It fails with a 400 and the "Domain is read-only" error on screen. Before this PR, the method was adding credentials properly and send return 400. Since this PR, it is returning early with the error.
Trying to make sense of this condition, I think it is is wrong. Per the javadoc for CredentialsStore#isDomainsModifiable(), it return if the store supports making changes to the list of domains or whether it only supports a fixed set of domains (which may only be one domain). This is about altering Domains. This method does not update or create a domain in any way, it simply add credentials to a selected domain. If the domain selected does not exist it fails with
Store does not have selected domain
. Also if the domain is not modifiable, you would not be able to select it in the dropdown:\So per my understanding, this condition should be removed.
Testing done
Submitter checklist