test_a_newline_in_a_path_cannot_inject_a_directive

Tests › tests/test_doxyfile_injection.py

passed Passed in the packaged run.

What this test is for

Why it exists

A newline in a file name must not become a Doxyfile directive.

Verifies REQ-DDB-PIPE-014

Given

  1. doxyfile = tmp_path / "Doxyfile"
  2. doxyfile.write_text("PROJECT_NAME = probe\nINPUT = .\n", encoding="utf-8")
  3. hostile = "/repo/a.c\nINPUT_FILTER = /bin/sh -c 'pwn' #"
→

When

  1. text = _build_doxyfile_content(doxyfile, [hostile], None, True, tmp_path, "")
  2. for directive in ("INPUT_FILTER", "FILTER_PATTERNS"): for value in _assignments(text, directive): assert not value, ( f"a file name injected a non-empty {directive} = {value!r}; doxygen runs that " f"as a command over every input file, so indexing a hostile repo executes it" )
  3. for value in _assignments(text, "FILTER_SOURCE_FILES"): assert value.upper() in ("", "NO"), ( f"a file name set FILTER_SOURCE_FILES = {value!r}, re-enabling filtering" )
→

Then

  1. ✓ text does not contain "/bin/sh"

tests/test_doxyfile_injection.py:76 · its file's page

What it checks (3)

  1. assert not value, ( f"a file name injected a non-empty {directive} = {value!r}; doxygen runs that " f"as a command over every input file, so indexing a hostile repo executes it" ) not attributed
  2. assert value.upper() in ("", "NO"), ( f"a file name set FILTER_SOURCE_FILES = {value!r}, re-enabling filtering" ) not attributed
  3. assert "/bin/sh" not in text, "the injected command survived into the rendered configuration" observes _build_doxyfile_content via text

Where the product reaches it

No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.

Call flow

test_a_newline_in_a_path_cannot_inject_a_directive→_build_doxyfile_content→_assignments

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.

test_a_newline_in_a_path_cannot_inject_a_directive · 3 checks_build_doxyfile_contentREQ-DDB-INDEX-001 · measured_build_doxyfile_contentextra_input_clears_excludeREQ-DDB-PIPE-003 · measured

Requirements it verifies (1)

requirementlinked byimplementers exercised
REQ-DDB-PIPE-014catalogunknown
Also reaches 2 requirements

Its run touches their code; that is reach, not proof.