Skip to content

Add comments explaining what entrypoint is supposed to do#7792

Open
stuartpb wants to merge 1 commit into
coder:mainfrom
stuartpb:patch-1
Open

Add comments explaining what entrypoint is supposed to do#7792
stuartpb wants to merge 1 commit into
coder:mainfrom
stuartpb:patch-1

Conversation

@stuartpb
Copy link
Copy Markdown

This way the DOCKER_USER variable won't accidentally retain sudoer permissions for any user not named coder (almost certainly a security hole).

@stuartpb stuartpb requested a review from a team as a code owner May 11, 2026 04:53
@code-asher
Copy link
Copy Markdown
Member

code-asher commented May 12, 2026

How would this be reproduced? We create the coder user as part of the image so it will always be the right user to remove:

&& adduser --gecos '' --disabled-password coder \
&& echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd

If the user is not coder somehow, then these previous lines trying to rename it will fail anyway.

sudo usermod --login "$DOCKER_USER" coder
sudo groupmod -n "$DOCKER_USER" coder

@stuartpb
Copy link
Copy Markdown
Author

We create the coder user as part of the image so it will always be the right user to remove

Okay, so now imagine the crazy hypothetical scenario where literally any part of that very specific scaffolding for this specific fork of the codebase provided by the outside environment changes, for any reason, like if, I dunno, the name of the company changed and you missed one or two extant references to it.

@stuartpb
Copy link
Copy Markdown
Author

Or rather, sorry, I guess I just don't understand how any of these variables are expected to work because there are zero usable comments here. The idea is that the line we're deleting isn't supposed to be deleting the user named by DOCKER_USER? How am I supposed to understand what this code's supposed to be doing?

Also fixes the case where DOCKER_USER=coder
@stuartpb
Copy link
Copy Markdown
Author

Here, I've updated the PR, here's a version where you can tell what cases would and wouldn't have bugs because the code actually describes what it's trying to do.

@stuartpb stuartpb changed the title Fix sed command to remove last line in sudoers file Add comments explaining what entrypoint is supposed to do May 18, 2026
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