test_hostile_event_content_is_not_echoed

Tests › tests/test_hook.py

passed Passed in the packaged run.

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

  1. out = ""
  2. 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.stdout
  3. for 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

  1. —
→

Then

  1. ✓ out holds

tests/test_hook.py:366 · its file's page

What it checks (4)

  1. assert result.returncode == 0 observes _run via result
  2. assert not result.stderr.strip(), f"stderr reaches the model: {result.stderr[:200]}" observes _run via result
  3. assert 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 attributed
  4. assert needle not in out, f"event content {needle!r} reached the output" not attributed

Where the product reaches it

Call flow

test_hostile_event_content_is_not_echoed→_run

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)

requirementlinked byimplementers exercised
REQ-DDB-WIKI-054catalogunknown