fix(selfhost): sandbox optional AI CLI install#1404
Merged
JSONbored merged 1 commit intoJun 26, 2026
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
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.
Motivation
npm install -gfor AI CLIs as root after copying the application bundle, which allows npm lifecycle scripts to execute as root and potentially mutate/appduring image build, creating a supply-chain risk.Description
Dockerfileto set a user-owned npm prefix viaNPM_CONFIG_PREFIX=/home/node/.npm-globaland add it toPATHso global installs can be performed without root-owned global state.chown/home/node/.npm-globaland/home/node/.npm, switch toUSER nodeto run the optionalnpm install -g @anthropic-ai/claude-code ... @openai/codex ...so lifecycle scripts run as the unprivileged user and cannot mutate/appduring build, then restoreUSER rootto continue remaining build steps unchanged.distandmigrationsfrom build stage) and preserved the finalUSER nodeat runtime and the data-dir ownership setup.Dockerfileand does not modify application code or tests.Testing
git diff --checksucceeded locally.npm run test:cistarted and progressed throughactionlint(fell back to WASM setup due to network),db:migrations:check(72 migrations OK), andtypechecksuccessfully, then reachedtest:coveragewhich hung in this environment and was interrupted, so the full gate did not complete here.npm audit --audit-level=moderatefailed in this environment due to the npm registry audit endpoint returning403 Forbidden(environmental limitation), and Docker was unavailable for a local image build verification.Codex Task