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.
This commit is contained in:
Marius Ciepluch
2026-11-24 20:16:23 +01:00
parent 02493bd6b7
commit c4720ba186
2 changed files with 28 additions and 2 deletions
+6 -2
View File
@@ -26,8 +26,12 @@ def test_real_browser_executes_not_reflects():
except OSError as exc: except OSError as exc:
# A present binary is insufficient on restricted hosts. Only known # A present binary is insufficient on restricted hosts. Only known
# host permission denials skip; ordinary browser failures remain failures. # host permission denials skip; ordinary browser failures remain failures.
if "Operation not permitted" in str(exc) or "Permission denied" in str(exc): # oracles.py raises a fixed message `from` the launch error: the cause carries the evidence.
pytest.skip("host denies browser isolation/socket setup: " + str(exc)) 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 raise
assert observed assert observed
assert not browser(html.escape(payload), "nonce") assert not browser(html.escape(payload), "nonce")
+22
View File
@@ -1,6 +1,7 @@
"""Schema-only verification, owned observations and adversarial public inputs.""" """Schema-only verification, owned observations and adversarial public inputs."""
import json import json
import os
import socket import socket
import pytest import pytest
@@ -23,10 +24,29 @@ def edit(demo, change):
path.write_text(json.dumps(value)) 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.parametrize("family", ["path", "sql", "command", "ssrf"])
@pytest.mark.sandbox @pytest.mark.sandbox
def test_real_differential(tmp_path, family): def test_real_differential(tmp_path, family):
if family == "ssrf": if family == "ssrf":
skip_without_private_netns()
try: try:
with socket.socket(): with socket.socket():
pass pass
@@ -242,6 +262,7 @@ HTTPServer(('127.0.0.1', 18765), Handler).serve_forever()
@pytest.mark.sandbox @pytest.mark.sandbox
def test_private_namespace_handoff_without_sockets(tmp_path): def test_private_namespace_handoff_without_sockets(tmp_path):
skip_without_private_netns()
import subprocess import subprocess
from openultrasast.sandbox import SandboxJob 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("task_boundary", [False, True])
@pytest.mark.parametrize("config", ["arguments", "environment", "files"]) @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 @pytest.mark.sandbox
def test_node_directory_option_uses_owned_fixture(pair, config, task_boundary): def test_node_directory_option_uses_owned_fixture(pair, config, task_boundary):
sides, demo = pair sides, demo = pair