test_a_targets_own_git_config_cannot_run_commands¶
Tests › tests/test_gitenv.py
What this test is for
Why it exists
THE SHORTEST EXECUTION PATH IN THE PRODUCT, found by an adversarial audit of the 1.1.0 branch and reproduced twice under git 2.34.1. `core.fsmonitor` is executed by git on `ls-files`, so every one of this package's git queries runs code chosen by the tree it was pointed at — during an index build AND during the pre-commit gate. `gitenv` already strips the variables a hook exports; this is the orthogonal channel, config INSIDE the tree, which no environment scrub can reach.
Verifies REQ-DDB-PIPE-014
Given
sentinel = tmp_path / "pwned"root = _hostile_config_repo(tmp_path / "hostile", sentinel)
When
scope.whole_repo_scope(root)
Then
- ✓ sentinel.exists() is false
What it exercises
The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.
thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 20 of 142 steps
… 114 later steps
4 more
- Build, refresh and check the index · 20 of 153 steps
- clew — `main` (clew/cli.py) · 20 of 400 steps
- Build this wiki from the index · 2 of 400 steps
- `main` (clew/guard/main.py) · 2 of 357 steps
tests/test_gitenv.py:182 · its file's page
What it checks (1)
assert not sentinel.exists(), ( "the target repository's own .git/config executed a command during scope " "derivation — cloning a repo and indexing it is arbitrary code execution" )not attributed
Where the product reaches it
main→propose_main→propose→build_context→derive_scope→whole_repo_scope(flow)
Call flow
What it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Requirements it verifies (1)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-PIPE-014 | catalog | unknown |
Also reaches 1 requirement
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-001 measured