Skip to content

Conversation

@oliv3r
Copy link

@oliv3r oliv3r commented Oct 16, 2025

Currently the general advise is to just use privileged mode with docker/compose. From a security point of view this is obviously undesirable.

One reason why privileged mode is needed, is because some packages 0 incorrectly set permissions on their (-rwxr-x--- 501:staff package.json) file. One would rightfully argue, that this doesn't matter, because docker runs as root and thus all permissions are granted anyway. However when working with volumes, this is no longer true, the docker user is mapped to some random UID and within our container we now get a permission denied error, because our remapped root user no longer has access.

While we obviously should aim to fix this error upstream wherever possible, this could take years. Meanwhile lets put the root user into the staff group, which seems to be the permissions set by these misbehaving packages. Obviously this will break again once upstream or debian changes the mapping/permission at a later time.

Currently the general advise is to just use privileged mode with
docker/compose. From a security point of view this is obviously
undesirable.

One reason why privileged mode is needed, is because some packages [0]
incorrectly set permissions on their (`-rwxr-x--- 501:staff package.json`)
file. One would rightfully argue, that this doesn't matter, because docker
runs as root and thus all permissions are granted anyway. However when
working with volumes, this is no longer true, the docker user is mapped
to some random UID and within our container we now get a permission
denied error, because our remapped root user no longer has access.

While we obviously should aim to fix this error upstream wherever
possible, this could take years. Meanwhile lets put the root user into
the `staff` group, which seems to be the permissions set by these
misbehaving packages. Obviously this will break again once upstream or
debian changes the mapping/permission at a later time.

[0]: https://community.platformio.org/t/incorrect-permissions-for-several-packages-on-package-json/41733

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
@oliv3r
Copy link
Author

oliv3r commented Oct 16, 2025

As per esphome/esphome#7098 I put the usermod into its own layer; which violates the best docker practises, but is what is preferred by upstream.

@oliv3r
Copy link
Author

oliv3r commented Oct 16, 2025

Pipeline breakage is due to outdated hardcoded dependency version. Not sure if you want to be that strict with your dependencies, as you need to keep them strictly up-to-date.

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.

1 participant