Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
48248aa
X-Smart-Branch-Parent: master
robbycochran Mar 19, 2026
6191758
feat: add devcontainer and Claude Code agent development environment
robbycochran Mar 18, 2026
c77c8a0
docs: add Vertex AI setup and devcontainer build instructions to CLAU…
robbycochran Mar 18, 2026
d1e7a46
feat: add launcher script with worktree isolation and GitHub PAT support
robbycochran Mar 18, 2026
7fb9902
feat: use official GitHub MCP server, fix run.sh, add bubblewrap
robbycochran Mar 18, 2026
9ee7372
refactor: convert skills to collector-dev plugin with scoped tool per…
robbycochran Mar 18, 2026
24c1d24
feat: create branch and draft PR upfront, tighten iterate permissions
robbycochran Mar 18, 2026
5eecdb7
feat: add watch-ci skill for CI monitoring loop
robbycochran Mar 18, 2026
f75b62d
feat: add end-to-end task skill with CI monitoring loop
robbycochran Mar 18, 2026
7a5bdb1
fix: load collector-dev plugin via --plugin-dir flag
robbycochran Mar 18, 2026
11b7afe
feat: stream agent activity to stdout in autonomous mode
robbycochran Mar 18, 2026
e32a662
feat: add --local mode for debugging without worktree or PR
robbycochran Mar 18, 2026
25bf9d8
feat: add --headless mode (worktree + stream-json, no PR)
robbycochran Mar 18, 2026
2cc2a47
fix: initialize submodules in worktree after creation
robbycochran Mar 18, 2026
1cc86dd
fix: only init required submodules, drop --recursive
robbycochran Mar 18, 2026
f969766
fix: headless mode now invokes /collector-dev:task skill like default…
robbycochran Mar 18, 2026
b609c53
feat: add preflight checks with clear error messages
robbycochran Mar 19, 2026
762e2ce
refactor: remove gh CLI dependency, agent creates PR via GitHub MCP
robbycochran Mar 19, 2026
995b443
refactor: move skills from plugin to standalone, simplify CLAUDE.md
robbycochran Mar 19, 2026
bdb95eb
refactor: switch worktree to clone, consolidate to 2 skills, fix audi…
robbycochran Mar 19, 2026
1f8b8f6
fix: move git push deny to container-only settings
robbycochran Mar 19, 2026
768ebb2
security: remove SSH mount, git push blocked by lack of credentials
robbycochran Mar 19, 2026
dff9883
fix: set clone remote to GitHub URL instead of local path
robbycochran Mar 19, 2026
5c1b799
refactor: switch back to worktrees, mount .git at same absolute path
robbycochran Mar 19, 2026
ab2dd59
perf: shallow submodule checkout in worktrees (--depth 1)
robbycochran Mar 19, 2026
ef2fee9
perf: mount submodules from main repo instead of cloning per worktree
robbycochran Mar 19, 2026
09bae7c
feat: make submodule mounting optional via --symlink-submodules
robbycochran Mar 19, 2026
e2a4085
feat: add --branch flag, use /tmp/collector-worktrees/ for worktrees
robbycochran Mar 19, 2026
3295488
fix: reject --branch with --local mode
robbycochran Mar 19, 2026
bc74ac4
fix: mount .git read-write so git commit works in container
robbycochran Mar 19, 2026
48da9b7
security: mount .git read-only with worktree subdir read-write
robbycochran Mar 19, 2026
356e1d8
fix: set theme and verbose defaults in entrypoint to skip startup pro…
robbycochran Mar 19, 2026
480e9aa
fix: chmod worktree git dir for container uid mismatch
robbycochran Mar 19, 2026
e595f88
fix: use chmod a+rwX to fix directory permissions in worktree git dir
robbycochran Mar 19, 2026
4683ad3
fix: mount .git read-write, partial ro/rw overlay doesn't work
robbycochran Mar 19, 2026
94418f7
security: remove SYS_PTRACE/NET_ADMIN/NET_RAW caps, drop --symlink-su…
robbycochran Mar 19, 2026
db98d81
feat: specify GitHub MCP toolsets via X-MCP-Toolsets header
robbycochran Mar 19, 2026
0c538c4
feat: watch-ci updates PR body with agent status after each CI cycle
robbycochran Mar 19, 2026
4cf15e2
docs: add MCP Context Protector integration plan
robbycochran Mar 19, 2026
5369867
fix: autonomous mode inlines task instructions instead of invoking /t…
robbycochran Mar 19, 2026
d1c71dc
feat: add /dev-loop skill combining task + watch-ci + PR comment hand…
robbycochran Mar 19, 2026
69d62c2
feat: allow specifying skill in autonomous mode, default to /dev-loop
robbycochran Mar 19, 2026
9835cd8
fix: remove local keyword from case branch (not a function)
robbycochran Mar 19, 2026
8672c77
docs: update MCP security plan — recommend mcp-watchdog over mcp-cont…
robbycochran Mar 19, 2026
d7d42a0
fix: push branch from host before launching autonomous agent
robbycochran Mar 19, 2026
bc0825a
fix: only push branch in autonomous /dev-loop mode, not for explicit …
robbycochran Mar 19, 2026
df9991a
feat: TUI is now default for all modes, --no-tui for stream-json
robbycochran Mar 19, 2026
cb9610c
docs: clarify push_files usage in dev-loop and watch-ci skills
robbycochran Mar 19, 2026
8feb2b2
docs: add devcontainer README with GitHub PAT permissions and setup g…
robbycochran Mar 19, 2026
6a1d5ba
refactor: replace raw new/delete with std::unique_ptr in NRadix
robbycochran Mar 19, 2026
31c2f0c
X-Smart-Branch-Parent: claude-nradixmem7
robbycochran Mar 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"permissions": {
"deny": [
"mcp__github__merge_pull_request",
"mcp__github__delete_file",
"mcp__github__fork_repository",
"mcp__github__create_repository",
"mcp__github__actions_run_trigger"
]
}
}
84 changes: 84 additions & 0 deletions .claude/skills/dev-loop/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
name: dev-loop
description: Full autonomous development loop — implement, build, test, commit, push, create PR, monitor CI, fix failures until green
disable-model-invocation: true
allowed-tools: Bash(cmake *), Bash(ctest *), Bash(nproc), Bash(git add *), Bash(git commit *), Bash(git diff *), Bash(git describe *), Bash(git branch *), Bash(git status), Bash(git log *), Bash(git rev-parse *), Bash(clang-format *), Bash(sleep *), Bash(date *), Read, Write, Edit, Glob, Grep, Agent
---

# Dev Loop

Complete a development task end-to-end: implement, build, test, push, create PR, monitor CI, fix failures.
Do NOT stop until CI is green or you are blocked.

## Phase 1: Implement

1. Read and understand the task from $ARGUMENTS
2. Explore relevant code
3. Implement the changes
4. Build: `cmake -S . -B cmake-build -DCMAKE_BUILD_TYPE=Release -DCOLLECTOR_VERSION=$(git describe --tags --abbrev=10 --long) && cmake --build cmake-build -- -j$(nproc)`
- If build fails, fix and retry
5. Test: `ctest --no-tests=error -V --test-dir cmake-build`
- If tests fail, fix and retry
6. Format: `clang-format --style=file -i <changed .cpp/.h files>`
7. Commit: `git add` changed files, `git commit` with a descriptive message

## Phase 2: Push and create PR

Use the GitHub MCP server to push files and create a PR.
Do NOT use `git push` — it will fail (no SSH keys in this container).

1. Get the current branch name and the list of changed files:
- `git branch --show-current` for the branch
- `git diff --name-only origin/HEAD..HEAD` for changed files
2. Use the GitHub MCP `push_files` tool to push the changed files directly to
the remote branch. This creates a commit via the GitHub API using the file
contents from your local workspace — it does not sync git history.
- owner: stackrox, repo: collector, branch: <current branch>
- Read each changed file and include its content
- Provide a commit message
3. Search for an open PR for this branch via GitHub MCP
4. If no PR exists, create a draft PR via GitHub MCP

## Phase 3: Monitor CI

Loop until all checks pass or blocked (max 6 cycles, ~3 hours):

1. Wait 10 minutes: `sleep 600`
2. Check CI status via GitHub MCP (PR checks, workflow runs)
3. Update PR body with an `## Agent Status` section:
```
## Agent Status
**Last updated:** <`date -u +"%Y-%m-%d %H:%M UTC"`>
**CI cycle:** N of 6
**Status:** PENDING | PASSED | FIXED | FLAKE | BLOCKED
**Details:** <one-line summary>
```
4. Evaluate:
- **All checks passed** → update PR body, report success, stop
- **Still running** → continue loop
- **Failed** →
- Get job logs via GitHub MCP
- Diagnose: build error, test assertion, lint, infra flake
- If fixable: fix → build → test → push changed files via MCP → continue
- If infra flake: note as FLAKE, continue
- If not fixable: update PR body, report BLOCKED, stop

## Phase 4: Check PR comments

Before each CI cycle, check if there are new PR review comments via GitHub MCP.
If a reviewer left feedback:
- Address the feedback (edit code, fix issues)
- Build and test
- Push changed files via MCP
- Note in the Agent Status section what feedback was addressed

## Completion

Print summary:
```
STATUS: PASSED | BLOCKED | TIMEOUT
Branch: <branch>
PR: <url>
Cycles: N
Changes: <list of files modified>
```
43 changes: 43 additions & 0 deletions .claude/skills/task/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: task
description: Implement a change — edit code, build, test, format, commit locally. No push.
disable-model-invocation: true
allowed-tools: Bash(cmake *), Bash(ctest *), Bash(nproc), Bash(git add *), Bash(git commit *), Bash(git diff *), Bash(git describe *), Bash(git branch *), Bash(git status), Bash(clang-format *), Read, Write, Edit, Glob, Grep, Agent
---

# Task

Implement a change locally: edit, build, test, format, commit.
Do NOT push or create PRs — use /watch-ci for that.

## Steps

1. Read and understand the task from $ARGUMENTS
2. Explore relevant code in the repository
3. Implement the changes
4. Build:
- `cmake -S . -B cmake-build -DCMAKE_BUILD_TYPE=Release -DCOLLECTOR_VERSION=$(git describe --tags --abbrev=10 --long) && cmake --build cmake-build -- -j$(nproc)`
- If build fails, fix and retry
5. Run unit tests:
- `ctest --no-tests=error -V --test-dir cmake-build`
- If tests fail, fix and retry
6. Format changed C++ files:
- `clang-format --style=file -i <changed .cpp/.h files>`
7. Commit:
- `git add` the changed files
- `git commit` with a descriptive message

## STOP here. Report and wait.

Print this summary and then STOP. Do not continue with any other actions.

```
TASK COMPLETE
Branch: <current branch>
Commit: <commit hash>
Files changed: <list>
Tests: <pass/fail count>
```
Comment on lines +34 to +40
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Specify a language for this fenced block.

markdownlint is already flagging this fence, so this change leaves the warning open until the block is annotated (for example, text).

🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 38-38: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/skills/task/SKILL.md around lines 34 - 40, The fenced code block in
SKILL.md is missing a language tag which triggers markdownlint; update the
triple-backtick fence that contains the TASK COMPLETE summary to include a
language identifier (e.g., ```text or ```markdown) so the linter stops flagging
it—locate the fenced block in .claude/skills/task/SKILL.md and add the language
after the opening backticks.


The user will review and decide whether to run /watch-ci.
Do NOT push, create branches, or create PRs.
68 changes: 68 additions & 0 deletions .claude/skills/watch-ci/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
name: watch-ci
description: Push files to existing remote branch via GitHub MCP, create PR if needed, monitor CI, fix failures until green
disable-model-invocation: true
allowed-tools: Bash(cmake *), Bash(ctest *), Bash(nproc), Bash(git add *), Bash(git commit *), Bash(git diff *), Bash(git describe *), Bash(git branch *), Bash(git status), Bash(git log *), Bash(git rev-parse *), Bash(clang-format *), Bash(sleep *), Bash(date *), Read, Write, Edit, Glob, Grep
---

# Watch CI

Push changed files via the GitHub MCP server, create PR if needed, and monitor CI until green.
Do NOT use `git push` — it will fail (no SSH keys in this container).

## How pushing works

Use the GitHub MCP `push_files` tool to send file contents directly to the remote
branch via the GitHub API. This does NOT sync local git history — it creates a new
commit on the remote with the file contents you provide.

1. Get the branch name: `git branch --show-current`
2. Get changed files: `git diff --name-only origin/HEAD..HEAD`
3. Read each changed file's content
4. Call `push_files` with owner: stackrox, repo: collector, branch, files, and commit message

## Steps

1. **Push** changed files:
- Use the GitHub MCP `push_files` tool as described above
- If no files have changed since last push, skip

2. **Find or create PR**:
- Use the GitHub MCP server to search for an open PR for this branch
- If no PR exists, create a draft PR via the GitHub MCP server

3. **Monitor CI loop** (repeat until all checks pass or blocked):
- Wait 10 minutes: `sleep 600`
- Use the GitHub MCP server to get PR check status and workflow runs
- Update PR body with an `## Agent Status` section:
```
## Agent Status
**Last updated:** <`date -u +"%Y-%m-%d %H:%M UTC"`>
**CI cycle:** N of 6
**Status:** PENDING | PASSED | FIXED | FLAKE | BLOCKED
**Details:** <one-line summary>
```
- Evaluate:
- **All checks passed** → update PR body, report success and stop
- **Checks still running** → report progress, continue loop
- **Checks failed** →
- Get job logs via the GitHub MCP server
- Diagnose:
- Build failure: read error, fix code
- Unit test failure: read assertion, fix code
- Lint failure: run `clang-format --style=file -i`
- Integration test infra flake (VM timeout, network): report as flake, continue
- Integration test real failure: analyze and fix code
- If fixable: fix → build → test → push changed files via MCP → continue loop
- If not fixable: update PR body, report diagnosis and stop

4. **Safety limits**:
- Maximum 6 CI cycles (about 3 hours of monitoring)
- If exceeded, update PR body and stop

5. **Summary**: end with a status line:
- `PASSED` — all checks green
- `PENDING` — checks still running
- `FIXED` — failure diagnosed and fix pushed
- `FLAKE` — infra failure, not a code issue
- `BLOCKED` — failure requires human intervention
82 changes: 82 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Collector development container
# Based on the collector-builder image which has all C++ dependencies pre-installed.
# Adds Claude Code, Go, and developer tooling for agent-driven development.
#
# Build environment: CentOS Stream 10 with clang, llvm, cmake, grpc, protobuf,
# libbpf, bpftool, and all other collector dependencies.

ARG COLLECTOR_BUILDER_TAG=master
FROM quay.io/stackrox-io/collector-builder:${COLLECTOR_BUILDER_TAG}

# Install developer tooling not in the builder image
# Note: git, findutils, which, openssh-clients already in builder
# bubblewrap: Claude Code uses this for built-in command sandboxing
RUN dnf install -y \
bubblewrap \
clang-tools-extra \
jq \
socat \
zsh \
procps-ng \
sudo \
python3-pip \
iptables \
ipset \
&& dnf clean all

# Determine architecture strings used by various download URLs
# uname -m gives aarch64 or x86_64
# Go uses arm64/amd64, ripgrep/fd use aarch64/x86_64
RUN ARCH=$(uname -m) \
&& GOARCH=$([ "$ARCH" = "aarch64" ] && echo "arm64" || echo "amd64") \
# Install Go
&& curl -fsSL "https://go.dev/dl/go1.23.6.linux-${GOARCH}.tar.gz" | tar -C /usr/local -xzf - \
# Install ripgrep
&& curl -fsSL "https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep-14.1.1-${ARCH}-unknown-linux-gnu.tar.gz" \
| tar -xzf - --strip-components=1 -C /usr/local/bin "ripgrep-14.1.1-${ARCH}-unknown-linux-gnu/rg" \
# Install fd
&& curl -fsSL "https://github.com/sharkdp/fd/releases/download/v10.2.0/fd-v10.2.0-${ARCH}-unknown-linux-gnu.tar.gz" \
| tar -xzf - --strip-components=1 -C /usr/local/bin "fd-v10.2.0-${ARCH}-unknown-linux-gnu/fd"
Comment on lines +30 to +39
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's read the Dockerfile to understand the full context
cat -n .devcontainer/Dockerfile

Repository: stackrox/collector

Length of output: 3854


🏁 Script executed:

# Check if checksums or signatures are available for these tools
# Go - check official documentation and available checksums
curl -sL https://go.dev/dl/ | grep -i "sha256\|checksum" | head -20

Repository: stackrox/collector

Length of output: 655


🏁 Script executed:

# Check ripgrep releases for checksum information
curl -sL "https://api.github.com/repos/BurntSushi/ripgrep/releases/tags/14.1.1" | jq '.body' 2>/dev/null | head -50

Repository: stackrox/collector

Length of output: 66


🏁 Script executed:

# Check fd releases for checksum information
curl -sL "https://api.github.com/repos/sharkdp/fd/releases/tags/v10.2.0" | jq '.body' 2>/dev/null | head -50

Repository: stackrox/collector

Length of output: 66


🌐 Web query:

Go 1.23.6 official release checksums download

💡 Result:

Go 1.23.6 was released on 2025-02-04 as a security release fixing crypto/elliptic timing sidechannel on ppc64le (CVE-2025-22866). Official binary and source distributions are available at https://go.dev/dl/. SHA256 checksums for all official download files are listed on that page in a table under the go1.23.6 section (likely in "Archived versions" since newer releases like go1.26.1 are featured). To verify downloads, compute the SHA256 hash of the file and match it against the official checksums on https://go.dev/dl/. Alternatively, use go install golang.org/dl/go1.23.6@latest followed by go1.23.6 download, which fetches and verifies the official distribution automatically. Source code can also be obtained via git checkout go1.23.6 in the golang/go repository at https://go.googlesource.com/go. No explicit checksum values were extractable from search snippets, but the official page provides them directly.

Citations:


🌐 Web query:

ripgrep 14.1.1 release checksums available

💡 Result:

Yes, checksums (SHA256) for ripgrep 14.1.1 release binaries are available on the official GitHub releases page at https://github.com/BurntSushi/ripgrep/releases/tag/14.1.1. Each binary archive, such as ripgrep-14.1.1-x86_64-unknown-linux-musl.tar.gz, has a corresponding .sha256 file containing its checksum. These are standard for ripgrep releases, as confirmed by examples in 14.0.0 and 15.x releases (e.g., ripgrep-14.0.0-aarch64-apple-darwin.tar.gz.sha256). SourceForge mirrors also host these .sha256 files specifically for 14.1.1 assets, like ripgrep-14.1.1-x86_64-pc-windows-gnu.zip.sha256 and ripgrep_14.1.1-1_amd64.deb.sha256. The release occurred on 2024-09-09 (patch fixing matching bug #2884), and is verified with GPG signature.

Citations:


🌐 Web query:

fd 10.2.0 release checksums github

💡 Result:

The fd (find alternative) tool version 10.2.0 was released on 2024-08-23 by sharkdp/fd on GitHub. SHA256 checksums for its binary assets are provided directly on the GitHub release page (https://github.com/sharkdp/fd/releases/tag/v10.2.0), listed next to each downloadable file (e.g., similar to fd-musl_10.4.2_amd64.deb sha256:a8d10259388c32f9aafd65fb65b6e3e2d2782043bed687112f50e2c4cf000c27 for recent releases). There is no separate checksums.txt file, as confirmed by closed issue #788 requesting one. Visit the specific release page to view all 22-23 assets and their individual SHA256 hashes for verification. The release includes features like --hyperlink option and builds Windows releases with Rust 1.77 for Windows 7 support.

Citations:


🌐 Web query:

docker dockerfile best practices piping curl to tar security

💡 Result:

Dockerfile best practices for piping curl to tar, such as RUN curl https://example.com/file.tar.gz | tar -xzf -, are endorsed by official Docker documentation as efficient for downloading and extracting remote archives in a single layer. This avoids leaving temporary files in image layers, unlike using ADD with remote URLs followed by separate extraction. Key best practices: - Prefer RUN curl ... | tar over ADD http://... for remote archives: ADD creates an extra layer with the unextracted archive, bloating the image and complicating cleanup. RUN allows download, extract, and delete in one step. - Pin exact versions in URLs (e.g., via ENV PG_VERSION=9.3.4; curl https://example.com/postgres-$PG_VERSION.tar.xz | tar ...) for reproducibility and supply chain security. - Verify integrity: Download to a temp file first, check SHA256 checksum, then extract and remove (e.g., RUN curl -fsSL https://example.com/package.tar.gz -o /tmp/pkg.tar.gz && echo "expected_sha256 /tmp/pkg.tar.gz" | sha256sum -c - && tar -xzf /tmp/pkg.tar.gz -C / && rm /tmp/pkg.tar.gz). - Use --fail/-f with curl to fail on HTTP errors, -SL for location following. - Combine with apt cleanup: In Debian/Ubuntu, chain with apt-get update/install/curl && ... && apt-get purge -y curl ca-certificates && rm -rf /var/lib/apt/lists/* to minimize image size. - Avoid piping curl directly to sh/bash (curl | sh), as it executes untrusted scripts without review; always inspect or verify downloads. - Use multi-stage builds for complex cases to further reduce final image size. - Scan images with tools like Trivy or Docker Scout for vulnerabilities, including in curl itself (keep base images updated). Security risks if not followed: - Unpinned URLs allow supply chain attacks if source changes maliciously. - No checksum: Tampered archives execute arbitrary code during build. - Separate layers retain artifacts inspectable in image history. - ADD remote URLs lack transparency and checksum support, enabling user-agent-based attacks. Official Docker docs explicitly recommend this pattern in multiple best practices pages (e.g., ENV example with curl | tar).

Citations:


Verify downloaded archives before extracting them.

Go, ripgrep, and fd are streamed directly from the network into tar. A compromised mirror or TLS tampering could inject arbitrary code into the image. All three tools publish SHA256 checksums: Go on https://go.dev/dl/, ripgrep as .sha256 files on the release page, and fd alongside release assets. Download to a temp file, verify the checksum, then extract and remove it.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.devcontainer/Dockerfile around lines 30 - 39, The Dockerfile currently
streams Go, ripgrep, and fd archives directly into tar (the RUN block using
ARCH/GOARCH and the filenames go1.23.6.linux-${GOARCH}.tar.gz,
ripgrep-14.1.1-${ARCH}-unknown-linux-gnu.tar.gz, and
fd-v10.2.0-${ARCH}-unknown-linux-gnu.tar.gz); change this to download each
archive to a temporary file, download the corresponding published .sha256 (or
checksum) file, verify the archive with sha256sum -c (or compute and compare),
only extract after verification, and then delete the temp files; ensure the same
RUN step uses the ARCH/GOARCH variables and preserves the exact archive
filenames so the subsequent tar commands target the verified files.


ENV PATH="/usr/local/go/bin:${PATH}"
ENV GOPATH="/home/dev/go"
ENV PATH="${GOPATH}/bin:${PATH}"

# Install Node.js (needed for Claude Code)
ARG NODE_VERSION=22
RUN curl -fsSL https://rpm.nodesource.com/setup_${NODE_VERSION}.x | bash - \
&& dnf install -y nodejs \
&& dnf clean all
Comment on lines +47 to +49
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .devcontainer/Dockerfile | head -70

Repository: stackrox/collector

Length of output: 3453


Avoid executing live installer scripts during the build.

Both the NodeSource and gcloud installs execute remote scripts fetched at build time without any integrity check. This makes the image non-reproducible and extends the supply-chain trust boundary to live network content (lines 47-49 and 55-57). Prefer pinned packages or verified release artifacts instead.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.devcontainer/Dockerfile around lines 47 - 49, The Dockerfile currently
executes remote installer scripts at build time (the RUN curl -fsSL
https://rpm.nodesource.com/setup_${NODE_VERSION}.x | bash - \ line referencing
NODE_VERSION and the similar gcloud install block), which is non-reproducible
and insecure; replace these live installer pipes with pinned, verifiable
artifacts: fetch specific Node.js rpm or tarball for the desired NODE_VERSION
(or use the official distro package with a fixed version), verify its
checksum/signature before installing, and similarly download a fixed gcloud SDK
release archive and verify signatures instead of piping to bash; update the RUN
steps (the Node setup and the gcloud install blocks) to use curl/wget to
download a pinned file, verify integrity, and install via package manager or
extraction so builds are reproducible and supply-chain risk is mitigated.


# Install Claude Code
RUN npm install -g @anthropic-ai/claude-code
Comment on lines +51 to +52
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Check the .devcontainer directory structure
ls -la .devcontainer/

Repository: stackrox/collector

Length of output: 624


🏁 Script executed:

# Read the Dockerfile to confirm the current state at lines 51-52
cat -n .devcontainer/Dockerfile | head -60

Repository: stackrox/collector

Length of output: 2895


🏁 Script executed:

# Read entrypoint.sh to check for subcommand usage
cat -n .devcontainer/entrypoint.sh

Repository: stackrox/collector

Length of output: 1028


Pin @anthropic-ai/claude-code to a tested version.

The entrypoint script relies on specific subcommands: claude config set and claude mcp add-json. An unpinned installation will pull whatever version is current at build time, risking silent breakage if a release changes these command interfaces. Pin the version and update it deliberately.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.devcontainer/Dockerfile around lines 51 - 52, The Dockerfile currently
installs Claude Code without a version, which risks breaking CLI subcommands
used by the entrypoint; update the RUN command that installs
"@anthropic-ai/claude-code" to pin it to a tested release (e.g. append
@<tested-version>) so the build always pulls the known-good CLI that supports
"claude config set" and "claude mcp add-json"; optionally document the chosen
version in a comment or build ARG so future updates are deliberate.


# Install gcloud CLI (for Vertex AI auth and GCP VM management)
RUN curl -fsSL https://sdk.cloud.google.com > /tmp/install-gcloud.sh \
&& bash /tmp/install-gcloud.sh --disable-prompts --install-dir=/opt \
&& rm /tmp/install-gcloud.sh
ENV PATH="/opt/google-cloud-sdk/bin:${PATH}"

# Create non-root dev user with passwordless sudo
RUN useradd -m -s /bin/zsh dev \
&& echo "dev ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/dev \
&& mkdir -p /home/dev/.claude/debug /home/dev/.commandhistory \
&& chown -R dev:dev /home/dev/.claude /home/dev/.commandhistory

# Install ansible for VM-based testing (optional, lightweight)
RUN pip3 install ansible-core

# Firewall script for network isolation (optional, used with --dangerously-skip-permissions)
COPY --chmod=755 init-firewall.sh /usr/local/bin/init-firewall.sh
COPY --chmod=755 entrypoint.sh /usr/local/bin/entrypoint.sh

USER dev
WORKDIR /workspace

# Persist shell history and Claude state across rebuilds (volumes in devcontainer.json)
ENV HISTFILE=/home/dev/.commandhistory/.zsh_history

ENV SHELL=/bin/zsh
ENV DEVCONTAINER=true

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
Loading
Loading