← 返回首页
Add comments explaining what entrypoint is supposed to do by stuartpb · Pull Request #7792 · coder/code-server · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

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

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 requested a review from a team as a code owner May 11, 2026 04:53

code-asher commented May 12, 2026
edited
Loading

Copy link
Copy Markdown
Member

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

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.

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

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 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

code-asher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Thanks!

Okay, so now imagine the crazy hypothetical scenario

Yeah it would probably make sense for us to use the USER env var instead of hardcoding coder in case we ever change the user in the docker image and miss updating the entrypoint with the new name.


if [ "${DOCKER_USER-}" ]; then
# Rename the `coder` user if a new name is specified by the `DOCKER_USER` environment variable
if [ "${DOCKER_USER-}" != "coder" ]; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

This will now run when DOCKER_USER is blank where before it would not, should probably be something like

if [ "${DOCKER_USER-}" ] && [ "$DOCKER_USER" != coder ]; then

Although, since we check if the user already exists below, it is probably not necessary to add this guard, but I suppose no harm in it either.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Footer

© 2026 GitHub, Inc.