The staged copy of an ask_operator image was written by the server with
os.Create under a name built from the second, in an uploads directory made
with MkdirAll. An agent that can write in uploads/ (a task directory from
before the run-directory layout) could prepare that name as a symlink, and a
symlinked uploads/ was followed.
- uploads/ is created with Mkdir and checked with Lstat: a symlink or a
file in its place is refused.
- The name is ask-operator-<unixnano>-<8 random hex>.<ext>, created with
O_CREATE|O_EXCL, mode 0640. A taken name is never opened: another name is
tried, five at most.
- The source is opened only when it is still the regular file Lstat saw
(os.SameFile on the Lstat and the Stat of the open file), which refuses a
file swapped for a symlink between the EvalSymlinks check and the open.
The run-directory confinement is unchanged.
Not closed: a directory inside the run directory swapped for a symlink
between the check and the open still leads both Lstat and the open to the
same file elsewhere.
The layout commit made tasks/<id> root:root 0755 and shared only the run
directories. Entries that sat directly in a task directory before it
(uploads/, files the main agent wrote there) were left as found and
nothing shared them any more: after an archive restore, which keeps
neither owners nor modes, the executor could not use them. ask_operator
still resolved a relative image_path from tasks/<id>, not from the
directory the agent works in.
- shareTaskDir: after the task directory is set root:root 0755, each
direct entry that is not a run directory (main, i<N>) is shared with
the executor group again (shareWithExecGroup: group owner, group
read/write, traverse and setgid on directories). Run directories are
handled as before. The task directory stays root-only, so the executor
works inside an old entry and cannot rename, remove or add one. A
symlink among the entries is not followed. The pass runs at start-up
and on archive restore (installTaskArchiveFiles calls
shareRestoredTaskDir and rolls back on failure), with no operator step.
- ask_operator: image_path is resolved inside the run directory of the
agent that asks (agent.EnsureRunDir: tasks/<id>/i<N> for a worker,
tasks/<id>/main without an intent). An absolute path outside it, "..",
and a symlink leading out are refused as before. The copy is still
staged in tasks/<id>/uploads. The tool description says so.
Tests: root-only TestShareTaskDirLegacyEntriesAsRoot (owners and modes,
an executor probe, links to a root-only directory and file left alone);
TestRunDirLayoutOnExistingTreeAsRoot now expects the old file shared;
TestTaskArchiveRestoreRunDirOwnershipAsRoot restores an entry of the task
directory; TestStageAskOperatorImage uses the i<N> and main leaves.
SECURITY.md states the sharing of the old entries and the empty main/.
image_path was opened as a raw filesystem path, so any readable
png/jpg/jpeg/webp/gif on the host could be copied into the operator
transcript. The path is now resolved from the task working directory
and refused when it contains .. or EvalSymlinks outside that tree.
The goal gate accepts a goal that names its target as a bare domain (goalDomainRE), but the in-goal set was built only with commandTargets, which does not read bare hosts. A question citing the operator's own target as a URL was then tagged target-derived. goalTargets adds the goalDomainRE matches, widened to the whole dotted name, lowercased, port and path dropped. The question-side parser is unchanged.
An ask_operator question that names a host or URL not among the task's
goal targets is tagged "contains target-derived text": the hosts go into
the transcript activity's Detail payload as target_derived_hosts, and the
transcript shows the tag on the request card when the field is set.
Hosts are read with intercept.ExtractTargets (the target gate's
command-string rules) from both the question and the task goal, and
compared without the port. The text the model reads, the pause, and the
operator's decision are unchanged: the tag is a visible hint only.
Audit F12, 0.7.0.
When a worker hits an environmental failure (sandboxed or filtered
network path, missing binary or key, TLS or proxy interception, missing
runtime permission), nothing today tells it how to stop: transcripts
show turn after turn of retries with different flags, equivalent tools,
or fallback transports, all burning budget against a wall the agent
cannot move.
Changes:
- the ask_operator tool description now covers environmental blocks
explicitly: do not retry or work around; include the exact single
command the operator should run in their own terminal as one
copy-pastable line, plus what to paste back, then wait. The question
parameter description gains the same guidance.
- worker and pentest seeds gain an "Operator handoff on environmental
blocks" block: stop after the first environmental failure, no
flag-hopping, no bypass hunting, one command per ask_operator request,
never batch.
- tests: the tool description must keep the handoff markers
(TestAskOperatorEnvHandoffGuidance) and the executor seeds must keep
the block (TestPromptSeedsCarryOperatorHandoff).
Pattern adapted from bug-bounty-hunting-prompts (MIT), whose operator
handoff rule produced exactly this single-command format.
A worker hitting a wall only a human can clear (captcha, email/SMS OTP, 2FA,
a decision) calls ask_operator with a precise question and an optional
screenshot. The question lands in the intent's transcript as a user-role turn
with an attachment card (the same {text, attachments} shape chat uploads use,
so the existing transcript UI renders it natively), and the intent pauses. The
operator replies through the existing message-to-worker flow; the reply resumes
the run with the answer as the next input. Images are whitelisted (png/jpg/
jpeg/webp/gif), capped at 10MB, and copied into the task uploads dir.
Closes#41