From c4720ba186ec986e1b018f8717e8cd3c293075b0 Mon Sep 17 00:00:00 2001 From: Marius Ciepluch <11855163+norandom@users.noreply.github.com> Date: Tue, 24 Nov 2026 20:16:23 +0100 Subject: [PATCH] test(search-with-proof): skip by cause where the host refuses the browser sandbox, a private network namespace or node GitHub CI's checks job failed nine search tests on the ubuntu-26.04 runner (run 45352669096), which has chromium and bubblewrap. Three causes: - chromium prints "No usable sandbox!" inside the bubblewrap user namespace and does not exit. The browser test skips on that evidence in the launch error's cause, as it already did on "Operation not permitted" and "Permission denied"; an ordinary browser failure still fails. - `unshare --user --map-root-user --net` is refused ("write failed /proc/self/uid_map: Operation not permitted"). The ssrf differential and the namespace handoff test probe that command first and skip when it fails. The other three differential families do not need it. - The six node fixture tests could not run their app on the runner. They need /usr/bin/node, the path the demo launcher uses, and now skip when it is not executable. The runner's log does not name the missing path; hiding it locally reproduces the same six failures. A present but broken node, or a browser that fails for its own reasons, remains a failure. --- tests/test_search_browser.py | 8 ++++++-- tests/test_search_verify.py | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/tests/test_search_browser.py b/tests/test_search_browser.py index 82a0c616..f1dc349e 100644 --- a/tests/test_search_browser.py +++ b/tests/test_search_browser.py @@ -26,8 +26,12 @@ def test_real_browser_executes_not_reflects(): except OSError as exc: # A present binary is insufficient on restricted hosts. Only known # host permission denials skip; ordinary browser failures remain failures. - if "Operation not permitted" in str(exc) or "Permission denied" in str(exc): - pytest.skip("host denies browser isolation/socket setup: " + str(exc)) + # oracles.py raises a fixed message `from` the launch error: the cause carries the evidence. + cause = exc.__cause__ or exc + evidence = " ".join(str(part) for part in (cause, getattr(cause, "stderr", None))) + denied = next((text for text in ("No usable sandbox", "Operation not permitted", "Permission denied") if text in evidence), None) + if denied: + pytest.skip("host denies browser isolation/socket setup: " + denied) raise assert observed assert not browser(html.escape(payload), "nonce") diff --git a/tests/test_search_verify.py b/tests/test_search_verify.py index 9aecebc9..b3e49865 100644 --- a/tests/test_search_verify.py +++ b/tests/test_search_verify.py @@ -1,6 +1,7 @@ """Schema-only verification, owned observations and adversarial public inputs.""" import json +import os import socket import pytest @@ -23,10 +24,29 @@ def edit(demo, change): path.write_text(json.dumps(value)) +def skip_without_private_netns(): + """The SSRF oracle's private loopback is `unshare --user --map-root-user --net` (oracles.py:151).""" + import subprocess + + command = [ + "/usr/bin/unshare", + *([] if _sandbox.isolation_mode() == "root-no-userns" else ["--user", "--map-root-user"]), + "--net", + "/bin/true", + ] + try: + probe = subprocess.run(command, capture_output=True, text=True, timeout=10) + except (OSError, subprocess.SubprocessError) as exc: + pytest.skip("private network namespace unavailable: " + type(exc).__name__) + if probe.returncode: + pytest.skip("host refuses the private network namespace: " + probe.stderr.strip()[-200:]) + + @pytest.mark.parametrize("family", ["path", "sql", "command", "ssrf"]) @pytest.mark.sandbox def test_real_differential(tmp_path, family): if family == "ssrf": + skip_without_private_netns() try: with socket.socket(): pass @@ -242,6 +262,7 @@ HTTPServer(('127.0.0.1', 18765), Handler).serve_forever() @pytest.mark.sandbox def test_private_namespace_handoff_without_sockets(tmp_path): + skip_without_private_netns() import subprocess from openultrasast.sandbox import SandboxJob @@ -717,6 +738,7 @@ def test_http_driver_polls_eight_second_listener_before_get_and_steps(tmp_path, @pytest.mark.parametrize("task_boundary", [False, True]) @pytest.mark.parametrize("config", ["arguments", "environment", "files"]) +@pytest.mark.skipif(not os.access("/usr/bin/node", os.X_OK), reason="node runtime /usr/bin/node is not installed") @pytest.mark.sandbox def test_node_directory_option_uses_owned_fixture(pair, config, task_boundary): sides, demo = pair