-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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-61206 - Support System Read / Extended read permissions for agent configurations #4531
Conversation
/** | ||
* This version is so that the 'hasAnyPermission' | ||
* degrades gracefully if "it" is not an {@link AccessControlled} object. | ||
* Otherwise it will perform no check and that problem is hard to notice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just throw in that case? The assumption that object
is an ancestor isn't necessarily true. For example, in upstream cause related UI, you would show information about another job / build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s consistent with hasPermission and wasn’t working without this for the l:task it was just silently doing nothing
Otherwise there was a white page and it looked weird
jenkins/core/src/main/java/hudson/Functions.java Lines 2019 to 2024 in ed80d24
While this is now pretty irrelevant for "read only" forms, it's not inconceivable that other views are added by a plugin that are available to users with Computer/ExtendedRead but are not marked read-only. So I would like to see that method amended to mask |
The only usages of Computer.EXTENDED_READ are currently in jenkins core, this feature has never been documented, and it not enabled by the extended read permission plugin, I will fix that as part of this work. I see it as pretty inconceivable really. Do you still think it's worth doing that? |
@timja I do, any plugin adding support for Computer/Extended Read without also ensuring their custom form is To clarify, it is not currently a problem for the reasons you mention, but may become one with this PR. |
Hmm k, will take a look |
Pushed, will look at a test later on, I've manually tested it |
For testing, any suggestion on how to add a form with a Computer in it's ancestor but not in what's already got I tested it by commenting out the |
@timja Attach an |
<l:task href="${rootURL}/${it.url}configure" icon="icon-setting icon-md" permission="${it.EXTENDED_READ}" title="${%Configure}"/> | ||
|
||
<j:choose> | ||
<j:when test="${app.hasPermission(it.CONFIGURE)}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the same mistake that made all job configurations read-only?
<j:when test="${app.hasPermission(it.CONFIGURE)}"> | |
<j:when test="${it.hasPermission(it.CONFIGURE)}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems to work though, =/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've committed it but both seem to work in this case from what I can see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't grant the permission globally, use project-specific matrix auth and grant it on the specific agent only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm ? That’s what’s there now isn’t it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah you mean when I was testing before sure
Co-authored-by: Daniel Beck <[email protected]>
I've created #4724 which will generate some merge conflicts with this. I'm happy to resolve conflicts there is this is merged first (or help to resolve conflicts here if needed). |
@daniel-beck would you be able to take another look please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't fit as a line comment, so mentioning it here: It would be good if users with Overall/SystemRead were able to see the global cloud configuration that now only says
The cloud configuration has moved to a separate configuration page.
I see nothing wrong with this PR, even in manual testing. Thanks for adding proper Computer/ExtendedRead support.
core/src/main/resources/hudson/model/ComputerSet/sidepanel.jelly
Outdated
Show resolved
Hide resolved
core/src/main/resources/jenkins/model/GlobalCloudConfiguration/index.groovy
Show resolved
Hide resolved
Anyone else want to take a look at this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-:+1:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-:+1: assuming latest changes were manually tested.
@oleg-nenashev to retest it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yesterday I spent some time to verify the PR, and it looks good to me. On my test instance the forms worked pretty well with Extended Read. I am +1 for merging and early release so that we could do crowd testing during the hackfest.
Cc @jenkinsci/core , is everybody fine with release on Monday with this fix?
See JENKINS-61206.
Adds system read / extended read support for agents / clouds.
The rule I applied was anything that was previously checking for administer for viewing is now system read, anything checking for connect or configure is Agent/ExtendedRead
Manual testing notes
When using the core-pr-tester (
docker run --rm -ti -p 8080:8080 -e ID=4531 jenkins/core-pr-tester
), you can use script console to enable the permissions:Proposed changelog entries
permissions
attribute totask.jelly
hasAnyPermissions
API toFunctions
to allow it to be called by viewsProposed upgrade guidelines
N/A
Submitter checklist
Proposed changelog entries
section only if there are breaking changes or other changes which may require extra steps from users during the upgradeDesired reviewers
@mention
Maintainer checklist
Before the changes are marked as
ready-for-merge
:Proposed changelog entries
are correctupgrade-guide-needed
label is set and there is aProposed upgrade guidelines
section in the PR title. (example)lts-candidate