Skip to content

Prohibit running under sudo unless explicitly forced to do so#3265

Merged
peterebden merged 1 commit intothought-machine:masterfrom
peterebden:prohibit-sudo
Oct 7, 2024
Merged

Prohibit running under sudo unless explicitly forced to do so#3265
peterebden merged 1 commit intothought-machine:masterfrom
peterebden:prohibit-sudo

Conversation

@peterebden
Copy link
Copy Markdown
Collaborator

@peterebden peterebden commented Oct 4, 2024

We occasionally see people doing this which frankly messes everything up (they end up with a bunch of files owned by root which can't be removed, which they then complain about later). It's also terrible from a security perspective to invoke a tool like Please as root which will execute a heap of other commands and download files etc.

Sudo sets several env vars, so we can just refuse to run if they are set. I've added a flag to force working around it but I assume this shouldn't be necessary.

I guess you could consider this a breaking change, I'd like to not on the basis that this was a terrible idea all along. We can't have this as a config setting because it's effectively too late (by that point we've already done some stuff, e.g. written a log file)

@peterebden peterebden merged commit 01ff2d5 into thought-machine:master Oct 7, 2024
@peterebden peterebden deleted the prohibit-sudo branch October 7, 2024 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants