Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(agent): fail closed on Landlock errors and require local tokens (#44152)

盐粒 Yanli26e2ab90fcc6
diff --git a/dify-agent-runtime/README.md b/dify-agent-runtime/README.md
index 0cd826421c7..ecfec126834 100644
--- a/dify-agent-runtime/README.md
+++ b/dify-agent-runtime/README.md
@@ -46,14 +46,24 @@ docker build -f dify-agent-runtime/docker/Dockerfile \
dify-agent-runtime/
```
-### Running docker container
+### Running a Local docker container
+
+Set `SHELLCTL_AUTH_TOKEN` to a nonblank secret and configure the Agent Backend's
+`DIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN` with the same value.
```
docker run -d --name dify-agent-runtime \
-p 15004:5004 \
- dify-agent-runtime:latest
+ -e SHELLCTL_AUTH_TOKEN \
+ dify-agent-runtime:latest \
+ shellctl serve --listen 0.0.0.0:5004 --require-auth-token
```
+`--require-auth-token` rejects a missing, empty, or whitespace-only final token
+before service initialization. A nonempty `--token` overrides
+`SHELLCTL_AUTH_TOKEN`; valid values are preserved unchanged. The flag defaults
+to off in the shared image, so E2B and Enterprise may omit a shellctl token.
+
## Help text generation
Cli help can be generated and injected to dify-agent's system prompt.
@@ -85,7 +95,10 @@ The runner sets `TMPDIR`, `TMP`, and `TEMP` directly to the job's `cwd`. It does
See [here](./internal/envvar/envvar.go)
-Requires Linux ≥ 5.13. On unsupported kernels, a warning is printed to stderr.
+Requires Linux ≥ 5.13 with Landlock enabled. When path isolation is enabled,
+any Landlock setup error aborts the job with exit code `125` before the user
+script executes. Deployments may explicitly set
+`SHELLCTL_ENABLE_PATH_ISOLATION=false` to disable this restriction.
## API Routes
diff --git a/dify-agent-runtime/cmd/runner/main.go b/dify-agent-runtime/cmd/runner/main.go
index 945a20f01ed..9509e25fa6c 100644
--- a/dify-agent-runtime/cmd/runner/main.go
+++ b/dify-agent-runtime/cmd/runner/main.go
@@ -310,10 +310,7 @@ func childMode() {
home := os.Getenv("HOME")
jobDir := filepath.Dir(scriptPath)
cfg := landlock.ConfigFromEnv(home, cwd, jobDir)
- if err := landlock.Restrict(cfg); err != nil {
- // the landlock is best-effort, so we just log the error whatever it is
- fmt.Fprintf(os.Stderr, "shellctl-runner: WARNING: %v — running without filesystem isolation\n", err)
- }
+ cmdutil.HandleError(landlock.Restrict(cfg), 125, "apply Landlock restrictions")
}
// exec replaces the current process.
diff --git a/dify-agent-runtime/cmd/runner/main_test.go b/dify-agent-runtime/cmd/runner/main_test.go
index 9bf82100a2c..f6195be8ade 100644
--- a/dify-agent-runtime/cmd/runner/main_test.go
+++ b/dify-agent-runtime/cmd/runner/main_test.go
@@ -6,6 +6,7 @@ import (
"os/exec"
"path/filepath"
"strconv"
+ "strings"
"syscall"
"testing"
"time"
@@ -13,6 +14,72 @@ import (
"github.com/langgenius/dify/dify-agent-runtime/internal/jobmode"
)
+func TestRunnerLandlockFailureDoesNotExecuteScript(test *testing.T) {
+ runnerPath := filepath.Join(test.TempDir(), "shellctl-runner")
+ build := exec.Command("go", "build", "-o", runnerPath, ".")
+ if output, err := build.CombinedOutput(); err != nil {
+ test.Fatalf("build runner: %v\n%s", err, output)
+ }
+
+ for _, mode := range []string{"pty", "stdio"} {
+ for _, isolation := range []string{"true", "false"} {
+ test.Run(mode+"/isolation="+isolation, func(test *testing.T) {
+ jobDir := test.TempDir()
+ invalidDirectory := filepath.Join(jobDir, "regular-file")
+ for name, content := range map[string]string{
+ "regular-file": "not a directory",
+ "script": "printf executed > script-executed",
+ "start-gate": "",
+ } {
+ if err := os.WriteFile(filepath.Join(jobDir, name), []byte(content), 0600); err != nil {
+ test.Fatal(err)
+ }
+ }
+ cmd := exec.Command(runnerPath, jobDir, "test-job", jobDir, mode)
+ cmd.Env = mergeEnv(os.Environ(), map[string]string{
+ "HOME": jobDir,
+ "SHELLCTL_ENABLE_PATH_ISOLATION": isolation,
+ "SHELLCTL_LANDLOCK_RW_PATHS": invalidDirectory,
+ "SHELLCTL_LANDLOCK_RO_PATHS": "/usr,/bin,/lib,/lib64",
+ "SHELLCTL_LANDLOCK_RW_DEV_PATHS": "/dev/null",
+ })
+ output, err := cmd.CombinedOutput()
+ wantExitCode := 125
+ if isolation == "false" {
+ wantExitCode = 0
+ }
+ if got := commandExitCode(err); got != wantExitCode {
+ test.Fatalf("exit code = %d, want %d: %s", got, wantExitCode, output)
+ }
+ exitArtifact, err := os.ReadFile(filepath.Join(jobDir, "runner-exit-code"))
+ if err != nil || strings.TrimSpace(string(exitArtifact)) != strconv.Itoa(wantExitCode) {
+ test.Fatalf("exit artifact = %q, err = %v", exitArtifact, err)
+ }
+ if _, err := os.Stat(filepath.Join(jobDir, "runner-ended-at")); err != nil {
+ test.Fatal(err)
+ }
+ _, markerErr := os.Stat(filepath.Join(jobDir, "script-executed"))
+ if isolation == "true" {
+ if !os.IsNotExist(markerErr) {
+ test.Fatalf("user script side effect exists: %v", markerErr)
+ }
+ if mode == "stdio" {
+ output, err = os.ReadFile(filepath.Join(jobDir, "stderr.log"))
+ if err != nil {
+ test.Fatal(err)
+ }
+ }
+ if !strings.Contains(string(output), "apply Landlock restrictions") {
+ test.Fatalf("missing Landlock diagnostic: %s", output)
+ }
+ } else if markerErr != nil {
+ test.Fatalf("disabled isolation did not execute script: %v", markerErr)
+ }
+ })
+ }
+ }
+}
+
func TestRunStdioCapturesCompleteSeparatedStreams(t *testing.T) {
jobDir := t.TempDir()
cmd := exec.Command(os.Args[0], "-test.run=^TestStdioHelperProcess$")
diff --git a/dify-agent-runtime/cmd/shellctl/main.go b/dify-agent-runtime/cmd/shellctl/main.go
index 948dddcfecd..e8d1d621c4b 100644
--- a/dify-agent-runtime/cmd/shellctl/main.go
+++ b/dify-agent-runtime/cmd/shellctl/main.go
@@ -10,6 +10,7 @@ import (
"net/http"
"os"
"os/signal"
+ "strings"
"syscall"
"time"
@@ -29,6 +30,7 @@ func run() error {
listen := serveCmd.String("listen", "", "address to listen on (host:port)")
stateDir := serveCmd.String("state-dir", "", "state directory path")
token := serveCmd.String("token", "", "bearer auth token")
+ requireAuthToken := serveCmd.Bool("require-auth-token", false, "require a nonblank bearer auth token")
if len(os.Args) < 2 || os.Args[1] != "serve" {
fmt.Fprintf(os.Stderr, "Usage: shellctl serve [flags]\n")
@@ -52,6 +54,9 @@ func run() error {
if *token != "" {
config.AuthToken = *token
}
+ if *requireAuthToken && strings.TrimSpace(config.AuthToken) == "" {
+ return fmt.Errorf("auth token is required: set SHELLCTL_AUTH_TOKEN or --token")
+ }
// Initialize service
svc := server.NewService(config)
diff --git a/dify-agent-runtime/cmd/shellctl/main_test.go b/dify-agent-runtime/cmd/shellctl/main_test.go
new file mode 100644
index 00000000000..6f03d2c39b6
--- /dev/null
+++ b/dify-agent-runtime/cmd/shellctl/main_test.go
@@ -0,0 +1,61 @@
+package main
+
+import (
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+func TestServeAuthTokenValidationBeforeInitialization(test *testing.T) {
+ for _, testCase := range []struct {
+ name string
+ envToken *string
+ flags []string
+ wantAuthErr bool
+ }{
+ {name: "unset", flags: []string{"--require-auth-token"}, wantAuthErr: true},
+ {name: "empty", envToken: new(""), flags: []string{"--require-auth-token"}, wantAuthErr: true},
+ {name: "whitespace", envToken: new(" \t\n"), flags: []string{"--require-auth-token"}, wantAuthErr: true},
+ {name: "environment", envToken: new(" env-secret "), flags: []string{"--require-auth-token"}},
+ {name: "cli override", envToken: new(""), flags: []string{"--require-auth-token", "--token", " cli-secret "}},
+ {name: "blank cli override", envToken: new("env-secret"), flags: []string{"--require-auth-token", "--token", " \t"}, wantAuthErr: true},
+ {name: "empty cli preserves environment", envToken: new("env-secret"), flags: []string{"--require-auth-token", "--token", ""}},
+ {name: "default permits unset"},
+ } {
+ test.Run(testCase.name, func(test *testing.T) {
+ if testCase.envToken == nil {
+ test.Setenv("SHELLCTL_AUTH_TOKEN", "")
+ if err := os.Unsetenv("SHELLCTL_AUTH_TOKEN"); err != nil {
+ test.Fatal(err)
+ }
+ } else {
+ test.Setenv("SHELLCTL_AUTH_TOKEN", *testCase.envToken)
+ }
+ test.Setenv("SHELLCTL_SNAPSHOT_TIMEOUT", "")
+ stateDir := filepath.Join(test.TempDir(), "state")
+ if !testCase.wantAuthErr {
+ if err := os.WriteFile(stateDir, nil, 0600); err != nil {
+ test.Fatal(err)
+ }
+ }
+ originalArgs := os.Args
+ test.Cleanup(func() { os.Args = originalArgs })
+ os.Args = append([]string{"shellctl", "serve", "--state-dir", stateDir}, testCase.flags...)
+ err := run()
+ if err == nil {
+ test.Fatal("expected startup error")
+ }
+ if testCase.wantAuthErr {
+ if err.Error() != "auth token is required: set SHELLCTL_AUTH_TOKEN or --token" {
+ test.Fatalf("expected token error before initialization, got %v", err)
+ }
+ if _, statErr := os.Stat(stateDir); !os.IsNotExist(statErr) {
+ test.Fatalf("state directory created before token validation: %v", statErr)
+ }
+ } else if !strings.HasPrefix(err.Error(), "initialize:") {
+ test.Fatalf("expected initialization after accepted token, got %v", err)
+ }
+ })
+ }
+}
diff --git a/dify-agent/docs/dify-agent/guide/index.md b/dify-agent/docs/dify-agent/guide/index.md
index 144fc2e65a1..a2bf0f25029 100644
--- a/dify-agent/docs/dify-agent/guide/index.md
+++ b/dify-agent/docs/dify-agent/guide/index.md
@@ -57,7 +57,7 @@ in [E2B runtime metering](runtime-metering.md).
| `DIFY_AGENT_INNER_API_KEY` | empty | API key sent to Dify API inner plugin endpoints. Set this to Dify API `INNER_API_KEY_FOR_PLUGIN` (Docker: `PLUGIN_DIFY_INNER_API_KEY`). |
| `DIFY_AGENT_RUNTIME_BACKEND` | `local` | Selects one coherent `local`, `enterprise`, `e2b`, or `openshell` Home Snapshot + Execution Binding backend profile. |
| `DIFY_AGENT_LOCAL_SANDBOX_ENDPOINT` | empty | Local shellctl data-plane URL. With the default Local selection, leaving it empty disables `dify.runtime` and resource endpoints. |
-| `DIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN` | empty | Optional bearer token sent to Local shellctl. |
+| `DIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN` | empty | Required nonblank bearer token when the Local endpoint is configured; must match shellctl's `SHELLCTL_AUTH_TOKEN`. |
| `DIFY_AGENT_LOCAL_SANDBOX_MATERIALIZED_HOME_ROOT` | `/home/dify` | Root directory, on the Local shellctl filesystem, for per-Binding materialized Homes. |
| `DIFY_AGENT_LOCAL_SANDBOX_WORKSPACE_ROOT` | `/workspace` | Root directory, on the Local shellctl filesystem, for mutable Workspaces. |
| `DIFY_AGENT_LOCAL_SANDBOX_HOME_SNAPSHOT_ROOT` | `/home/dify/.snapshots` | Root directory, on the Local shellctl filesystem, for immutable Home Snapshots. |
@@ -183,6 +183,25 @@ must use `DIFY_AGENT_LOCAL_SANDBOX_ENDPOINT` and
`DIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN`. There is no compatibility setting for
the removed shell-provider selector.
+Local shellctl deployments must start with `shellctl serve --require-auth-token`
+and set `SHELLCTL_AUTH_TOKEN` to the same secret as the Agent Backend. Compose's
+`local_sandbox` command enables this check; missing, empty, or whitespace-only
+tokens fail before service initialization. E2B and Enterprise retain their
+existing token requirements, and an unset Local endpoint still disables runtime.
+
+For Compose, set `DIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN` in a shared interpolation
+source: the invoking shell, `docker/.env`, or a Compose `--env-file`. This supplies
+the same secret to Agent Backend and shellctl. Setting it only in a service env
+file is insufficient: Compose's explicit `environment` values override that
+file, including with an empty interpolated value. The legacy token alias remains
+accepted. Deploy this change with a rebuilt runtime image containing
+`--require-auth-token`; the previously published `1.17.1` image does not support
+the new flag.
+
+When shellctl path isolation is enabled, any Landlock setup error aborts the job
+with exit code `125` before its user script executes. Deployments may explicitly
+set `SHELLCTL_ENABLE_PATH_ISOLATION=false` to disable shellctl path isolation.
+
The backend selection is deployment-private. Shell-enabled run requests use an
Execution Context, `dify.runtime`, and `dify.shell` graph. Runtime config carries
only the opaque `backend_binding_ref` resolved by Dify API. See
diff --git a/dify-agent/docs/dify-agent/index.md b/dify-agent/docs/dify-agent/index.md
index 9e21843877d..bf5a55be667 100644
--- a/dify-agent/docs/dify-agent/index.md
+++ b/dify-agent/docs/dify-agent/index.md
@@ -29,6 +29,11 @@ import path. Cross-module references live in Config, for example
before I/O. Instruction ordering is unspecified. Native capability ordering
preserves Runtime → Shell → Config resource scopes.
+An enabled Local runtime requires a nonblank deployment auth token matching
+shellctl. When shellctl path isolation is enabled, Landlock setup errors abort
+the job before its user script executes. Deployment settings may explicitly
+disable path isolation. See the [operations guide](guide/index.md) for setup.
+
Model, output type, current user content and initial history use explicit runner
assembly and native Agent arguments. Knowledge eager results stay in the user
role through a native model-request hook. Tool dispatch, instructions and
diff --git a/dify-agent/src/dify_agent/runtime_backend/profile.py b/dify-agent/src/dify_agent/runtime_backend/profile.py
index dc006435ce2..57bc9c17169 100644
--- a/dify-agent/src/dify_agent/runtime_backend/profile.py
+++ b/dify-agent/src/dify_agent/runtime_backend/profile.py
@@ -34,7 +34,7 @@ DEFAULT_LOCAL_HOME_SNAPSHOT_ROOT = "/home/dify/.snapshots"
class RuntimeBackendSettings(BaseSettings):
- """Server-private credentials and endpoints for one coherent backend profile."""
+ """Server-private backend credentials and endpoints; Local requires a nonblank auth token."""
runtime_backend: Literal["local", "enterprise", "e2b", "openshell"] = "local"
@@ -101,6 +101,8 @@ class RuntimeBackendSettings(BaseSettings):
if not self.local_sandbox_endpoint or not self.local_sandbox_endpoint.strip():
raise ValueError("local_sandbox_endpoint is required for the local runtime backend")
_validate_http_url(self.local_sandbox_endpoint, field_name="local_sandbox_endpoint")
+ if not self.local_sandbox_auth_token or not self.local_sandbox_auth_token.strip():
+ raise ValueError("local_sandbox_auth_token is required for the local runtime backend")
_validate_absolute_posix_path(
self.local_sandbox_materialized_home_root,
field_name="local_sandbox_materialized_home_root",
diff --git a/dify-agent/tests/local/dify_agent/adapters/shell/test_config.py b/dify-agent/tests/local/dify_agent/adapters/shell/test_config.py
index 9bbeb84f3c9..b34e62dcb12 100644
--- a/dify-agent/tests/local/dify_agent/adapters/shell/test_config.py
+++ b/dify-agent/tests/local/dify_agent/adapters/shell/test_config.py
@@ -13,6 +13,7 @@ class TestLocalValidation:
settings = RuntimeBackendSettings(
runtime_backend="local",
local_sandbox_endpoint="http://shellctl.example.com",
+ local_sandbox_auth_token="secret",
)
assert settings.local_sandbox_endpoint == "http://shellctl.example.com"
@@ -20,6 +21,7 @@ class TestLocalValidation:
settings = RuntimeBackendSettings(
runtime_backend="local",
local_sandbox_endpoint="https://shellctl.internal:8443/v1",
+ local_sandbox_auth_token="secret",
)
assert settings.local_sandbox_endpoint == "https://shellctl.internal:8443/v1"
diff --git a/dify-agent/tests/local/dify_agent/runtime_backend/test_profile.py b/dify-agent/tests/local/dify_agent/runtime_backend/test_profile.py
index cfba7a09305..0b1ec28c03c 100644
--- a/dify-agent/tests/local/dify_agent/runtime_backend/test_profile.py
+++ b/dify-agent/tests/local/dify_agent/runtime_backend/test_profile.py
@@ -63,6 +63,7 @@ def test_local_backend_uses_root_workspace_directory_by_default() -> None:
settings = RuntimeBackendSettings(
runtime_backend="local",
local_sandbox_endpoint="http://shellctl.example",
+ local_sandbox_auth_token="secret",
)
profile = create_runtime_backend_profile(settings)
@@ -76,6 +77,7 @@ def test_local_backend_passes_configured_roots_to_drivers() -> None:
settings = RuntimeBackendSettings(
runtime_backend="local",
local_sandbox_endpoint="http://shellctl.example",
+ local_sandbox_auth_token=" secret ",
local_sandbox_materialized_home_root="/tmp/dify/homes",
local_sandbox_workspace_root="/tmp/dify/workspaces",
local_sandbox_home_snapshot_root="/tmp/dify/snapshots",
@@ -89,6 +91,8 @@ def test_local_backend_passes_configured_roots_to_drivers() -> None:
assert profile.execution_bindings.workspace_root == "/tmp/dify/workspaces"
assert profile.execution_bindings.snapshot_root == "/tmp/dify/snapshots"
assert profile.home_snapshots.snapshot_root == "/tmp/dify/snapshots"
+ assert profile.home_snapshots.auth_token == " secret "
+ assert profile.execution_bindings.auth_token == " secret "
def test_local_backend_rejects_relative_roots() -> None:
@@ -96,10 +100,33 @@ def test_local_backend_rejects_relative_roots() -> None:
_ = RuntimeBackendSettings(
runtime_backend="local",
local_sandbox_endpoint="http://shellctl.example",
+ local_sandbox_auth_token="secret",
local_sandbox_workspace_root="relative/workspaces",
)
[email protected]("token", [None, "", " \t\n"])
+def test_local_backend_requires_nonblank_auth_token(token: str | None) -> None:
+ with pytest.raises(ValidationError, match="local_sandbox_auth_token is required"):
+ _ = RuntimeBackendSettings(
+ runtime_backend="local",
+ local_sandbox_endpoint="http://shellctl.example",
+ local_sandbox_auth_token=token,
+ )
+
+
[email protected]("prefix", ["DIFY_AGENT_LOCAL_SANDBOX", "DIFY_AGENT_SHELLCTL"])
+def test_local_backend_reads_token_aliases(monkeypatch: pytest.MonkeyPatch, prefix: str) -> None:
+ endpoint_name = f"{prefix}_ENDPOINT" if prefix == "DIFY_AGENT_LOCAL_SANDBOX" else f"{prefix}_ENTRYPOINT"
+ monkeypatch.setenv(endpoint_name, "http://shellctl.example")
+ monkeypatch.setenv(f"{prefix}_AUTH_TOKEN", "secret")
+
+ profile = create_runtime_backend_profile(RuntimeBackendSettings())
+
+ assert isinstance(profile.execution_bindings, LocalExecutionBindingBackend)
+ assert profile.execution_bindings.auth_token == "secret"
+
+
_OPENSHELL_DRIVER_CONFIG = (
'{"docker": {"mounts": [{"type": "volume", "source": "dify-agent-shared", "target": "/mnt/dify-agent-shared"}]}}'
)
diff --git a/dify-agent/tests/local/dify_agent/server/test_settings.py b/dify-agent/tests/local/dify_agent/server/test_settings.py
index 7dd46e16e06..fd81cdedc1a 100644
--- a/dify-agent/tests/local/dify_agent/server/test_settings.py
+++ b/dify-agent/tests/local/dify_agent/server/test_settings.py
@@ -388,6 +388,14 @@ def test_build_runtime_backend_profile_returns_local_drivers_when_configured() -
assert profile.home_snapshots.snapshot_root == "/tmp/dify/snapshots"
[email protected]("token", [None, "", " \t\n"])
+def test_build_runtime_backend_profile_rejects_blank_local_token(token: str | None) -> None:
+ settings = ServerSettings(local_sandbox_endpoint="http://shellctl.example", local_sandbox_auth_token=token)
+
+ with pytest.raises(ValidationError, match="local_sandbox_auth_token is required"):
+ _ = settings.build_runtime_backend_profile()
+
+
def test_build_runtime_backend_profile_returns_enterprise_drivers_when_selected() -> None:
settings = ServerSettings(
runtime_backend="enterprise",
diff --git a/docker/docker-compose-template.yaml b/docker/docker-compose-template.yaml
index 2007761efca..c25ebadd61a 100644
--- a/docker/docker-compose-template.yaml
+++ b/docker/docker-compose-template.yaml
@@ -544,6 +544,7 @@ services:
# /files/* endpoints (see ssrf_proxy/squid-agent.conf.template).
local_sandbox:
image: langgenius/dify-agent-local-sandbox:1.17.1
+ command: ["shellctl", "serve", "--listen", "0.0.0.0:5004", "--require-auth-token"]
restart: always
env_file:
- path: ./envs/core-services/local-sandbox.env
diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml
index 99e89d317a5..97625a12b60 100644
--- a/docker/docker-compose.yaml
+++ b/docker/docker-compose.yaml
@@ -550,6 +550,7 @@ services:
# /files/* endpoints (see ssrf_proxy/squid-agent.conf.template).
local_sandbox:
image: langgenius/dify-agent-local-sandbox:1.17.1
+ command: ["shellctl", "serve", "--listen", "0.0.0.0:5004", "--require-auth-token"]
restart: always
env_file:
- path: ./envs/core-services/local-sandbox.env
diff --git a/docker/envs/core-services/dify-agent.env.example b/docker/envs/core-services/dify-agent.env.example
index 9e8ecd52343..42094c3a1c5 100644
--- a/docker/envs/core-services/dify-agent.env.example
+++ b/docker/envs/core-services/dify-agent.env.example
@@ -54,6 +54,9 @@ DIFY_AGENT_INNER_API_KEY=
# Select exactly one coherent Home Snapshot + Sandbox backend.
DIFY_AGENT_RUNTIME_BACKEND=local
DIFY_AGENT_LOCAL_SANDBOX_ENDPOINT=http://local_sandbox:5004
+# Required nonblank secret for Local. Set in the shared Compose interpolation source: shell,
+# docker/.env, or --env-file. Setting only this service env file is overridden
+# by Compose's explicit environment value and does not configure shellctl.
DIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN=
# E2B_API_KEY and E2B_API_TOKEN remain accepted as deployment-level fallbacks.
DIFY_AGENT_E2B_API_KEY=${DIFY_AGENT_E2B_API_KEY:-${E2B_API_KEY:-${E2B_API_TOKEN:-}}}
diff --git a/docker/envs/core-services/local-sandbox.env.example b/docker/envs/core-services/local-sandbox.env.example
index 97eed34d7d8..f967f6ec59c 100644
--- a/docker/envs/core-services/local-sandbox.env.example
+++ b/docker/envs/core-services/local-sandbox.env.example
@@ -3,6 +3,7 @@
# ------------------------------
# Set to false to disable Landlock path isolation (default: true).
+# When enabled, any Landlock setup error aborts the job before its script executes.
SHELLCTL_ENABLE_PATH_ISOLATION=true
# The paths below override the built-in defaults when set, even to an empty value.