Repository navigation
feat(harness): workspace-cwd bash — run tests/builds in the folder (P1.5) - #103
Merged
Merged
Conversation
Let a workspace-attached agent run build/test runners in the attached folder (cwd=workspace_root) via a curated allowlist + inline-eval guard, still behind the mode gate + catastrophic breaker. Stacked on feat/harness (PR #102). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5 TDD tasks: config+constants, root-parameterized arg-jail, run_bash workspace mode (cwd=root, runner allowlist, inline-eval guard), agent wiring, adversarial verify + docs. Stacked on feat/harness (PR #102). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nline-eval guard)
…PL, missing root)
The interpreter-front / bare-REPL / missing-root fixes moved into the Task 3 review pass (060271f); Task 5 becomes final adversarial-confirm + docs incl. SECURITY.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…h jail, env leak)
…TY/spec Adversarially verified across 4 hardening rounds: attached inline-eval, node -p/--print, value-fronted eval (-m boundary rule), --flag=path arg-jail, bare REPL, DoS/timeout, and secret-env stripping. README/SECURITY/spec mark it shipped; the P1 as-built "bash cwd is NOT the workspace" bullet is updated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 25, 2026
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.
Workspace-cwd bash — Harness P1.5 fast-follow
Completes the harness coding loop: when a chat is attached to a code workspace,
bashnow runs build/test runners in the attached folder (cwd=workspace_root), not just the read-onlySANDBOX_ROOT. Follow-up to #102 (Harness P1), which noted this as a deliberate deferral. Spec/plan:docs/superpowers/specs/2026-07-21-workspace-cwd-bash-design.md.What changed
Two existing layers, one touched —
integrations.run_bashgains keyword-onlyroot/allow/timeout(all defaulting to today's behaviour, so non-workspace bash is byte-for-byte unchanged); the agent'sbashdispatch passes the workspace params when awscontext is present. The permission decision layer (rules.gate) is untouched: runners stay out ofSAFE_BASH, so they prompt indefault/acceptEditsunless rule-allowed, and the catastrophic-bash breaker still hard-deniesrm -rf /-class in every mode.WORKSPACE_BASH_ALLOW):pytest,npm/pnpm/yarn,node,python,go,cargo,make,tsc,ruff,mypy,eslint,jest,vitest,git,tox,poetry,uv.find/npx/envdeliberately excluded.-c/-e/-p/--eval/--print/stdin-are blocked in every form (spaced, attached-cCODE,=-joined--eval=CODE, and value-frontednode --require x.js -e …), and bare REPLs are blocked — via an-m-boundary rule (an eval flag counts only before any-m, sopython -m pytest -c cfg— pytest's own-c— is correctly allowed).--flag=<path>values (closesgit --git-dir=<outside>).OCD_API_TOKEN,*_KEY,*_TOKEN, provider keys) so a workspace script can't read them.&& | ; > < .. $()), 120s timeout (OCD_WORKSPACE_BASH_TIMEOUT_SEC), output cap, secret scrub — all retained.Safety
Host execution behind the mode gate + jail + breaker (P1's local-first posture) — not a sandbox; the P4 container runner remains the answer for untrusted repos.
pytest/npm/makerun the project's own scripts (semi-trusted, the user's repo), which is why they prompt by default.Adversarially verified (a fresh subagent tried to defeat the guard): attached/joined inline-eval, node
-p/--print, value-fronted eval,--flag=patharg-jail, symlink/junction jail, DoS/timeout, metacharacter smuggling, missing/rogue root, PATH-hijack, and secret-env exfiltration. Four hardening rounds closed every escape found; the-m-boundary rule is closed-form (no enumerable flag list to fall behind on).Testing
25 tests in
test_bash_jail.py(+ the agent-wiring test) — the pre-existingtest_run_bash_still_allows_safe_relativefails only on Windows (no standaloneechobinary), green on Linux CI. Non-workspace bash, HITL, and permission suites unchanged. Full-reporuffclean.🤖 Generated with Claude Code