Repository navigation
Conversation
Signed-off-by: Diego Maniloff <diego.maniloff@gmail.com>
Code Review by Qodo
1. Root-owned npm cache stays inside the writable HOME
|
pshickeydev
added a commit
that referenced
this pull request
Nov 12, 2026
The full stage's npm install ran as root with HOME=/opt/traust, creating a root-owned /opt/traust/.npm that survived the workspace COPY (COPY merges contents; it does not fix a pre-existing directory's ownership). The assemble stage already removes its own .npm before the copy, so pointing npm's cache at /tmp during the install leaves none in the published image at all — closing the residual from PR #59 / issue #58. Verified on a rebuilt image: no /opt/traust/.npm, /opt/traust is 1001:0 and group-writable, and mkdir /opt/traust/.opengrep succeeds as uid 1001 with --network=none (the issue #58 repro). Assisted-by: GLM-5.3
Member
|
Commit included as part of #61 |
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.
Fixes #58
Summary
The toolkit image's runtime user (UID 1001) could not write to its home directory,
/opt/traust, so opengrep failed on every invocation (Permission denied: '/opt/traust/.opengrep').The harness
npm install -gruns as root withHOME=/opt/traust, which creates/opt/traustasroot:root 0755before the workspaceCOPY.COPY --chown=1001:0sets ownership on the copied contents but leaves the existing destination directory as it was. See #58 for details.This change sets ownership and group permissions on
$HOMEitself just before the workspaceCOPY. It touches a single directory and adds no recursive chown layer over the multi-GB tree, preserving the existing layer-size design.Verification
make checkpasses.The published image (linux/amd64) shows the bug:
/opt/traustisroot:root 0755,mkdir /opt/traust/.opengrepfails as UID 1001, and the opengrep adapter fails with the defaultHOMEbut succeeds withHOME=/tmp.Minimal linux/amd64 reproduction of the
fullstage: the real pinned base image,HOME, Claude Code npm install andCOPY --chown, with the multi-GB assemble stage replaced by a small directory of the same ownership./opt/traustwas then checked as UID 1001:A full linux/amd64 toolkit image was not rebuilt. For amd64, the evidence is the published image (which shows the root-owned
/opt/traust) plus the minimal reproduction above, which reuses the real base image,HOME, Claude Code npm install andCOPY --chown, and stubs out the multi-GB assemble stage.Not changed
/opt/traust/.npm(npm logs, root-owned) is still left in the image. Moving npm's cache out of$HOMEduring the build would avoid it, and is an alternative fix if preferred.