Secure, Fast, and Extensible Sandbox runtime for AI agents.
fix(execd): correct files-API scope wording and root-view path stripping
高然bb54555ba2c7
diff --git a/components/execd/pkg/isolation/merged_view.go b/components/execd/pkg/isolation/merged_view.goindex 281c7ef43..a2f5d7de7 100644--- a/components/execd/pkg/isolation/merged_view.go+++ b/components/execd/pkg/isolation/merged_view.go@@ -83,6 +83,10 @@ func (m *MergedView) safePath(path string) (string, error) {if cleaned == m.LowerDir {return ".", nil}+ if m.LowerDir == "/" {+ // No cleaned path starts with "//"; strip the single root slash.+ return strings.TrimPrefix(cleaned, "/"), nil+ }return strings.TrimPrefix(cleaned, m.LowerDir+"/"), nil}if strings.HasPrefix(cleaned, "..") {diff --git a/components/execd/pkg/isolation/merged_view_test.go b/components/execd/pkg/isolation/merged_view_test.goindex a3fd19a4b..b998ef1cb 100644--- a/components/execd/pkg/isolation/merged_view_test.go+++ b/components/execd/pkg/isolation/merged_view_test.go@@ -333,6 +333,15 @@ func TestMergedView_RootLowerServesAllAbsolutePaths(t *testing.T) {_, statErr := mv.Stat("/definitely-not-a-real-path-87953550")assert.False(t, errors.Is(statErr, ErrPathOutsideOverlays), "root view must not reject absolute paths")assert.True(t, os.IsNotExist(statErr))++ // The returned path is workspace-relative, including for the root view.+ rel, err := mv.safePath("/etc/passwd")+ require.NoError(t, err)+ assert.Equal(t, "etc/passwd", rel)++ rel, err = mv.safePath("/")+ require.NoError(t, err)+ assert.Equal(t, ".", rel)}func TestMergedView_EmptyLowerRejectsAbsolutePaths(t *testing.T) {diff --git a/sdks/sandbox/javascript/src/api/execd.ts b/sdks/sandbox/javascript/src/api/execd.tsindex 29e12d6b0..a67642bc3 100644--- a/sdks/sandbox/javascript/src/api/execd.ts+++ b/sdks/sandbox/javascript/src/api/execd.ts@@ -1642,7 +1642,7 @@ export interface components {*/message: string;};- /** @description Creates an isolated session with one or more overlay mounts. The legacy `workspace` field is kept as sugar for a single-element `overlays` list: at least one of `workspace` or `overlays` must be provided, and when both are present `workspace` is prepended to `overlays`. The session files API serves exactly the session mounts (overlays, extra_writable, binds): paths under each mount resolve as the namespace sees them, and absolute paths outside every session mount are rejected instead of resolving against the workspace. */+ /** @description Creates an isolated session with one or more overlay mounts. The legacy `workspace` field is kept as sugar for a single-element `overlays` list: at least one of `workspace` or `overlays` must be provided, and when both are present `workspace` is prepended to `overlays`. The session files API serves exactly the overlay and bind mounts: paths under each mount resolve as the namespace sees them, and absolute paths outside every overlay or bind are rejected instead of resolving against the workspace (unlike binds, extra_writable paths are not served by the files API unless an overlay covers them). */CreateIsolatedSessionRequest: {/** @enum {string} */profile?: "strict" | "balanced";diff --git a/sdks/sandbox/python/src/opensandbox/api/execd/api/isolated_execution/create_isolated_session.py b/sdks/sandbox/python/src/opensandbox/api/execd/api/isolated_execution/create_isolated_session.pyindex c6fd0de43..cd06fbd6a 100644--- a/sdks/sandbox/python/src/opensandbox/api/execd/api/isolated_execution/create_isolated_session.py+++ b/sdks/sandbox/python/src/opensandbox/api/execd/api/isolated_execution/create_isolated_session.py@@ -93,9 +93,10 @@ def sync_detailed(mounts. The legacy `workspace` field is kept as sugar for a single-element `overlays`list: at least one of `workspace` or `overlays` must be provided, and when both arepresent `workspace` is prepended to `overlays`. The session files API serves exactly the- session mounts (overlays, extra_writable, binds): paths under each mount resolve as the- namespace sees them, and absolute paths outside every session mount are rejected instead- of resolving against the workspace.+ overlay and bind mounts: paths under each mount resolve as the namespace sees them, and+ absolute paths outside every overlay or bind are rejected instead of resolving against the+ workspace (unlike binds, extra_writable paths are not served by the files API unless an+ overlay covers them).Raises:errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.@@ -128,9 +129,10 @@ def sync(mounts. The legacy `workspace` field is kept as sugar for a single-element `overlays`list: at least one of `workspace` or `overlays` must be provided, and when both arepresent `workspace` is prepended to `overlays`. The session files API serves exactly the- session mounts (overlays, extra_writable, binds): paths under each mount resolve as the- namespace sees them, and absolute paths outside every session mount are rejected instead- of resolving against the workspace.+ overlay and bind mounts: paths under each mount resolve as the namespace sees them, and+ absolute paths outside every overlay or bind are rejected instead of resolving against the+ workspace (unlike binds, extra_writable paths are not served by the files API unless an+ overlay covers them).Raises:errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.@@ -158,9 +160,10 @@ async def asyncio_detailed(mounts. The legacy `workspace` field is kept as sugar for a single-element `overlays`list: at least one of `workspace` or `overlays` must be provided, and when both arepresent `workspace` is prepended to `overlays`. The session files API serves exactly the- session mounts (overlays, extra_writable, binds): paths under each mount resolve as the- namespace sees them, and absolute paths outside every session mount are rejected instead- of resolving against the workspace.+ overlay and bind mounts: paths under each mount resolve as the namespace sees them, and+ absolute paths outside every overlay or bind are rejected instead of resolving against the+ workspace (unlike binds, extra_writable paths are not served by the files API unless an+ overlay covers them).Raises:errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.@@ -191,9 +194,10 @@ async def asyncio(mounts. The legacy `workspace` field is kept as sugar for a single-element `overlays`list: at least one of `workspace` or `overlays` must be provided, and when both arepresent `workspace` is prepended to `overlays`. The session files API serves exactly the- session mounts (overlays, extra_writable, binds): paths under each mount resolve as the- namespace sees them, and absolute paths outside every session mount are rejected instead- of resolving against the workspace.+ overlay and bind mounts: paths under each mount resolve as the namespace sees them, and+ absolute paths outside every overlay or bind are rejected instead of resolving against the+ workspace (unlike binds, extra_writable paths are not served by the files API unless an+ overlay covers them).Raises:errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.diff --git a/sdks/sandbox/python/src/opensandbox/api/execd/models/create_isolated_session_request.py b/sdks/sandbox/python/src/opensandbox/api/execd/models/create_isolated_session_request.pyindex 303d9059c..944b2cb07 100644--- a/sdks/sandbox/python/src/opensandbox/api/execd/models/create_isolated_session_request.py+++ b/sdks/sandbox/python/src/opensandbox/api/execd/models/create_isolated_session_request.py@@ -40,9 +40,10 @@ T = TypeVar("T", bound="CreateIsolatedSessionRequest")class CreateIsolatedSessionRequest:"""Creates an isolated session with one or more overlay mounts. The legacy `workspace` field is kept as sugar for asingle-element `overlays` list: at least one of `workspace` or `overlays` must be provided, and when both are- present `workspace` is prepended to `overlays`. The session files API serves exactly the session mounts (overlays,- extra_writable, binds): paths under each mount resolve as the namespace sees them, and absolute paths outside every- session mount are rejected instead of resolving against the workspace.+ present `workspace` is prepended to `overlays`. The session files API serves exactly the overlay and bind mounts:+ paths under each mount resolve as the namespace sees them, and absolute paths outside every overlay or bind are+ rejected instead of resolving against the workspace (unlike binds, extra_writable paths are not served by the files+ API unless an overlay covers them).Attributes:profile (CreateIsolatedSessionRequestProfile | Unset):diff --git a/specs/execd-api.yaml b/specs/execd-api.yamlindex 6a2409d2d..86f651b8f 100644--- a/specs/execd-api.yaml+++ b/specs/execd-api.yaml@@ -2953,11 +2953,12 @@ components:legacy `workspace` field is kept as sugar for a single-element`overlays` list: at least one of `workspace` or `overlays` must beprovided, and when both are present `workspace` is prepended to- `overlays`. The session files API serves exactly the session mounts- (overlays, extra_writable, binds): paths under each mount resolve- as the namespace sees them, and absolute paths outside every- session mount are rejected instead of resolving against the- workspace.+ `overlays`. The session files API serves exactly the overlay and+ bind mounts: paths under each mount resolve as the namespace sees+ them, and absolute paths outside every overlay or bind are+ rejected instead of resolving against the workspace (unlike+ binds, extra_writable paths are not served by the files API+ unless an overlay covers them).properties:profile:type: string