Harden nut-server image: remove default guest credentials, disable local drive access, run as non-root - #3
Open
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
…-root Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Security review of the image. The repo itself contains no application code, so all findings are about what the Dockerfile bakes into the published image from
blawar/nutv3.3.Critical, verified on the current
mainimage: upstream shipsconf/users.confcontainingguest|guest, and the image kept it. Nut's HTTP server (0.0.0.0:9000, HTTP basic auth) therefore acceptsguest:guestout of the box. The bundled config also kept"enableLocalDriveAccess": 1, which inServer/Controller/Api.pydisables both the..check and the "path must be inside a configured path" check and addsroot(i.e./) to the browsable drive list — so any client can read arbitrary files from the container, which runs asroot.Fixes
users.conf; a newdocker-entrypoint.shwrites one on first start fromNUT_USERNAME/NUT_PASSWORD, or generates a random 24-char password and prints it once to the logs. It also warns if a mountedusers.confstill holdsguest|guest."enableLocalDriveAccess": 0in the baked config.conf/nut.conffrom/opt/nut-defaults/nut.confwhen it is missing. Mounting an empty host dir on the conf volume used to hide the baked config entirely, silently falling back to Nut's defaults (scan., local drive access on).gosuafter the entrypoint fixes ownership of the mounted volumes, so existing root-owned host mounts keep working. Install paths are unchanged.NUT_SHA256instead of trusting an unauthenticatedwget.gcc,*-dev) and apt lists from the final layer, and removeShopN.pem— an upstream-bundled Nintendo shop client certificate with a private key, only referenced as a config default and unused by the server.requests(>=2.32.3),Pillow(>=10.3.0) andurllib3(>=1.26.19) past known CVEs; the previous~=pins resolved torequests2.25.1 andPillow8.0.1.Not fixed / notes
.envor credential material in the repo.nut/Users.py(upstream). README now tells operators to keep it on a trusted network or behind a TLS proxy.Flask~=1.1.2(plus themarkupsafe==2.0.1pin needed to make it install) is only imported bynut/blockchain.py, which the server never loads — left alone to avoid churn, but it could be dropped fromrequirements.txt.Verified by building both images and exercising the endpoints above; the hardened container starts, serves
/titles, and reports its generated credentials indocker logs.Link to Devin session: https://app.devin.ai/sessions/f51efaa8ae66475ab14521388f4b8ee7
Requested by: @eskwisit