Skip to content

Commit f40e59e

Browse files
committed
fix: sandbox permissions
1 parent 9a168e7 commit f40e59e

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

pkg/inference/backends/runner.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ type RunnerConfig struct {
4242
// ErrorTransformer is an optional function to transform error output
4343
// into a more user-friendly message. If nil, the raw output is used.
4444
ErrorTransformer ErrorTransformer
45+
// Env is an optional list of extra environment variables for the backend
46+
// process, each in "KEY=VALUE" form. These are appended to the current
47+
// process environment. If nil, the backend inherits the parent env as-is.
48+
Env []string
4549
}
4650

4751
// Logger interface for backend logging
@@ -88,6 +92,9 @@ func RunBackend(ctx context.Context, config RunnerConfig) error {
8892
}
8993
command.Stdout = config.ServerLogWriter
9094
command.Stderr = out
95+
if len(config.Env) > 0 {
96+
command.Env = append(os.Environ(), config.Env...)
97+
}
9198
},
9299
config.SandboxPath,
93100
config.BinaryPath,

pkg/inference/backends/vllm/vllm_metal.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ func (v *vllmMetal) Run(ctx context.Context, socket, model string, modelRef stri
222222
Args: args,
223223
Logger: v.log,
224224
ServerLogWriter: logging.NewWriter(v.serverLog),
225+
Env: []string{"VLLM_HOST_IP=127.0.0.1"},
225226
})
226227
}
227228

pkg/sandbox/sandbox_darwin.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ const ConfigurationPython = `(version 1)
2929
;;; Also allow Unix domain socket binding in the system temp directory
3030
;;; (/private/var/folders) which vllm-metal uses for internal ZMQ IPC sockets.
3131
(deny network*)
32-
(allow network-bind network-inbound
32+
(allow network-bind network-inbound network-outbound
3333
(regex #"inference.*-[0-9]+\.sock$")
3434
(local tcp "localhost:*"))
35-
(allow network-bind
35+
(allow network-bind network-inbound network-outbound
3636
(regex #"^/private/var/folders/"))
3737
3838
;;; Deny access to the camera and microphone.
@@ -76,12 +76,16 @@ const ConfigurationPython = `(version 1)
7676
(allow file-write*
7777
(literal "/dev/null")
7878
(subpath "/private/var")
79+
(subpath "/private/tmp")
7980
(subpath "[HOMEDIR]/Library/Containers/com.docker.docker/Data")
80-
(subpath "[WORKDIR]"))
81+
(subpath "[WORKDIR]")
82+
(subpath "[HOMEDIR]/.cache/vllm"))
8183
(allow file-read*
8284
(subpath "[HOMEDIR]/.docker/models")
8385
(subpath "[HOMEDIR]/Library/Containers/com.docker.docker/Data")
84-
(subpath "[WORKDIR]"))
86+
(subpath "[WORKDIR]")
87+
(subpath "[HOMEDIR]/.cache/vllm")
88+
(subpath "/private/tmp"))
8589
`
8690

8791
// ConfigurationLlamaCpp is the sandbox configuration for llama.cpp processes.

0 commit comments

Comments
 (0)