Skip to content
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

Security vulnerabilities in linux base for container. #719

Closed
degsoteria opened this issue Jan 21, 2025 · 5 comments
Closed

Security vulnerabilities in linux base for container. #719

degsoteria opened this issue Jan 21, 2025 · 5 comments

Comments

@degsoteria
Copy link

Can someone update the linux base layer for the container in docker hub? Both 6.x and 7.x are really bad. We would like to try this but our client requires better security. Thank you for any feedback on the possiblity.

Image

@LaurentGoderre
Copy link
Member

These are false positives. See https://github.com/tianon/gosu/blob/master/SECURITY.md

Also duplicate of #718

@degsoteria
Copy link
Author

degsoteria commented Jan 21, 2025 via email

@yosifkit
Copy link
Member

Just for argument sake. If it not used, remove from container base ?

if [[ "$originalArgOne" == mongo* ]] && [ "$(id -u)" = '0' ]; then
if [ "$originalArgOne" = 'mongod' ]; then
find /data/configdb /data/db \! -user mongodb -exec chown mongodb '{}' +
fi
# make sure we can write to stdout and stderr as "mongodb"
# (for our "initdb" code later; see "--logpath" below)
chown --dereference mongodb "/proc/$$/fd/1" "/proc/$$/fd/2" || :
# ignore errors thanks to https://github.com/docker-library/mongo/issues/149
exec gosu mongodb "$BASH_SOURCE" "$@"

The gosu binary is used to simply step down from root to the mongodb user. It allows the entrypoint script to start as root to correct filesystem permissions for easier setup while still running the mongod server as an unprivileged user. If you provide mount points or Docker volumes with the correct permissions, then setting --user will bypass gosu and it will be unused.

--

If there are any other updates from OS packages, they will be address at the next Dockerfile change (like version bump) or base image update.

For example, the CVE's existing in the base ubuntu:24.04 image would need to be addressed by a new, updated Ubuntu 24.04 image. Just rebuilding from the mongo Dockerfiles would be unlikely to affect any of them. It has been a month since the last Ubuntu image update, so I expect one very soon.

Background:

Tags in the [official-images] library file[s] are only built through an update to that library file or as a result of its base image being updated (ie, an image FROM debian:bullseye would be rebuilt when debian:bullseye is built).

-https://github.com/docker-library/official-images/tree/2f086314307c04e1de77f0a515f20671e60d40bb#library-definition-files

Official Images FAQ:

Though not every CVE is removed from the images, we take CVEs seriously and try to ensure that images contain the most up-to-date packages available within a reasonable time frame

- https://github.com/docker-library/faq/tree/0ad5fd60288109c875a54a37f6581b2deaa836db#why-does-my-security-scanner-show-that-an-image-has-cves

To ensure that we don't push contentless image changes, we rely on periodic base image updates.

We strive to publish updated images at least monthly for Debian. We also rebuild earlier if there is a critical security need. Many Official Images are maintained by the community or their respective upstream projects, like Ubuntu, Alpine, and Oracle Linux, and are subject to their own maintenance schedule.

- from the same FAQ link

@tianon
Copy link
Member

tianon commented Jan 22, 2025

(Also, in this case, it's not just gosu, but also a bunch of MongoDB-provided tools written in Go.)

@degsoteria
Copy link
Author

degsoteria commented Jan 22, 2025 via email

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

No branches or pull requests

4 participants