Files
ARTEX/docker-compose.yml
T
BaaRai eb5d3d73c1 security(agent): confine the file tools and close the executor review
The SDK file tools Read, Write, Edit, MultiEdit, LS, Glob and Grep run in
the server process, which is root in the image, and took any absolute or
relative path: Read returned /app/keys/jwt.key or the config file, and
Write could plant a skill or rewrite the config past the approval gate.

- agent/filetools.go: defaultTools replaces the seven tools for every
  agent kind (chat, main agent, planner, worker). Same names, prompts and
  schemas; every path goes through an os.Root on the run's working
  directory, opened component by component below the data directory, so
  absolute paths elsewhere, "..", symlinks leading out, a run directory
  swapped for a symlink and files with extra hard links are refused. Grep
  no longer starts ripgrep. The LLM connection test passes an empty tool
  list instead of nil (nil meant the unconfined defaults).
- traffic: chmod the go-mitmproxy CA private key to 0600 after the proxy
  creates or loads it; the CA certificate stays readable.
- server: the executor gets HOME and XDG_CACHE_HOME in <data>/exec-home,
  owned by it, on the bash shim, the MCP drop shim and the custom-tool
  credential path.
- server: ARTEX_LLM_PROXY and ARTEX_LLM_BASE_URL can carry user:pass@;
  they are scrubbed and sealed with the other startup secrets.
- docker: no-new-privileges for the artex service, setuid/setgid bits
  stripped in the image, PLAYWRIGHT_BROWSERS_PATH kept at root's cache.
- db: the persistence approval seed inserts each rule only when no rule
  of that name exists, so a re-run does not duplicate rules.
- Root-gated tests run the bash shim, a custom tool and an MCP stdio
  command as the executor and check the uid, a 0600 root file, the
  server's /proc environ and a cache write.
2026-11-20 05:35:54 +01:00

74 lines
3.3 KiB
YAML

services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER:-artex}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Please set POSTGRES_PASSWORD in .env}
POSTGRES_DB: ${POSTGRES_DB:-artex}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-artex} -d ${POSTGRES_DB:-artex}"]
interval: 5s
timeout: 3s
retries: 10
restart: unless-stopped
artex:
# Built from this checkout. The previous reference was a third-party
# namespace whose repository is gone: whoever controls that name could
# publish the tag this file would pull.
build:
context: .
args:
ARTEX_VERSION: ${ARTEX_VERSION:-dev}
image: artex:local
# Agent processes run as an unprivileged executor (-exec-uid): no setuid program
# or file capability may raise them back to root.
security_opt:
- "no-new-privileges:true"
depends_on:
postgres:
condition: service_healthy
environment:
ARTEX_PG_DSN: postgres://${POSTGRES_USER:-artex}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-artex}?sslmode=disable
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
ARTEX_LLM_PROVIDER: ${ARTEX_LLM_PROVIDER:-}
ARTEX_LLM_MODEL: ${ARTEX_LLM_MODEL:-}
ARTEX_LLM_BASE_URL: ${ARTEX_LLM_BASE_URL:-}
ARTEX_LLM_PROXY: ${ARTEX_LLM_PROXY:-}
ARTEX_JWT_KEY_DIR: /app/keys
# Optional: key for secrets at rest; empty = keys/secret.key (generated at first start).
ARTEX_SECRET_KEY: ${ARTEX_SECRET_KEY:-}
ARTEX_TRUSTED_PROXIES: ${ARTEX_TRUSTED_PROXIES:-}
# Untrusted-output boundary: on by default (empty = on); ARTEX_UNTRUSTED_BOUNDARY=0 in .env
# disables it. Cost: about 154 bytes per tool result plus one system note.
ARTEX_UNTRUSTED_BOUNDARY: ${ARTEX_UNTRUSTED_BOUNDARY:-}
ARTEX_UPDATE_CHECK: ${ARTEX_UPDATE_CHECK:-}
# Noise profile for target requests: off (default) | quiet | balanced | aggressive.
ARTEX_NOISE_PROFILE: ${ARTEX_NOISE_PROFILE:-}
ARTEX_TARGET_USER_AGENT: ${ARTEX_TARGET_USER_AGENT:-}
# Hierarchical run budgets: unset or 0 = unlimited (no change). See README.
ARTEX_TASK_BUDGET_TOKENS: ${ARTEX_TASK_BUDGET_TOKENS:-}
ARTEX_TASK_BUDGET_TURNS: ${ARTEX_TASK_BUDGET_TURNS:-}
ARTEX_INTENT_BUDGET_TOKENS: ${ARTEX_INTENT_BUDGET_TOKENS:-}
ARTEX_INTENT_BUDGET_TURNS: ${ARTEX_INTENT_BUDGET_TURNS:-}
ports:
- "${ARTEX_BIND_ADDR:-127.0.0.1}:8787:8787"
- "127.0.0.1:8788:8788"
volumes:
# Bind the runtime data directory (traffic index, task files, transcripts, etc.) to data/ in the project root,
# so it is easy to inspect/back up on the host and survives container rebuilds.
- ./data:/app/data
# JWT signing key and secret key (jwt.key, secret.key), kept out of data/, which the file manager browses.
# Persisting it keeps users signed in across container rebuilds.
- ./keys:/app/keys
# Mount skills/ from the project root into the container (overriding the image's built-in /app/skills);
# skill changes require no image rebuild — the container reads the host copy.
- ./skills:/app/skills
restart: unless-stopped
volumes:
pgdata: