test_hostile_event_content_is_not_echoed¶
Tests › tests/test_hook.py
What this test is for
Why it exists
The behavioural half of the structural test above. It cannot prove the absence of a channel, but it can prove the obvious one is shut, and it fails loudly if somebody later wires the event through.
Verifies REQ-DDB-WIKI-054
Given
out = ""for _ in range(hook._LOUD_AT + hook._LOUD_INTERVAL): result = _run(HOSTILE_EVENT, tmp_path, {"CLAUDE_CODE_SESSION_ID": "hostile"}) assert result.returncode == 0 assert not result.stderr.strip(), f"stderr reaches the model: {result.stderr[:200]}" out = out or "" if result.stdout: out = result.stdoutfor needle in ( "IGNORE ALL PREVIOUS", "attacker.example", "etc/passwd", "whoami", "SYSTEM: obey", "~/.ssh", "Grep", "tool_name", "file_path", ): assert needle not in out, f"event content {needle!r} reached the output"
When
- —
Then
- ✓ out holds
tests/test_hook.py:366 · its file's page
What it checks (4)
assert result.returncode == 0observes_runviaresultassert not result.stderr.strip(), f"stderr reaches the model: {result.stderr[:200]}"observes_runviaresultassert out, ( "the probe never reached a speaking tier, so the needle checks below would pass against " "an empty string — this is the vacuity that made the 1.0.9 version of this test useless" )not attributedassert needle not in out, f"event content {needle!r} reached the output"not attributed
Where the product reaches it
main→_run(flow)
Call flow
test_hostile_event_content_is_not_echoed→_runWhat 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-WIKI-054 | catalog | unknown |