refactor(gateway): remove the single-tenant data-plane paths (audit #400 finding 3) #402

Merged
didericis merged 4 commits from refactor/remove-single-tenant-data-plane into main 2026-07-17 22:56:48 -04:00
Showing only changes of commit d0b7de119f - Show all commits
+17
View File
@@ -42,6 +42,11 @@ def _run_entrypoint(env: dict[str, str]) -> str:
shim.chmod(0o755) shim.chmod(0o755)
run_env = { run_env = {
"PATH": f"{shim_dir}:{os.environ['PATH']}", "PATH": f"{shim_dir}:{os.environ['PATH']}",
# Resolver-only egress (PRD 0070): the entrypoint fails closed
# without an orchestrator URL, so it's a precondition for reaching
# the argv construction these tests assert on. Individual tests may
# override it (e.g. to exercise the fail-closed guard).
"BOT_BOTTLE_ORCHESTRATOR_URL": "http://orchestrator:9000",
# cat needs to find ca-certificates.crt for the # cat needs to find ca-certificates.crt for the
# trust-bundle branch; we don't test that path here. # trust-bundle branch; we don't test that path here.
**env, **env,
@@ -93,6 +98,18 @@ class TestEgressEntrypointArgv(unittest.TestCase):
argv = _run_entrypoint({}) argv = _run_entrypoint({})
self.assertIn("-s\n/app/egress_addon.py", argv) self.assertIn("-s\n/app/egress_addon.py", argv)
def test_missing_orchestrator_url_fails_closed(self):
# Resolver-only egress (PRD 0070): with no policy source the entrypoint
# must refuse to launch mitmdump rather than come up as a bare
# TLS-bumping open proxy. Exits nonzero before any argv is emitted.
result = subprocess.run(
["sh", str(_SCRIPT)],
capture_output=True, text=True, check=False,
env={"PATH": os.environ["PATH"], "BOT_BOTTLE_ORCHESTRATOR_URL": ""},
)
self.assertNotEqual(0, result.returncode)
self.assertIn("BOT_BOTTLE_ORCHESTRATOR_URL is required", result.stderr)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()