Security: harden Docker runtime file ownership to resolve docker:S6504 hotspots#278
Merged
Merged
Conversation
9 tasks
Copy runtime artefacts as root:root and apply chmod -R a-w /app so the non-root runtime user cannot modify deployed application files. - apps/app-frontend/Dockerfile: COPY --chown=root:root + chmod -R a-w /app - apps/marketing-site/Dockerfile: COPY --chown=root:root + chmod -R a-w /app - services/core-api/src/Curvit.Api/Dockerfile: COPY --chown=root:root + chmod -R a-w /app + move USER appuser after chmod Each service's ephemeral write needs (uploads, temp buffers) are satisfied by the world-writable /tmp mount; no /app path requires runtime write access. Agent-Logs-Url: https://github.com/NickLetts2/Curvit/sessions/5b834229-6f26-48e1-a7bb-3e840815643f Co-authored-by: NickLetts2 <90337962+NickLetts2@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Harden Docker runtime file ownership to improve security
Security: harden Docker runtime file ownership to resolve docker:S6504 hotspots
May 15, 2026
NickLetts2
added a commit
that referenced
this pull request
Jun 1, 2026
…-file-ownership Security: harden Docker runtime file ownership to resolve docker:S6504 hotspots
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.
Runtime application files were owned by the same non-root user running the process, allowing an attacker with code execution inside the container to modify or persist changes to deployed artefacts.
Pattern applied across all three services
Changes
apps/app-frontend/Dockerfile— all threeCOPYinstructions (standalone output, static files, public assets) changed toroot:root+chmod -R a-w /app. Next.js standalone uses/tmpfor ephemeral writes only.apps/marketing-site/Dockerfile—dist/andnode_modules/copies changed toroot:root+chmod -R a-w /app. Astro@astrojs/nodehas no runtime write requirement inside/app.services/core-api/src/Curvit.Api/Dockerfile— publish copy changed toroot:root+chmod -R a-w /app;USER appusermoved to after thechmod(was incorrectly placed beforeCOPY). ASP.NET Core buffers form data to/tmpby default.All containers continue to run as a non-root user (
appuser).