Repository navigation
Description
Version/commit: local build of main (checkout 6479ed7, backend reports version=dev; runner healthy)
What I ran:
- Created a company (
ICrash2) and gave it scopecidr 100.85.186.124/32(the lab target). - Deleted the previous company that held the same scope.
- Started a new chat with the
autoorchestration agent while the sidebar company switcher was set toICrash2. - Asked the chat to spawn two assessment tasks against the target.
- Workers ran
curl http://100.85.186.124:8095/→ every request 403 from the per-task egress proxy.
What I expected: a task spawned from a chat that the operator opened with an explicit company selection to inherit that company's egress (the company row is linked at creation, the target is inside the company's declared CIDR).
What happens: the company link lands in task_scope with source='agent', approved_by_operator=false, and the sandbox allowlist query only honours approved rows — so the proxy starts with an empty allowlist and denies everything, silently.
Evidence from a live incident (task_ids 8/9):
-- task_scope (company row written inside the creation transaction, microsecond-identical created_at)
task_id | kind | comp | net | source | approved_by_operator
8 | company | 4 | | agent | f
8 | ip | 0 | 100.85.186.124/32 | agent | f
9 | company | 4 | | agent | f
-- task_scope_egress: 0 rows (no freeze ever happened for any task)
-- egress proxy startup logs
task=3 domains=0 cidrs=1 → audit decision:"allow" (operator-approved rows existed at spawn)
task=8 domains=0 cidrs=0 → audit decision:"deny" (all four rows unapproved/expanded)
-- agent self-repair attempt (task 8, ~2 min after its own spawn)
task=8 ip 100.85.186.124/32 source=agent approved=f expanded=t → still filtered out
Root cause:
server/orchestration.go:362—spawn_taskunconditionally passesCompanyScopeByAgent: true, so every company link from any chat is stamped coverage-only (db/tasks.go:184-186: "rather than an authenticated operator, leaving task_scope approved_by_operator=false (coverage-only) to prevent scope drift").server/sandbox.go:99— the sandbox allowlist is built fromtask_scope WHERE approved_by_operator=true AND COALESCE(expanded,false)=false→ empty →cmd/artex-egress-proxy+sandbox/policy.go:250deny-by-default for literal IPs → 403 on every connect.- The chat itself carries no company binding server-side:
conversationshas no company column; the sidebar switcher is a client-side view filter (web/src/stores/company/). So the operator's deliberate company selection is lost at the one hop where it would matter — only the LLM's tool argument survives, and by design the LLM's word carries no consent.
For contrast, the HTTP path POST /api/tasks (server/server.go:1930) leaves CompanyScopeByAgent=false → rows land source='manual', approved_by_operator=TRUE → the same company selection grants egress. So two operator surfaces, one grants and one silently doesn't.
Why it feels like a trap:
- The task looks linked (it appears in company-filtered views, prompts show the company), so "no egress at all" is not visible anywhere in the UI.
- The agent notices the 403 and calls
add_task_scope/add_company_scopeto self-repair — those are the unapproved paths, and even if approved, the allowlist is frozen at proxy creation (documented inserver/sandbox.go:128-130), so the repair cannot help the running task. The only exit is an out-of-band operator approval + task respawn. - A closed predecessor, spawn_task orchestration tool cannot link companies at creation #626, added
company_idstospawn_taskto restore creation-time linking, but the approval semantics mean the linked company still confers zero egress for chat-dispatched tasks — so the unattended-dispatch motivation of spawn_task orchestration tool cannot link companies at creation #626 ("a human has to edit the task afterwards, which breaks unattended dispatch flows") is only half solved: visibility is back, privileges are not.
Suggested fix (pick one or combine):
- Bind conversations to companies server-side (e.g.
conversations.company_id, set from the authenticated operator when the switcher is applied at chat start).spawn_taskthen passesapprovedByOperator=truefor company ids that are a subset of the conversation's bound companies; LLM-only ids keep the current coverage-only stamp. Operator intent is captured where it actually exists (a human clicked the selector), and the self-grant invariant is preserved for ids the model invents. - Minimum alternative: make the gap loud instead of silent — when a task has an empty approved allowlist (
cidrs=0anddomains=0at proxy start) while it has company links, surface a banner/warning on the task ("company linked, egress pending operator approval") instead of letting workers 403 in a loop.
Bonus doc note: the freeze-at-spawn behaviour means "approve scope, then the already-running task still 403s until respawn" — worth stating next to the scope-approval UI.
Activity
github-actions commentedon Dec 2, 2026
Thanks, this is a detailed bug report. The expected/actual split is clear, but a few things are missing to confirm and fix it: (1) whether the
cidr 100.85.186.124/32row onICrash2was explicitly approved by an operator before the chat spawn; (2) the exactspawn_tasktool arguments and server log lines around creation of tasks 8/9, including whethercompany_idswas passed; (3) fullartex-egress-proxystartup logs/env for a denied task and an approved task; (4) output oftask_scopeandtask_scope_egressfor both; (5) whether auth/operator identity was enabled and which DB/migration version and backend you used; (6) whetherPOST /api/taskswith the same company produces approved rows in that environment. Also confirm whether you respawned after approval, since the documented freeze-at-proxy-creation means later approval cannot affect a running task. The linked-company/no-egress mismatch looks like a real core-functionality bug rather than a security bypass.🤖 automated reply from the repo bot. A human maintainer reads everything. Ping me in any comment with
@artex-bot.c4nc commentedon Dec 2, 2026
Answers to (1)-(6), all from the live host (Docker Compose deploy, PostgreSQL backend, schema_migrations head = 24, backend
version=dev, runner healthy):(1) Was the CIDR row on ICrash2 operator-approved before the chat spawn?
company_scopehas no approval column at all (full DDL checked:id, company_id, kind, domain, net, value, raw, reason, created_at; approval semantics exist only ontask_scope). So "approved company scope before spawn" is not representable — a company's CIDR is inert by construction until task-level approval freezes it. Timeline detail that matters:companies.id=4 (ICrash2) created_at 2026-12-02 09:53:42, but bothcompany_scoperows (cidr 100.85.186.124/32, onekeyword) carrycreated_at 2026-12-02 10:24:23.832343— microsecond-identical, the signature of a single scope-rebuild transaction (the edit path deletes+reinserts rows,DEFAULT now()). That is ~5 min after tasks 8/9 were spawned (10:19:40/46) and after their first audit denies (10:21:03). So at spawn time the company's current scope rows did not exist as they are now; whether the CIDR was originally present at 09:53 and rewritten at 10:24 cannot be recovered from the row alone — there is no scope history table. Either way theapproved_by_operator=falsemechanism below fully explains the denies independent of this timing.(2) Exact
spawn_taskarguments + server log linesFrom
conversation_activities(ids 644/645, conversation 4 = the operator'sautochat started 10:18:30 with the sidebar switcher on ICrash2). Both calls pass company ids explicitly:Server log, creation window:
Target-gate approval was performed; these 403s are the egress proxy, a different gate — which is exactly the confusion the issue is about.
(3) Egress-proxy startup logs + env, denied vs allowed task (both containers still running)
Audit JSONL: task 8 →
{"host":"100.85.186.124","port":8095,"decision":"deny","bytes":0}(recurring); task 4 →{"host":"100.85.186.124","port":8095,"decision":"allow","bytes":30304}plus:8096 allow bytes 2579.(4)
task_scope/task_scope_egressFor the approved task 4 the
task_scopetable now returns 0 rows — coverage rows for tasks 2–7 have aged out / were removed when the old company was deleted; the surviving proof of its approved state is theARTEX_SCOPE_CIDRS=100.85.186.124/32env and theallowaudit entries above. Caveat stated rather than papered over.Note the
iprows'created_at(task 8: 10:20:02, ~22 s after its own creation): the worker/planner self-repaired viaadd_task_scopeafter seeing denies —source='agent', approved=f, expanded=t, still invisible toserver/sandbox.go:99.(5) Auth / operator identity, DB, backend
Operator auth is enabled (JWT:
ARTEX_JWT_KEY_DIR,ARTEX_SECRET_KEY,ARTEX_RUNNER_TOKENset; values redacted). PostgreSQL viaartex-postgrescontainer, migration head 24 (previous 23, 22). Single-user local install — the chat that spawned 8/9 was an authenticated operator session; the stamping does not depend on the session identity becauseserver/orchestration.go:362hardcodesCompanyScopeByAgent: truefor everyspawn_taskcall, authenticated operator chat or not. That is the crux: the human intent exists and is authenticated, but the transport discards it.(6) Does
POST /api/taskswith the same company produce approved rows here?Not yet exercised empirically in this environment (it would create a live task + planner load on this shared runtime; happy to run it with a
ZZ-probedescription and delete it afterwards on request). From the code it is deterministic: the HTTP create path (server/server.go:1930) does not setCompanyScopeByAgent, soinsertTaskCompanies(tx, id, companyIDs, true)writessource='manual', approved_by_operator=TRUE— the contrast is precisely why the chat path is a core-functionality mismatch rather than an environment quirk.Respawn-after-approval question: for tasks 8/9 no operator approval had happened at all when the deny loop ran (the company had no current scope rows either, see (1)), so the freeze-at-proxy-creation behaviour was not the operative cause for them; it is operative for the agent's self-repair attempt (approved or not, a row added after proxy start cannot reach the running allowlist). The earlier allow-cycle (tasks 3/4/5, ~08:44–08:51) was approval before spawn, hence
cidrs=1— consistent with the documented freeze semantics.Happy to add the empirical (6) run or any other capture.
advokat11 commentedon Dec 2, 2026
Same problem. Wonder how you guys use it before, scope mechanic is literally not working and egrees giving me 403 even to in-scope targets.
advokat11 commentedon Dec 2, 2026
Works with ARTEX_SANDBOX=off
c4nc commentedon Dec 2, 2026
Supplement (2026-12-02): after the evidence comment above was posted, upstream landed
ed70ea3("security: promote company scope egress only when approved by the operator", migration 0025):company_scopenow carriesapproved_by_operator(existing rows backfilled approved), and the task egress snapshot reads only operator-approved company scope rows. The evidence comment's "company-level approval is not representable" point was true of our build (6479ed7) and is superseded by that commit.The reported gap itself still reproduces on current
origin/main(e38f58d), re-verified today:server/orchestration.go:362still hardcodesCompanyScopeByAgent: truefor chatspawn_task;db/tasks.go(insertTaskCompanies, called at :284) still stamps every task company/ip rowapproved_by_operator=falsewhenever that flag is set, regardless of whether every scope row of the selected company is now operator-approved under 0025;cidrs=0) and the proxy denies every connect — the original repro is unchanged.With 0025 in place the natural fix is narrower than option 1 in the body: derive the per-company spawn approval flag from the company's scope approval state. At spawn, a selected company whose scope rows are all
approved_by_operator=trueinserts itstask_scoperows as operator-approved and freezes thetask_scope_egresssnapshot in the same transaction, mirroringAddOperatorScope's 0025 semantics; a company holding any agent-written unapproved row, and LLM-invented company ids, keep the coverage-only stamp. Operator intent is then captured where 0025 says it lives (the company-level approval), and the self-grant invariant is preserved per row.We plan to prepare this as a PR from a fork, alongside a companion PR for the mirror bug — operator-approved egress grants satisfying zero target-gate approvals (the gate reads
target_pinsonly,intercept/never consultstask_scope; CIDR-granted targets still raise per-port and bare-host approval prompts). Companion issue to follow with its own evidence trail.security: inherit operator-approved company grants for LLM-spawned tasks
c4nc commentedon Dec 2, 2026
@advokat11 yeah, but not looking to be swatted just because artex may have gone rogue and berserk against a .mil domain