Repository navigation
Description
Context
src/ether/gateway/preflight.py:473 (PreflightVerifier._check_binary) calls ContainerizedToolRunner.get_image() when ETHER_CONTAINER_FALLBACK=1 is enabled and a host binary is missing, without catching ValueError.
Meanwhile, src/ether/core/container.py:17 defines ContainerizedToolRunner.DEFAULT_IMAGE = "ghcr.io/ether/arsenal:0.1.3" (an unpinned tag), while ContainerizedToolRunner.get_image() (src/ether/core/container.py:40-43) raises ValueError unless @sha256: is present in the image reference or ETHER_CONTAINER_ALLOW_MUTABLE_TAG=1 is set. As a result, enabling ETHER_CONTAINER_FALLBACK=1 without overriding ETHER_CONTAINER_IMAGE (or passing an unpinned tag) causes PreflightVerifier.verify() (and callers such as CLI run and MCP execute_tool) to crash with an unhandled ValueError instead of returning a structured preflight error.
Existing coverage in tests/unit/test_container_runner.py:97 masks this by overriding ETHER_CONTAINER_IMAGE with a @sha256: digest.
Proof
Reproduced under the default GatePolicy.SAFE policy at origin/dev@0c0e3c1 with ETHER_CONTAINER_FALLBACK=1 and default DEFAULT_IMAGE:
env -u ETHER_CONTAINER_IMAGE -u ETHER_CONTAINER_ALLOW_MUTABLE_TAG ETHER_CONTAINER_FALLBACK=1 \
PYTHONPATH=/tmp/ether-audit-A/src /home/harsh/Documents/ether/.venv/bin/python3 -c '
from unittest.mock import patch
from ether.gateway.gate import GatePolicy
from ether.gateway.preflight import PreflightVerifier
from ether.registry.registry import ToolRegistry
class FakeAdapter:
name = "mock_missing"
binary = "mock_missing"
execution_tier = "subprocess"
def validate_install(self): return False
def build_command(self, target, params): return ["mock_missing", target]
reg = ToolRegistry(tools_dir=None)
reg.tools["mock_missing"] = {"adapter": FakeAdapter(), "manifest": None}
verifier = PreflightVerifier(registry=reg, policy=GatePolicy.SAFE)
with patch("shutil.which", side_effect=lambda n: "/usr/bin/podman" if n == "podman" else None):
verifier.verify("mock_missing", target="192.0.2.10")
'Observed output:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/ether-audit-A/src/ether/gateway/preflight.py", line 297, in verify
self._check_binary(clean_tool, report)
File "/tmp/ether-audit-A/src/ether/gateway/preflight.py", line 473, in _check_binary
f"using OCI image '{ContainerizedToolRunner.get_image()}'."
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/ether-audit-A/src/ether/core/container.py", line 41, in get_image
raise ValueError(
ValueError: Container image 'ghcr.io/ether/arsenal:0.1.3' must be digest-pinned (@sha256:...) unless ETHER_CONTAINER_ALLOW_MUTABLE_TAG=1.
Impact
Affects GatePolicy.SAFE (default) whenever ETHER_CONTAINER_FALLBACK=1 is enabled without a digest-pinned ETHER_CONTAINER_IMAGE override and an external tool binary is missing from host PATH. Instead of returning a structured preflight failure, PreflightVerifier.verify() raises an uncaught ValueError. Workaround exists by explicitly setting ETHER_CONTAINER_IMAGE=<image>@sha256:... or ETHER_CONTAINER_ALLOW_MUTABLE_TAG=1.
Acceptance criteria
- Catch
ValueErrorfromContainerizedToolRunner.get_image()inPreflightVerifier._check_binary(src/ether/gateway/preflight.py:473) and record aseverity="error"PreflightIssuewith remediation guidance - Pin
ContainerizedToolRunner.DEFAULT_IMAGE(src/ether/core/container.py:17) to a@sha256:digest (or align it with the digest-pinning contract) - Add a regression test in
tests/unit/test_container_runner.pyexercisingPreflightVerifier.verify()with an unpinned container image and noETHER_CONTAINER_IMAGEoverride
Out of scope
Building or publishing the ghcr.io/ether/arsenal OCI image itself, or relaxing get_image() digest-pinning enforcement.
Part of #27
Related to #52
audit:self · run 2026-12-02 · ref origin/dev@0c0e3c1 · cell signal×supply
Activity