Skip to content

feat(ask_operator): tag requests that name hosts outside the goal (F12) - #197

Merged
BaaRai merged 2 commits into
mainfrom
feat/ask-operator-target-tag
Nov 12, 2026
Merged

BaaRai merged 2 commits into
mainfrom
feat/ask-operator-target-tag

Conversation

@BaaRai

@BaaRai BaaRai commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

What

An ask_operator request whose question names a host or URL that is not among the task's goal targets is tagged "contains target-derived text", and the transcript shows that tag on the request card.

  • server/ask_operator.go: targetDerivedHosts(question, goalTargets) is a pure function. It returns the out-of-goal hosts without duplicates, in order of appearance. commandTargets reads a free text with the existing target extraction. askOperatorActivity stores the hosts as a field of the activity's Detail payload (target_derived_hosts), next to text and attachments.
  • web/src/components/transcript.tsx: parseUserBody reads target_derived_hosts. UserRow renders an amber "Contains target-derived text: " label only when the field is set and not empty.

The question text, the text the model reads, the pause and the operator's decision are unchanged. An untagged request keeps exactly the activity it had before.

Why

Audit F12, 0.7.0 queue. A worker that read target content can carry text from that content into a request to the operator, for example a command that points at a host the operator never named. The tag makes this visible on the card the operator decides on.

What counts as target-derived

A host that the question names but the task goal (Task.Goal, written by the operator) does not.

  • Both texts are read with the existing parser intercept.ExtractTargets, using the target gate's command-string rules (ExtractTargets("Bash", {"command": text})). These rules read URLs with a scheme, IP literals, IP:port, host:port and CIDR. No new parser was added.
  • Hosts are compared after the gate's normalisation and without the port. 10.0.0.5:8443 in the question matches 10.0.0.5:8080 in the goal.
  • An empty goal list, for example a [targetless] goal, tags every host the question names.
  • Bare-domain seeding: the goal side (goalTargets) also takes the bare host names the goal gate accepts (goalDomainRE), widened to the whole dotted name, lowercased, port and path dropped, so a goal naming only app.example.com puts that host in the goal list (the question side is unchanged).

Limits

  • The tag is a visible hint only. It does not block, delay or change the request.
  • The goal-target list is only as good as the declared goal.
  • Known limit, question side: a bare host name with no scheme and no port stays unread, so nc evil.example.net 80 is not tagged. http://evil.example.net and evil.example.net:80 are tagged.
  • Matching is by exact host. A subdomain of a goal host is tagged, and so is an IP inside a goal CIDR.
  • The goal is the only reference. Manual or agent task_scope rows are not consulted.

Tests

All tests are pure: no database, run with ARTEX_PG_DSN unset and ARTEX_CONFIG pointing at a missing file.

  • TestTargetDerivedHosts covers five cases. An in-goal host gives no tag. An out-of-goal host gives the tag. A URL whose host is in the goal gives no tag. An empty goal list tags any host. A request with no host gives no tag.
  • TestAskOperatorActivityTag: an untagged request keeps the plain-text activity (empty Detail). A tagged request keeps the same text and carries attachments: [] plus target_derived_hosts.
  • Mutation check: I inverted the comparison (!inGoal[t.Host] to inGoal[t.Host]). TestTargetDerivedHosts then failed on 4 of 5 cases: in-goal, out-of-goal, in-goal URL and empty goal. The no-host case cannot detect the mutation, as expected. I restored the comparison and the test passes.

Verification (Go in Kali, system Go 1.26.10):

  • gofmt -l on CR-stripped copies of the changed Go files: no output.
  • go build ./...: exit 0.
  • go vet ./...: exit 0.
  • go test -count=1 ./server/: ok github.com/Autumn-27/artex/server 9.674s.
  • web: package.json declares no typecheck script. I ran npx tsc --noEmit -p tsconfig.json (exit 0) and npm run build (exit 0, "Compiled successfully", TypeScript step finished). biome check on transcript.tsx reports the same 2 errors and 14 warnings as on main. None of them is on a changed line.

Not verified

  • The label was not rendered in a browser. It is checked only by the type check and the build.
  • No end-to-end run of ask_operator in a live task.

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.
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.
@BaaRai
BaaRai merged commit 64dabdf into main Nov 12, 2026
3 checks passed
usinfosec pushed a commit to usinfosec/ARTEX that referenced this pull request Nov 17, 2026
fix: 密码初始化/登录接口在数据库读失败时 fail closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant