Greptile found three ways a generated setup could still place an
executable hook in the sandbox repository, which a later accepted
`git commit` then runs on the host:
- git init --template=<dir> (any unvetted git option)
- option values attached to the flag: cp --target-directory=.git,
cp -t.git, tar --directory=.git
- archive members: tar -xf / unzip of an archive holding
.git/hooks/pre-commit
Fixes:
- allowlist options per git subcommand; --template, --separate-git-dir,
-c, --exec-path and the rest are refused
- treat every suffix of an option argument as a possible attached value
and apply the in-sandbox / no-.git path check to it
- before tar -x or unzip, open every existing file argument with
tarfile/zipfile and refuse unknown formats, links, special files and
members that are absolute, contain .., or have a .git component;
refuse unzip wildcards and run setup with stdin=/dev/null
- run setup git commands with -c core.hooksPath=/dev/null as defense
in depth
Each sequence has a real-execution test in tests/test_invariant_runner.py
that fails on the previous head and passes now.
Signed-off-by: Wen <jwcastillo@gmail.com>
setup_commands are YAML from `claude -p`, generated from the skill under
test, and run on the host. The executable allowlist (cf59d0d28) passed
any arguments to the allowed tools, so several of them still ran
arbitrary code or reached outside the sandbox:
git -c 'alias.x=!sh ...' x, git config core.* / alias.*
tar --to-command, --checkpoint-action, --use-compress-program, -I
npm/pip install with lifecycle scripts or setup.py, npm exec/run
cp ~/.ssh/id_ed25519 ., mv src /elsewhere, cp x .git/hooks/...
Keep every allowed tool but limit it to file-creating uses:
- git: subcommand first (no -c/-C/--config-env), a short subcommand
allowlist, and `git config` only for user.name/user.email/
init.defaultBranch/commit.gpgsign
- tar: allowlisted flags and long options only, no host:file archives
- npm: `init -y`, or install/ci of registry names with --ignore-scripts
- pip: install of registry names, wheels only, into <sandbox>/.pip-packages
- every path argument must resolve inside the sandbox and outside its .git
The sandbox base moves from the shared /tmp/skill-comply-sandbox to a
per-user <tempdir>/skill-comply-sandbox-<uid>, created 0700, and is
rejected when another user owns it. The scenario prompt now asks for
sandbox-relative paths instead of the old absolute base.
Signed-off-by: Wen <jwcastillo@gmail.com>
* ci: add ruff + mypy to the Python CI job and fix pyproject tool config
The python-tests job runs pytest but not lint/type checks, and the ruff
and mypy configuration in pyproject.toml was silently broken, so neither
tool could run at all.
- add ruff and mypy steps to the existing python-tests job
- fix invalid pyproject keys: [tool.ruff] src-path -> src,
[tool.mypy] src_paths -> mypy_path
- ignore ruff UP042 (the (str, Enum) mixin is intentional)
- resolve ruff findings (unused/unsorted imports) across src and tests
- fix mypy errors in tools/executor.py and prompt/builder.py
* fix(ci): satisfy Python lint after main refresh
---------
Co-authored-by: haelyra <49814733+haelyra@users.noreply.github.com>
* fix: V-001 security vulnerability
Automated security fix generated by OrbisAI Security
* fix: sanitize subprocess call in runner.py
The runner
* fix: address PR review comments on V-001 allowlist and test coverage
Remove dangerous interpreters (python, python3, node, curl, wget) from
ALLOWED_SETUP_EXECUTABLES — they can execute arbitrary code via argument
flags and are not needed for sandbox setup. Rewrite test_invariant_runner
to call _setup_sandbox directly instead of spawning runner.py as a
subprocess (which had no __main__ entrypoint and never exercised the fix).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>