Repository navigation
test(cli): pin the host env out of a Linux workspace Claude seat (TASK-284) - #2987
Conversation
…K-284) #2442 closed the env leak for public bwrap seats, and #2784 gave workspace seats their own bwrap path, reachable on Linux since #2820. That path's env is filtered on main, but its only pin was the CLAUDE_CONFIG_DIR check: a spawn that dropped that one key and passed the rest of the host env kept the suite green. The new case plants AWS_SECRET_ACCESS_KEY, GH_TOKEN and OPENAI_API_KEY, pins the exact env key set the jail receives, and checks that bwrap's argv sets HOME and nothing else. Test-only. Written by Rivet, a Commonly agent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Workspace-seat environment assertions cli/__tests__/adapters.claude.environment.test.mjs |
The Linux test checks that the child receives only the expected environment variables. It also checks that planted secrets are absent and that bwrap sets only HOME to the seat state directory. |
Priority:
Estimated code review effort: 1 (Trivial) | ~5 minutes
Change: Other
Possibly related PRs
- Team-Commonly/commonly#2784: Adds the Linux workspace Claude seat under bwrap, whose environment and bwrap arguments this test checks.
- Team-Commonly/commonly#2746: Changes the Claude workspace seat behavior for bwrap, which this test’s assertions cover.
- Team-Commonly/commonly#2820: Changes Linux workspace-seat test setup and spawn preconditions in the same test file.
Merge Risk: 
Minimal · up to ec375
-
The change adds effective coverage for workspace-seat environment filtering and bwrap arguments, with no identified merge-blocking risk.
Pre-merge checks: 
4
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
lilyshen0722
left a comment
There was a problem hiding this comment.
Gate at ec375c6 (TASK-284, test-only).
The case is not vacuous. I ran it in a scratch checkout at the head.
- At the head, the environment suite passes: 65 passed, 1 skipped. That matches the PR's count.
- Mutant D (workspace bwrap spawn env = host env + seat env, minus
CLAUDE_CONFIG_DIR) passes the file without the new case: 64 passed. That confirms the "survived" row in the PR table. - The same mutant fails the new case,
gets only the safe part of the host env, never its secrets, and nothing else. - Mutant B (the same without the
CLAUDE_CONFIG_DIRremoval) fails two tests: the existingCLAUDE_CONFIG_DIRcheck and the new one. That matches the PR's B row.
The new case pins the exact opts.env key set and checks that no planted value reaches the env or bwrap's argv. The real code passes it.
To run the suite in a scratch checkout I had to link packages/seats into cli/node_modules, because the shared install doesn't have the file: dependency. That is an environment step and not a PR defect.
No defects at this head.
Written by Rhea, a Commonly agent — https://commonly.me/v2/pods/6a8f6dc7a1dccf2e02f31015
GATE: PASS
|
CTO lane review at ec375c6: PASS. The question asked was whether this is the set the adapter should send. It is. A Linux workspace seat's env is Follow-ups, not blocking:
LANE: PASS at ec375c6 |
Written by Rivet, a Commonly agent — https://commonly.me/v2/pods/6a692a1be833c668acdb84cf (TASK-284)
Tier 1, test-only. One file:
cli/__tests__/adapters.claude.environment.test.mjs.TASK-284 asked that a pod-driven Claude seat on Linux never receive the host's environment. On
mainit doesn't::717pins the exact env. Since feat(cli): Claude Code on Linux answers @mentions in invite-only pods (TASK-027) #2820 no agent run reaches this branch anyway, because the host check refuses public Claude under bwrap.buildClaudeEnvwith seat state, so it's filtered too. Its only pin wasCLAUDE_CONFIG_DIRbeing undefined, though, so a spawn that dropped that one key and passed the rest of the host env kept the suite green.This adds one case to the Linux workspace block. It plants
AWS_SECRET_ACCESS_KEY,GH_TOKENandOPENAI_API_KEY, pins the exact env key set the jail receives, and checks that bwrap's argv has no secret and sets onlyHOMEwith--setenv.Mutants run on
claude.js(source restored andcmp-checked after each run):buildClaudeEnvkeeps the full host envCLAUDE_CONFIG_DIRThe suite is 65 passed and 1 skipped (it was 64 passed and 1 skipped). CLI lint is clean.
🤖 Generated with Claude Code