feat: add the StackRox CI sandbox profile - #183
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
| && tar -xzf /tmp/gh.tgz --strip-components=2 -C /tmp/gh-extract "gh_${GH_VERSION}_linux_amd64/bin/gh" \ | ||
| && test -f /tmp/gh-extract/gh \ | ||
| && install -m 0755 /tmp/gh-extract/gh /usr/bin/gh \ | ||
| && rm -rf /tmp/gh-extract /tmp/gh.tgz |
There was a problem hiding this comment.
The specified GitHub CLI version 2.100.0 does not exist, which will cause the build to fail when it tries to download it. The latest version is significantly lower. Please correct the GH_VERSION to a valid, existing version number.
There was a problem hiding this comment.
Skipped: this finding is incorrect. GitHub CLI v2.100.0 exists, and the image build fetched it successfully with the pinned checksum. No version change is needed.
| ARG CLAUDE_SHA256_AMD64=25e44883f54419569a3d739f38cbbdaebe83b09895da0f343e1b003710a4775b | ||
| RUN curl -fsSL "https://downloads.claude.ai/claude-code-releases/${CLAUDE_VERSION}/linux-x64/claude" -o /tmp/claude \ | ||
| && echo "${CLAUDE_SHA256_AMD64} /tmp/claude" | sha256sum -c - \ | ||
| && install -m 0755 /tmp/claude /usr/local/bin/claude \ |
There was a problem hiding this comment.
The symlink from /usr/bin/opencode to /usr/local/bin/opencode seems overly complex. To "keep the profile's command path stable," the opencode binary could be installed directly into /usr/local/bin instead of being copied to /usr/bin and then symlinked. This would simplify the Dockerfile.
There was a problem hiding this comment.
Resolved in dacc7ff: the npm-installed executables are copied directly to /usr/local/bin, so the extra opencode symlink is gone.
| "@openai/codex@${NPM_CODEX_VERSION}" \ | ||
| "@github/copilot@${NPM_COPILOT_VERSION}" \ | ||
| "ajv-cli@${NPM_AJV_VERSION}" \ | ||
| && npm cache clean --force |
There was a problem hiding this comment.
The tar npm package is installed globally but it does not seem to be used. The Dockerfile includes special logic to avoid overwriting the system's tar binary with the one from the npm package. If this package is a dependency for another package, npm will handle it automatically when that package is installed. If it is not needed, it should be removed to reduce image size and complexity.
There was a problem hiding this comment.
Resolved in dacc7ff: the explicit tar npm package was removed. The image keeps the system GNU tar from the base package set for archive extraction.
| && tar -xzf /tmp/gh.tgz --strip-components=2 -C /tmp/gh-extract "gh_${GH_VERSION}_linux_amd64/bin/gh" \ | ||
| && test -f /tmp/gh-extract/gh \ | ||
| && install -m 0755 /tmp/gh-extract/gh /usr/bin/gh \ | ||
| && rm -rf /tmp/gh-extract /tmp/gh.tgz |
There was a problem hiding this comment.
The specified GitHub CLI version 2.100.0 does not exist, which will cause the build to fail when it tries to download it. The latest version is significantly lower. Please correct the GH_VERSION to a valid, existing version number.
There was a problem hiding this comment.
Skipped: this is the same incorrect GitHub CLI version finding. v2.100.0 exists and the pinned download/checksum passed in CI.
| ARG CLAUDE_SHA256_AMD64=25e44883f54419569a3d739f38cbbdaebe83b09895da0f343e1b003710a4775b | ||
| RUN curl -fsSL "https://downloads.claude.ai/claude-code-releases/${CLAUDE_VERSION}/linux-x64/claude" -o /tmp/claude \ | ||
| && echo "${CLAUDE_SHA256_AMD64} /tmp/claude" | sha256sum -c - \ | ||
| && install -m 0755 /tmp/claude /usr/local/bin/claude \ |
There was a problem hiding this comment.
The symlink from /usr/bin/opencode to /usr/local/bin/opencode seems overly complex. To "keep the profile's command path stable," the opencode binary could be installed directly into /usr/local/bin instead of being copied to /usr/bin and then symlinked. This would simplify the Dockerfile.
There was a problem hiding this comment.
Resolved in dacc7ff: the npm-installed executables are copied directly to /usr/local/bin, so the extra opencode symlink is gone.
| && tar -xzf /tmp/gh.tgz --strip-components=2 -C /tmp/gh-extract "gh_${GH_VERSION}_linux_amd64/bin/gh" \ | ||
| && test -f /tmp/gh-extract/gh \ | ||
| && install -m 0755 /tmp/gh-extract/gh /usr/bin/gh \ | ||
| && rm -rf /tmp/gh-extract /tmp/gh.tgz |
There was a problem hiding this comment.
The specified GitHub CLI version 2.100.0 does not exist, which will cause the build to fail when it tries to download it. The latest version is significantly lower. Please correct the GH_VERSION to a valid, existing version number.
There was a problem hiding this comment.
Skipped: this is the duplicate GitHub CLI version finding. v2.100.0 exists and the pinned download/checksum passed in CI.
dacc7ff to
c9fc1a4
Compare
| && rm -rf /tmp/npm-global | ||
|
|
||
| # Claude Code's native binary. Pin both the release URL and its release | ||
| # manifest checksum instead of executing a downloaded installer as root. |
There was a problem hiding this comment.
This tar --version check seems out of place and unnecessary. It is executed in a sequence of commands for cleaning up temporary npm installation files and has no apparent connection to them. Consider removing it for clarity.
There was a problem hiding this comment.
Resolved in the current head: the redundant tar --version assertion was removed now that npm installs run in the sandbox prefix and only the expected CLI binaries are copied.
| && rm -rf /tmp/npm-global | ||
|
|
||
| # Claude Code's native binary. Pin both the release URL and its release | ||
| # manifest checksum instead of executing a downloaded installer as root. |
There was a problem hiding this comment.
This tar --version check seems out of place and unnecessary. It is executed in a sequence of commands for cleaning up temporary npm installation files and has no apparent connection to them. Consider removing it for clarity.
There was a problem hiding this comment.
Resolved in the current head: the redundant tar --version assertion was removed now that npm installs run in the sandbox prefix and only the expected CLI binaries are copied.
| RUN cp -a /tmp/npm-global/lib/node_modules/. /usr/lib/node_modules/ \ | ||
| && for name in opencode codex copilot ajv; do \ | ||
| test -e "/tmp/npm-global/bin/${name}"; \ | ||
| cp -a "/tmp/npm-global/bin/${name}" "/usr/local/bin/${name}"; \ |
There was a problem hiding this comment.
The cp -a command on line 103 copies the npm-created binaries as relative symlinks. When placed in /usr/local/bin, these symlinks will be broken because they expect to find the node_modules directory at a relative path (e.g., ../lib/node_modules) which is not correct for the final /usr/lib/node_modules destination. The executables will fail to run.
Consider either adjusting the destination paths to preserve the relative layout or recreating the symlinks to use absolute paths.
There was a problem hiding this comment.
Resolved in the current head: the npm-created symlinks are copied to /usr/bin, where their ../lib/node_modules targets resolve to /usr/lib/node_modules. This preserves the installed CLI paths without a second opencode symlink.
| RUN GOBIN=/usr/local/bin /usr/local/go/bin/go install "golang.org/x/tools/gopls@v${GOPLS_VERSION}" \ | ||
| && rm -rf /root/go /root/.cache/go-build | ||
|
|
||
| # Atlassian MCP is part of the StackRox workflow image contract. The gateway |
There was a problem hiding this comment.
The go install command on line 124 uses the default GOPATH and GOCACHE for the root user. While the rm command on the next line attempts to clean this up, it is brittle because it assumes the default locations. The rest of the Dockerfile sets GOPATH and other Go environment variables for the sandbox user.\n\nIt would be more robust to explicitly set GOPATH and GOCACHE to temporary locations for this go install command, ensuring that no build artifacts are left in the home directory of the root user. For example:\n\ndockerfile\nRUN GOPATH=\$(mktemp -d) GOCACHE=\$(mktemp -d) GOBIN=/usr/local/bin /usr/local/go/bin/go install "golang.org/x/tools/gopls@v${GOPLS_VERSION}"\n\n\nThis ensures the build is self-contained and does not rely on implicit user-specific Go environment defaults.
There was a problem hiding this comment.
Resolved in the current head: the gopls install now uses isolated /tmp/gopath and /tmp/gocache directories and removes both after installation.
| @@ -27,7 +39,7 @@ jobs: | |||
| run: | | |||
| if [[ "$GITHUB_REF_TYPE" == tag || -z "$BASE_SHA" || "$BASE_SHA" =~ ^0+$ ]]; then | |||
| changed=true | |||
There was a problem hiding this comment.
The ${IMAGE_PROFILE} variable is not quoted. If the profile name contained spaces or shell metacharacters, this command would be vulnerable to word splitting and globbing, which could lead to unexpected behavior or command injection. It should be double-quoted: ... "profiles/stackrox/image/${IMAGE_PROFILE}" ...
There was a problem hiding this comment.
Skipped: the expression is already quoted in the workflow as "profiles/stackrox/image/${IMAGE_PROFILE}"; this finding targets a stale/unquoted view of the file.
|
|
||
| # Use the same uv-managed Python contract as the community base image. The | ||
| # rox-ci-image system Python is 3.9, while current MCP integrations require | ||
| # 3.10+. |
There was a problem hiding this comment.
The specified Python version 3.14.3 is not a valid Python release. This will cause the build to fail at the uv python install step. Please use a valid and existing Python version.
There was a problem hiding this comment.
Skipped: this is another incorrect version finding. uv python install 3.14.3 completed successfully in the image build; the pinned version is intentional.
| # GitHub CLI (rox-ci-image does not include it). Pin the release and verify it | ||
| # before installing so the image remains reproducible. | ||
| ARG GH_VERSION=2.100.0 | ||
| ARG GH_SHA256_AMD64=e4d4bb4498e8d007abe545b6568926793ace1b6447da598294a610018cb164be |
There was a problem hiding this comment.
The specified gh CLI version 2.100.0 appears to be invalid. GitHub CLI versions follow a X.Y.Z format (e.g., 2.50.0). This will likely cause the curl command to fail with a 404 error. Please verify the version number.
There was a problem hiding this comment.
Skipped: this repeats the incorrect GitHub CLI finding. v2.100.0 exists and the pinned download/checksum completed successfully in CI.
| cp -a "/tmp/npm-global/bin/${name}" "/usr/bin/${name}"; \ | ||
| chown -h root:root "/usr/bin/${name}"; \ | ||
| done \ | ||
| && chown -R root:root /usr/lib/node_modules \ |
There was a problem hiding this comment.
The @hono/node-server package is installed, but its binary (hono) is not copied from /tmp/npm-global/bin to /usr/bin in the subsequent loop. This will make the hono command unavailable in the final image. The hono binary should be added to the loop.
There was a problem hiding this comment.
Skipped: @hono/node-server version 1.19.11 has no bin entry (npm view @hono/node-server@1.19.11 bin returns no executable). It is installed as a Node module dependency, not a hono CLI.
Summary
Adds the second StackRox image profile on top of the NVIDIA image PR.
sandbox-stackrox-cibased on the pinned StackRox Apollo/rox-ci-image builder image.gopls.linux/amd64because the current bundled downloads are amd64-only.Dependent on the root NVIDIA/default image PR so the profile and matrix changes can be reviewed in order.