Conversation
Both Dockerfiles now create a non-root lit user (uid 10001, matching Dockerfile.otel-collector) and switch via USER before CMD. Closes the defense-in-depth gap where any RCE in lit-api-server would yield root in the Phala CVM with full access to /var/run/dstack.sock as a KMS signing/attestation oracle. Compatibility verified: lit-actions chmods /tmp/lit_actions.sock to 0o777 (see lit-actions/grpc/unix.rs), so lit-api-server connects regardless of UID. dstack-ingress already runs non-root with the same dstack.sock mount. docker buildx --check passes both files. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the deployed Phala CVM containers by ensuring lit-api-server and lit-actions no longer run as root, reducing blast radius if an RCE or sandbox escape occurs.
Changes:
- Add a dedicated non-root
lituser (UID 10001) to thelit-api-serverruntime image and switch execution to that user. - Add the same non-root
lituser (UID 10001) to thelit-actionsruntime image and switch execution to that user.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Dockerfile.lit-api-server | Creates non-root lit user (uid 10001) and sets USER lit before starting lit-api-server. |
| Dockerfile.lit-actions | Creates non-root lit user (uid 10001) and sets USER lit before starting lit_actions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Closes the defense-in-depth gap from CPL-300 (audit finding from
.context/CSO-CPL-281-report.md#11). Both Dockerfiles previously had noUSERdirective, so the containers ran as root inside the Phala CVM. Any RCE inlit-api-server(sandbox escape, panic-handler exploit, etc.) would have inherited root with full access to/var/run/dstack.sock— turning the dstack KMS into a signing/attestation oracle for arbitraryreport_data.Both Dockerfiles now drop to a non-root
lituser (uid 10001, matching the existing convention inDockerfile.otel-collector:9):Dockerfile.lit-api-server:useradd -u 10001 -m lit+USER litbeforeCMDDockerfile.lit-actions: same patternWhy this works without compose changes
/tmp/lit_actions.sock—lit-actions/grpc/unix.rs:66already chmods the bound socket to0o777, so thelit-api-serverside connects regardless of UID. The sharedlit-socketnamed volume initialises from the image's/tmp(mode 1777), so non-root binds./var/run/dstack.sock— bind-mounted from the host; the same compose'sdstack-ingressservice already accesses this socket without privileged mode, confirming non-root works.Verification
docker buildx build --check— passes both Dockerfiles, no warnings.useradd -u 10001 -m litsucceeds indebian:bookworm-slim,/tmpis mode 1777 (drwxrwxrwt), thelituser can create files there. Solit-actionscan bind/tmp/lit_actions.sock.Out of scope
The unrelated root-level
Dockerfile(development convenience build) is also missing aUSERdirective but is not deployed to Phala. Tracked separately if the audit decides to widen scope.Test plan
Phala Simulator ValidationCI passes (validates dstack socket access end-to-end).nextand confirmlit-api-serverandlit_actionsstart,idshowsuid=10001(lit), and/attestationendpoint still returns a valid quote.🤖 Generated with Claude Code