fix(backends): default supports_mount_free to not supports_bind_mounts for fail-closed safety

This commit is contained in:
Manideep Malyala 2026-08-23 23:27:34 +05:30
parent 3774c2eefd
commit 4206df8d81

View file

@ -81,16 +81,17 @@ def register_backend(
backend: SandboxBackend,
*,
supports_bind_mounts: bool = False,
supports_mount_free: bool = True,
supports_mount_free: bool | None = None,
) -> None:
"""Register a custom backend under ``name``.
Intended for downstream users who ship their own runtime register
before any ``session_manager.create_or_reuse`` call. Re-registering
an existing name overwrites the prior entry. ``supports_bind_mounts``
defaults to False: a remote runtime cannot see the caller's filesystem, so
it is handed local sources as manifest entries to upload instead.
an existing name overwrites the prior entry. Remote backends without bind
mounts default to mount-free support, while bind-mount backends must explicitly opt in.
"""
if supports_mount_free is None:
supports_mount_free = not supports_bind_mounts
_BACKENDS[name] = backend
if supports_bind_mounts:
_BIND_MOUNT_BACKENDS.add(name)