The panel refuses tasks when artex-runner is unavailable, so the runner, worker and egress proxy are now part of docker-compose.yml and docker-compose.ghcr.yml. install.sh and update.sh generate ARTEX_RUNNER_TOKEN and build the three images; the release workflow publishes them beside the panel image. The changelog records the security fixes, the upgrade steps and the scope re-approval.
Introduce the sandbox MVP architecture separating panel credentials and
PostgreSQL access from model-controlled tool execution:
- Runner service (cmd/artex-runner, sandbox/) owning /var/run/docker.sock
behind bearer-token auth (ARTEX_RUNNER_TOKEN) with POST /v1/tasks/{id}/exec,
POST /v1/tasks/{id}/kill, DELETE /v1/tasks/{id}, and GET /v1/health.
- Strict input and env validation (400 on forbidden secret/DB/cloud env
patterns or values > 8192 bytes, strict task ID and /workspace workdir).
- Hardened per-task worker containers (Dockerfile.worker, artex-worker:local,
cmd/artex-exec-wrap): uid/gid 10001, artex-exec-wrap --init PID 1 zombie
reaper, read-only rootfs, cap-drop ALL, no-new-privileges, pids/mem/cpu
limits, tmpfs /tmp and /home/exec, only /app/data/tasks/<id>:/workspace:rw,
only verified internal=true runner-labeled network artex-task-<id>.
- Kernel-backed kill-switch (zero agent-writable state): Kill executes
artex-exec-wrap --kill-uid 10001 as uid 10001 scanning /proc directly
(defeating setsid, nohup, nested double-forked trap-TERM daemons, and /tmp
tampering), verifies zero non-PID-1 uid-10001 processes remain, and falls
back to force-removing the worker container if any check fails. Dead
workers/proxies are recreated automatically when startContainer fails.
- Operator-only scope approval (migration 0023_task_scope_operator_approval.sql):
adds task_scope.approved_by_operator BOOLEAN NOT NULL DEFAULT FALSE, set
true exclusively by operator API/UI (AddOperatorScope) and operator-selected
TaskCreateOptions.CompanyIDs (insertTaskCompanies). AddAgentScope and
AddAutoScope leave it false (coverage-only). taskSandboxRunInfo reads only
approved, non-expanded rows (and expands company scope only for approved
company rows); tasks with no approved scope deny all egress.
- Per-task egress proxy (cmd/artex-egress-proxy, Dockerfile.egress-proxy,
artex-egress-proxy:local): HTTP/HTTPS CONNECT (:3128) and SOCKS5 (:1080),
deny-by-default allowlist with strict domain suffix enforcement, blocks
RFC1918/loopback/link-local/IMDS and IPv6 unless in scope CIDRs, DNS
pinning, and tamper-proof JSONL audit logging to a proxy-only mount
(/app/data/egress-audit/<id>:/audit:rw) never mounted into the worker.
- Panel integration (agent/sandbox.go, agent/webfetch.go, server/sandbox.go,
server/sharedbrowser_guard.go, server/assembly.go, server/customtool.go,
docker-compose.sandbox.yml): ARTEX_SANDBOX defaults to required (fail closed,
no local fallback), WebFetch and opt-in shared browser inherit the
operator-approved sandbox.EgressPolicy (with target_gate or explicit proxy
required for shared browser), custom script tools staged via symlink-confined
workspace files (avoiding argv E2BIG), Pause/Stop/Delete wired to runner
Kill/Delete.
- Documented breaking change and hardening details in docs/SANDBOX.md,
README.md, and CHANGELOG.md.
- Startup fail-closed: LockDownKeyDir explicitly chmods 0700 an existing key
dir (counteracting host bind mounts) and 0600 existing key files; adds keys/
itself alongside jwt.key, secret.key, and config.json to IsolationSelfTest;
makes IsolationSelfTest fatal unless ARTEX_ALLOW_UNISOLATED=1 is set.
- Secret rotation: adds db.RotateSecretKey (single atomic transaction
re-encrypting all sealed columns/settings and bumping auth.password_version),
cmd/artex -rotate-secrets, scripts/rotate-secrets.sh, and OPS/SECURITY docs.
- Scoped defaults, backfill & posture warnings: TargetGate defaults ON for
tasks with CompanyIDs or InterceptRules (explicit opt-out persisted in
tasks.target_gate_opt_out); migration 0022_target_gate_backfill.sql backfills
existing active scoped tasks that did not explicitly opt out; egress-guard
defaults to EGRESS_MODE=enforce when scope lists exist; loud startup warning
when target gate or egress enforcement is off.
- Kernel-backed local kill-switch: enables PR_SET_CHILD_SUBREAPER and scans
/proc (without trusting agent-writable state) on Engine.Pause/BeginDelete to
kill escaped setsid, nohup, and nested double-fork daemons (plus all
execPriv.UID processes in isolated mode) within <= 5s with zero post-pause
egress.
Rebased on top of Lot 1 security stack (#660): keeps both test:sse and
test:navigation in web/package.json.
Co-authored-by: renaesop <njurjs@gmail.com>
INSTALL.md collects the supported Docker paths, first login, remote access,
and the errors behind most installation questions. The README links it from
the nav and above the quick start. The installation issue form asks for OS,
Docker setup, version, logs and health output, and reminds reporters to strip
the setup token. The video script keeps a short demo aligned with the guide.
Part 2 of #5, on top of the bridge core.
Access: chat_bridges.allowed_users (migration 0016). A private chat is
served when its chat ID is allowed, as before. In a group the sender must
also be an allowed user, and a group with no allowed users serves nobody,
so joining an allowed group grants nothing by itself. A refused member
gets one refusal naming their user ID.
Commands: /tasks, /task [id], /pause [id], /resume [id], /findings [id].
Each chat selects its task with /task; the selection is stored in
chat_bridge_chats and cleared when the task is deleted. /pause and /resume
go through applyTaskControl, the same path as the web UI.
Plain text goes to the selected task's main agent through startTaskChat,
which the web chat handler now also uses, so the bot and the web chat
share one conversation. The answer is relayed when the turn ends, through
chatbridge.SafeText: code blocks dropped, the task's stored credentials
and common secret shapes masked, cut to 1500 characters, with a link
back. An answer is dropped if its chat is no longer allowed.
Co-authored-by: krad <222954346+dar1k0@users.noreply.github.com>
- Require https for base_url. The bot token travels in the URL path and
the responses are the updates the bridge acts on, so plain http is
accepted only with ARTEX_NOTIFY_ALLOW_LOCAL=1, for a local test server.
- Cut replies by UTF-16 code units, which is how Telegram counts its 4096
limit, so emoji-heavy text is no longer rejected. A cut never splits a
character.
- Cap a server-sent retry_after at the backoff ceiling (1 minute).
- Pause one second after an empty poll, so a self-hosted Bot API that
ignores the long-poll timeout cannot spin the loop.
- When the refused-chat memory is full, start over instead of muting
every new chat, which also muted the operator's own chat. Saving the
configuration of the same bot keeps the memory.
- Fix two stale comments that said an empty allowlist keeps the bridge
off (migration 0015 is unreleased, so editing its comment is safe).
Co-authored-by: krad <222954346+dar1k0@users.noreply.github.com>
First part of #5: the transport-agnostic bridge core, the Telegram
adapter, the mandatory chat allowlist, storage, API and settings page.
Task commands, main-agent routing and remote approvals follow in
separate PRs on top of this one.
- chatbridge: Transport interface and Router. The router enforces the
allowlist (an unknown chat gets one refusal naming its chat ID, then
silence, bounded memory), drops updates older than two minutes so a
backlog is never executed, ignores bot senders and commands addressed
to another bot, and dispatches commands (/help, /whoami for now).
- Telegram transport: getUpdates long polling (no inbound port),
plain-text sendMessage truncated to the Bot API limit, getMe for the
identity. It reuses notify's dial guard and redirect policy through
small exported wrappers, and its errors never carry the token.
- Storage: migration 0015 adds chat_bridges, one row per kind. config
is sealed at rest (added to secretColumns) and masked in the API with
the notification-channel convention. The update cursor is committed
before a batch is acted on, only moves forward, and is written only
for the config_version the poller read, so a poll of a replaced token
can never move the new bot's cursor. A token change clears it.
- Server: one loop per transport started by server.New; it re-reads its
row each round and Reload interrupts a poll in flight, so saving the
form applies without a restart. Exponential backoff on errors, honours
Telegram's retry_after, logs under [tgbot] without message text.
- API: GET /api/chat-bridges, PUT /api/chat-bridges/{kind},
POST /api/chat-bridges/{kind}/test. A bridge may run with an empty
allowlist: it then serves no chat and only sends the one-time refusal
naming the chat ID, which is how an operator finds the ID to add.
- Web: System -> Chat bot page with live status, zh-CN and tr strings.
- Docs: docs/chat-bridge.md; README lists the token among stored secrets.
The migration test lists 0015; the pre-0012 test rolls it back with the
others and it re-applies (the migration is idempotent).
Co-authored-by: krad <222954346+dar1k0@users.noreply.github.com>
FactOnlyIntents now returns only terminal intents (done, blocked, exhausted,
stopped), so an open, running or deleted intent is no longer reported as
finished. The summaries go into the planner block inside env.wrap, and the
telemetry docs, the llmrec comment and the db comment match the on-by-default
flag with 0|false|off|no to disable it.
The isolation self-test stopped every start it failed, so a non-root
server (the systemd unit), dev.sh, Windows and macOS no longer started
without -dev-insecure-no-isolation.
EnforceIsolation now decides from the platform and the privilege drop:
- self-test passed: isolated;
- Linux with the privilege drop on (root, the Docker image): a failure
stops the start, unless -dev-insecure-no-isolation is set;
- elsewhere (not Linux, not root, -exec-uid=-1): the server starts
degraded, without a flag.
A degraded start logs a banner with the self-test failure and what is
exposed, and GET /api/health reports the isolation status to a
signed-in caller; the web UI shows a red banner on every page while it
is degraded. The systemd deployment guide and dev.sh describe the mode.
docker-compose.yml built ARTEX_PG_DSN by interpolating POSTGRES_PASSWORD, so
/, ?, %, @, : and spaces made the URL invalid. The server now assembles that
URL from ARTEX_PG_HOST, ARTEX_PG_PORT, ARTEX_PG_USER, ARTEX_PG_PASSWORD,
ARTEX_PG_DBNAME and ARTEX_PG_SSLMODE. An explicit ARTEX_PG_DSN still wins.
ARTEX_PG_PASSWORD is scrubbed with the other startup secrets.
The caution branch ran after the status switch, for every status. A pending
or in_progress finding with a completed fixed or inconclusive retest got a
caution lesson, while docs/rsi-lessons.md says pending and in-progress
findings produce nothing. The caution is now written in the confirmed /
resolved / fixed branch only.
A negative disposition (false_positive, duplicate, ignored, risk_accepted)
now also withdraws the cautions written from the finding's retests. The doc
says a reversed disposition withdraws the finding's evidence, including every
retest of the finding, and a caution from a retest is that evidence: it
tells the next task to recheck a finding the operator has since rejected.
Nothing in the code or the doc says a caution should outlive that. Confirming
again restores it, as for the positive lessons. Reopening (pending /
in_progress) still retracts nothing.
The negative action is the label followed by "(prior <status>)", and the
whole string was cut at 320 runes. Past about 257 runes of summary the cut
removed the suffix, so false_positive and duplicate produced the same action
and the same dedupe key: a change inside the negative group reused the old
lesson instead of writing a new one and withdrawing the old.
The label is now cut to the room left by the prefix and the suffix, so the
status is always in the action and in the key. A summary short enough to fit
gives the same action as before, so existing keys do not change.
On a task with several companies the extractor does not write, and the
negative branch passed an empty keep key. Retraction then withdrew the
finding from every negative lesson, including the one that still matched
its status, and retired an adopted lesson whose disposition never changed.
The keep test now compares the lesson action, not the dedupe key. The
action names the status; the key also carries the company, which a task
with several companies cannot rebuild. A status change inside the negative
group still withdraws the previous lesson.
The lateral join took the newest retest of a finding whatever its status.
A pending, running, failed, or stopped retest can carry a verdict the agent
staged before the run ended, and that verdict became positive or caution
evidence. The join now reads the newest retest with status='completed' and a
non-empty verdict, so an unfinished retest neither writes evidence nor hides
an earlier completed one.
The planner overview now carries finding status, and prove_goal refuses
false_positive, duplicate, and ignored findings. A lesson with no company
is visible only to tasks that also have no company. Retraction withdraws
evidence, runs on disposition change, and still runs after a task gains
a second company.
Pins are name-only behind a proxy (name-only since #370), and deny/ask rules now inspect compound commands (#377); the allow rule stays strict. Also state the untrusted-boundary default plainly.
- Introduced uniform skipping functions in the db package: SkipPGUnavailable and SkipNoPG.
- Updated all relevant test files to utilize these new functions for better consistency and readability.
- Added new db/testpg.go file to house the skipping logic.
- Created architecture and operations documentation to provide a comprehensive overview of the ARTEX system.
- Added a verification script to streamline local testing and ensure code quality.