Docker: run as unprivileged user, drop capabilities (S8)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
MoepchiandClaude Opus 5.5 committed 2026-09-27 19:08:19 +00:00
1 parent 92479d8a38
commit 034be9cc77
2 files changed
+10

No files matched your search

+6
View File
@@ -81,6 +81,12 @@ ENV WEB_DIST=/app/web/dist
ENV CONNECTOR_BIN=/app/connector-bin/ts-connector
EXPOSE 8080
# Run unprivileged. /app itself is the default spot for feedback.log and
# store-themes.json, so it has to be writable by that user; a volume mounted
# there from an older (root) image may need a one-off `chown 1000:1000`.
RUN chown node:node /app
USER node
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD ["node", "-e", "fetch('http://127.0.0.1:8080/healthz').then(r => { if (!r.ok) process.exit(1) }).catch(() => process.exit(1))"]
+4
View File
@@ -6,6 +6,10 @@ services:
restart: unless-stopped
environment:
- PORT=8080
# Nothing in here needs Linux capabilities (unprivileged port, plain
# TCP/UDP sockets), so drop them all.
cap_drop: [ALL]
security_opt: [no-new-privileges:true]
# Port publishing is deployment-specific and left out of this file on
# purpose - Compose concatenates `ports:` lists across an override file
# instead of replacing them, so adding one here would double-publish