-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[Core] Add su
and unsu
and sudo <command>
commands to bot
#3999
Conversation
I feel as if the owners should have the elevated privileges by default. A lot of users may only host for their needs and this would hinder their setup, maybe a flag to have it off by default? |
Personally, if I think the default should be unelevated for Team Tokens. If the bot is being run with just a single owner, it should default to elevated. If Co-Owners are used, maybe elevate the Token owner and unelevate the co-owners by default? The idea of being able to "unsudo" is nice though, save us from having to always test stuff with an alt |
We could put a recommendation to enable this functionality somewhere in our docs, but I really don't think we should make this a default. I also think that status-quo wins by default so IMO we would need very good reasons to change the current default behavior and they imo would need to outweight the reasons for the current behavior. For one, we have a lot of less-knowledgeable users and this is yet another obstacle thrown at them. I personally also don't think that Last but not least, while the point of what should be the default is debatable, there definitely needs to be a way that allows you to (depending on what will be chosen by default) enable/disable this functionality. |
From other things:
|
I agree with what jack said. I believe this is a cool feature but the default shouldn't be changed. As for names of the commands... This could either be made part of |
I don't have anything specific against the |
Added Added the |
I think |
This can be enabled more elegantly with a kwarg to is_owner check based on my own use of similar in the past. |
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 don't know what's the view of org members on this functionality, so I wouldn't be able to approve this either way, but here's a code review.
From things not included in review comments:
- are we sure we want to call these
sudo
/unsudo
? I do like these names myself, but as mentioned earlier, there could be better choices we (mostly you and I, I guess) didn't think of - can it possibly be important for 3rd-party cogs to know "true owners"? If it could be (and I'm quite worried it might), then we need this to be exposed in the API
- one could also say that modifying what is put in owner ids is changing behavior and therefore breaking. The importance of this needs to be determined.
So in theory this is ready to merge, although @TrustyJAID asked for the sudo command to accept commands, this would make it so it runs a singular command as sudo, and then it would auto remove sudo from you after, this needs to be looked into further before it is properly implemented. |
So adding the optional arg is gonna be far more painful than antecipated, since this PR is not dependent on it i would suggest we leave that for a follow up PR and keep this PR as it is. |
…tion suggestions)
As I said, this was pseudocode so it wasn't meant to become attr name.
…eout` to `[p]sutimeout` to open up space for `[p]sudo` which would be command based akin to `[p]mock`
NOTE: this is a bit fragile but unless I missed something, it stops becoming fragile if we successfully get through bot startup and I made a note about this in the body of `owner_ids` property.
…h bot owner permissions, without enabled this permission globaly.
su
and unsu
and sudo <comnmand>
commands to botsu
and unsu
and sudo <command>
commands to bot
Keeping this one open as jack spent a lot of time on it already. |
Type
Description of the changes
This PR does a couple of things.
[p]su
which allows a bot owner to elevate themselves to currently bot owner level.[p]unsu
which allows a bot owner to delavate their permissions back to a standard user[p]su
and[p]unsu
always avaliable to bot owners.[p]su
is runSo theres a couple of things that can be done/changed here.
The reasoning behind this PR is that bot owners should not have elevated permissions by default and should only elevate themselves when needed (for example a user will need to run
sudo
on terminal to elevate their shell, and even here after a period of time the user will need to reelevate themselves).I would appreciate any feedback on behaviour and discussion on default behaviour introduced by this PR.
resolves #3598