text
stringlengths
0
252
run = run_isolated_python(
probe_source,
{
"request": json.dumps(
{
"paths": expected_paths,
"egress": EGRESS_PROBE_TARGETS,
}
).encode(),
},
["{input:request}"],
timeout_seconds=15,
)
try:
evidence = {
"status": "failed",
"runtime_user": identity.name,
"uid": identity.uid,
"returncode": run.completed.returncode,
"stdout": run.completed.stdout,
"stderr": run.completed.stderr,
}
failure: str | None = None
try:
results = json.loads(run.completed.stdout)
except json.JSONDecodeError as error:
results = None
failure = f"invalid JSON stdout: {error}"
else:
if isinstance(results, dict):
evidence["execution_euid"] = results.get("euid")
evidence["paths"] = results.get("paths")
evidence["egress"] = results.get("egress")
if run.completed.returncode != 0:
failure = f"probe subprocess returned {run.completed.returncode}"
elif not isinstance(results, dict) or set(results) != {"euid", "paths", "egress"}:
failure = "probe JSON must contain only euid, paths, and egress"
elif results["euid"] != identity.uid:
failure = f"probe ran as UID {results['euid']}, expected runner UID {identity.uid}"
elif not isinstance(results["paths"], dict) or set(results["paths"]) != set(expected_paths):
failure = "probe JSON path set did not match the request"
elif not isinstance(results["egress"], dict) or set(results["egress"]) != set(expected_egress):
failure = "probe JSON egress set did not match the request"
else:
for path in expected_paths:
item = results["paths"][path]
if (
not isinstance(item, dict)
or set(item) != {"readable", "error"}
or item["readable"] is not False
or item["error"] != "PermissionError"
):
failure = f"{path} was not denied with PermissionError"
break
if failure is None:
for endpoint in expected_egress:
item = results["egress"][endpoint]
if (
not isinstance(item, dict)
or set(item) != {"connected", "error", "errno"}
or item["connected"] is not False
or not isinstance(item["error"], str)
or not item["error"]
):
failure = f"{endpoint} was not blocked for UID {identity.uid}"
break
if failure is None:
evidence["status"] = "denied"
else:
evidence["failure"] = failure
evidence_path.write_text(
json.dumps(evidence, indent=2, sort_keys=True) + "\n",
encoding="utf-8",
)
> assert failure is None, (
^^^^^^^^^^^^^^^
f"Isolation probe failed closed: {failure}; returncode={run.completed.returncode}; stderr={run.completed.stderr!r}"
)
E AssertionError: Isolation probe failed closed: probe subprocess returned 91; returncode=91; stderr=''
submission_isolation.py:368: AssertionError
==================================== PASSES ====================================
=========================== short test summary info ============================
PASSED test_outputs.py::test_isolated_runner_uses_read_only_staging_and_drops_privileges
PASSED test_outputs.py::test_nominal_fields_and_fourier_spectra_match_independent_recomputation
PASSED test_outputs.py::test_nominal_components_obey_normalization_formula_and_fft_conventions
FAILED test_outputs.py::test_nominal_artifacts_solver_and_declared_schema - A...
FAILED test_outputs.py::test_nominal_plane_wave_table_and_residual_summary_are_correct
FAILED test_outputs.py::test_submitted_solver_generalizes_to_hidden_crop_and_alternate_configuration
========================= 3 failed, 3 passed in 24.13s =========================
============================= test session starts ==============================
platform linux -- Python 3.12.11, pytest-8.4.1, pluggy-1.6.0 -- /usr/local/bin/python3
rootdir: /verifier
collecting ... collected 6 items
test_outputs.py::test_isolated_runner_uses_read_only_staging_and_drops_privileges PASSED [ 16%]
test_outputs.py::test_nominal_artifacts_solver_and_declared_schema PASSED [ 33%]
test_outputs.py::test_nominal_fields_and_fourier_spectra_match_independent_recomputation FAILED [ 50%]
test_outputs.py::test_nominal_plane_wave_table_and_residual_summary_are_correct FAILED [ 66%]
test_outputs.py::test_nominal_components_obey_normalization_formula_and_fft_conventions PASSED [ 83%]