test_a_kconfig_sourcing_outside_the_repository_is_refused

Tests › tests/test_kconfig.py

passed Passed in the packaged run.

What this test is for

Why it exists

M2, 1.1.0 SECURITY AUDIT — and wider than the finding as written. kconfiglib resolves `source` against `$srctree`, and NOTHING constrained it: `source "/abs/path"` parsed a file anywhere on the machine and served its symbols, prompts and help text as this repository's configuration space. Measured against kconfiglib 14.1.

Verifies REQ-DDB-PIPE-007 REQ-DDB-QUERY-006

Given

  1. outside = tmp_path / "outside.Kconfig"
  2. outside.write_text( 'config SENTINEL_OUTSIDE\n\tbool "leaked prompt"\n\thelp\n\t SECRET-SOURCED-HELP\n', encoding="utf-8", )
3 more
  1. repo = tmp_path / "repo"
  2. repo.mkdir()
  3. (repo / KCONFIG_NAME).write_text( f'source "{outside}"\nconfig OWN\n\tbool "own"\n', encoding="utf-8" )
→

When

  1. model = load_kconfig(discover_kconfig(repo, {}), repo)
  2. served = " ".join(f"{s.name} {s.prompt} {s.help}" for s in model.symbols) + model.error
→

Then

  1. ✓ served does not contain "SECRET-SOURCED-HELP"
  2. ✓ served does not contain "SENTINEL_OUTSIDE"
  3. ✓ model.error holds
  4. ✓ model.symbols is false

tests/test_kconfig.py:1319 · its file's page

What it checks (4)

  1. assert "SECRET-SOURCED-HELP" not in served, f"outside help text was served: {served}" not attributed
  2. assert "SENTINEL_OUTSIDE" not in served, f"an outside symbol was served: {served}" not attributed
  3. assert model.error, "the refusal must be recorded, not left as an empty configuration space" observes load_kconfig via model
  4. assert not model.symbols observes load_kconfig via model

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_kconfig_sourcing_outside_the_repository_is_refused→load_kconfig→discover_kconfig

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_kconfig_sourcing_outside_the_repository_is_refused · 4 checksdiscover_kconfigREQ-DDB-CONFIG-005 · measuredload_kconfig_served_parse_errorREQ-DDB-PIPE-014 · measured

Requirements it verifies (2)

requirementlinked byimplementers exercised
REQ-DDB-PIPE-007catalogunknown
REQ-DDB-QUERY-006catalogunknown
Also reaches 2 requirements

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