mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-06 05:01:50 +08:00
feat(sandbox): isolate worker/chat execution in Docker containers with lifecycle UI
- Add Docker sandbox manager, non-root sandbox image, compose isolation, and host firewall script (#217) - Route Bash, custom commands/scripts, stdio MCP, chat sessions, MainAgent chat, and task-scoped reporter screenshots into sandbox containers with per-task browser concurrency gate - Enforce proxy SSRF guard against loopback, metadata, internal services, and admin port - Add dedicated /system/sandbox management page, /chat session sandbox control, and task detail sandbox popover with progressive stats loading
This commit is contained in:
1 parent
6bbeac588d
commit
9c43e694a3
44 files changed
+7086
-91
No files matched your search
+13
-5
@@ -10,8 +10,9 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
"github.com/Autumn-27/artex/internal/sandbox"
|
||||
)
|
||||
// Workspace file manager — browse / view / edit / download / upload / delete the
|
||||
// shared work dir (s.m.dir), where all agents write their artifacts. Every path is
|
||||
// confined to the work dir root (traversal via ".." is neutralised). All routes sit
|
||||
@@ -33,7 +34,12 @@ func (s *Server) wsResolve(rel string) (string, bool) {
|
||||
if abs != base && !strings.HasPrefix(abs, base+string(os.PathSeparator)) {
|
||||
return "", false
|
||||
}
|
||||
return abs, true
|
||||
// Block symlink escapes planted by a compromised sandbox container.
|
||||
resolved, ok := sandbox.CheckPathWithinRoot(base, abs)
|
||||
if !ok {
|
||||
return "", false
|
||||
}
|
||||
return resolved, true
|
||||
}
|
||||
|
||||
// wsRel renders an absolute path back as a workspace-relative path (forward slashes).
|
||||
@@ -226,9 +232,11 @@ func (s *Server) wsPreview(w http.ResponseWriter, r *http.Request) {
|
||||
if filepath.IsAbs(rawPath) {
|
||||
base := filepath.Clean(s.m.dir)
|
||||
candidate := filepath.Clean(rawPath)
|
||||
ok = candidate == base || strings.HasPrefix(candidate, base+string(os.PathSeparator))
|
||||
if ok {
|
||||
abs = candidate
|
||||
if resolved, within := sandbox.CheckPathWithinRoot(base, candidate); within {
|
||||
abs = resolved
|
||||
ok = true
|
||||
} else {
|
||||
ok = false
|
||||
}
|
||||
}
|
||||
if !ok {
|
||||
|
||||
Reference in new issue
Block a user