-
Notifications
You must be signed in to change notification settings - Fork 165
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-63668] fix: auto re-request approval once dismissed #546
base: master
Are you sure you want to change the base?
Conversation
ae1520e
to
3a8f7ee
Compare
@Wadeck I addressed your concern in 3a8f7ee. This should prevent any accidential auto-approvals by admins unknowingly running a script and approving it for everyone. |
Great, thanks @meiswjn for the bug fix. I will not have the time to test it but I believe the maintainers of the plugin will be happy to move forward this PR and the previous one about the UI revamp :) |
Hey @daniel-beck, Thanks! |
Hey @daniel-beck, perhaps you have missed this. If you do not have time, perhaps @Wadeck has time? |
👋 Hello Jan, currently we (Daniel and me) are both lacking time however I pinged the maintainers of this plugin to see if they have some time for this PR :) |
Everything related to |
There are still plenty of usage of |
final ConversionCheckResult result = checkAndConvertApprovedScript(script, language); | ||
if (!result.approved) { | ||
if (!Jenkins.get().isUseSecurity() || | ||
if (!Jenkins.get().isUseSecurity() || |
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.
The boolean logic here has become too complex and unreadable, so it is very difficult to grok if the added logic is sound.
But why do you need the new parameter at all? From the description it seems like it should suffice to just set approveIfAdmin
to false
?
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.
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.
Sorry I couldn't find @Wadeck 's comment so I am still a bit lost as to why, though I trust that there is a legitimate reeason for it I just would like to understand that reason 😅
If you could clean up the logic to make it more readable that would be hugely helpful :) Maybe it is just enough to reformat the code?
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.
No worries!
#300 (comment)
There you go :) Last sentence in that comment.
What ignoreAdmin does can be seen here. When the using() function is called from a job, it will not cause scripts to be approved automatically. If the admin did set up the script, it would have already been approved on saving the configuration.
It is supposed to prevent the scenario, where an admin starts a job, not knowing that it will approve a potentially dangerous script in it.
I am reformatting it in a sec
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.
though I trust that there is a legitimate reeason for it I just would like to understand that reason 😅
Yes, please! I am new to this repository's source code. There is a chance that I am completely wrong with that new boolean and since this is security relevant, I totally support that you question 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.
I tried to make it much more readable, even though not as "fancy" as before. Does this help? @rsandell
Just as an FYI I remember explicitly doing this in email-ext at least for when a template is picked up from the workspace; it will call configuring followed by using every time, which might be annoying for some admins 😅 |
What would be the outcome of this scenario? I think once the script is approved, the admin does not have to do anything unless approval is revoked :) |
Getting off topic, but FWIW many cases would be better handled by replacing that plugin with e.g. mail subject: 'Failure', …, body: """
Build broke! $BUILD_URL
""" |
Hello @rsandell, Thanks! I appreciate your work! |
I am very sorry for the delay, our team is quite swamped at the moment and this keeps falling between the cracks. So thanks for the reminder! |
Thanks, @rsandell! Would you have an ETA for me? |
In the current state, this PR is not compatible with some of the recent implemented changes. Moving it to draft until I find some time. |
This PR resolves JENKINS-63668. If a job fails because a script is not approved, it automatically re-requests the approval.
It also deprecates the current #using method and adds a new flag
ignoreAdmin
to it. This is due to concerns that administrators could unknowingly approve a script for everyone by running the job.Should unblock #300 (hopefully - motivation behind this PR).
Testing done
Submitter checklist