-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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-41516] Add script console listener #6539
[JENKINS-41516] Add script console listener #6539
Conversation
This should also cover What's your plan for unsandboxed pipelines and other unsandboxed script execution involving |
Good point, thanks. About the other point: Do you mean unsandboxed pipelines that run potentially dangerous functions that have been put on the allowlist? |
No, users can choose to disable the sandbox for otherwise sandboxed scripts (requiring admin approval unless an admin configures the script and auto-approves), making the resulting features just as powerful/dangerous as the script console. I'm not opposed to a change like this, but it should cover all the common scripting features in Jenkins. |
That's a good question that I must think about. Gotta take a look at the script-security plugin, then I may be able to come up with a technical solution. |
FTR |
07d6de1
to
8d41ad1
Compare
Our general policy is to review proposed API additions along with the proposed consumers. This can help us better understand the intended use case in order to properly review the API and ensure the API can accommodate both present and future use cases. Is there a PR demonstrating the usage of this proposed API addition? |
Hi @basil, |
Hey @basil, |
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 idea seems sound. The current api is fine but for the purposes of audit-trail, would it not be beneficial to log the user who executed the script? I'm merely asking to prevent us from having an API that needs extension so quickly
Thanks for your review, @res0nance. Very good point! My idea was to get the user in the listener implementation. It looked like the User object was still accessible there but I do not know a lot about how the user object is implemented. |
Hi, |
Hi @Wadeck, |
Hey @daniel-beck, |
@meiswjn I'll do another iteration in the next few days. |
For what it's worth, I think that the usage pattern for |
FWIW I had similar thoughts in jenkinsci/script-security-plugin#416 (review) |
I added a basic logging listener to core in this PR, I hope that's OK with you. |
Some notes while I'm still playing with this (not immediately actionable I think):
|
Thanks for your feedback! My goal was to track every usage of privileged script execution - even by admins and approved scripts. For example, I do want to know when anyone uses |
Hi Daniel, thanks for all the feedback! I will wait with responding until you are done :) Just one thing in between: I am not sure if we should log the output. The usecase that I wanted this feature for was logging when admins decrypt secrets via the console. We would need to ensure that sensitive values do not appear in the audit log. Logging the output seems like it adds plenty of complexity. Should we view that as two isolated features, perhaps? |
That's what
hints at; output would be in something like Or are you saying nobody should be able to record any output? |
I would say that recording the script's output is a feature that could be considered, but I would say it is not as important as recording the script itself. I would suggest it is out of scope for this PR. Low reward, high effort from my perspective. |
Mostly done :) (unless we count pipelines, those would probably be pretty painful; but their output is recorded elsewhere already anyway) FWIW I realize I'm more actively involved here than in most other PRs as just a reviewer. As you can see in the older Jira issue I updated this PR to, I've been involved in occasional discussions around this general topic for more than five years. If you prefer, I'll step back and let you finish this. |
If you want to implement it, sure! Feel free :) |
Hey @daniel-beck, I know you are pretty busy but I would appreciate if you could quickly lay out your plans for this PR :) Do you want to merge this one or yours? |
@meiswjn Sorry for the delay in responding, unfortunately I am getting too many notifications to handle these days. This PR, as is, is not mergeable IMO. Whether you pull in changes from #7056, or we just "migrate" this project over there, does not really matter to me. FWIW this is still near the top of my TODO list, and I'm hoping to have something mergeable this month. |
Superseded by #7056 |
See JENKINS-41516.
Proposed changelog entries
Proposed 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 upgrade@Restricted
or have@since TODO
Javadoc, as appropriate.Desired reviewers
Any
Maintainer checklist
Before the changes are marked as
ready-for-merge
:Proposed changelog entries
are accurate, human-readable, and in the imperative moodupgrade-guide-needed
label is set and there is aProposed upgrade guidelines
section in the PR title. (example)lts-candidate
to be considered (see query).