ARTEX/server
BaaRai ca15063db7 fix(intercept): match block rules on the declared targets before any lookup
The target gate resolved each name through the cache before it matched the
asset block rules, so a call to a name that a name rule blocks still cost a
DNS lookup, and that query reached the name servers of the blocked domain.
URL rules (exact_url, fuzzy_url) were not evaluated at dispatch at all: the
gate passed no URL to the matcher, so they only applied to asset and intent
writes.

targetCheck.run now decides in this order, for a gated call:

1. URL rules, once per decision, on the URLs the call declares, as written.
2. Every block rule on the declared form of every target: the name as
   written, the IP literal, the range.
3. Only then resolution (names a derived exemption covers are still never
   resolved), and the block rules again on the resolved addresses.
4. Exemptions, pins and requests, unchanged.

A hit in 1 or 2 blocks with TARGET_RULE_BLOCKED and the same decided row as
any block, costs no lookup for any target of the call, and opens no request.

- intercept.extractDeclared returns the targets (ExtractTargets is now a thin
  wrapper, unchanged for its callers) and the URLs that name a target: the
  WebFetch url, and every URL token the command-string rules read in Bash,
  shell_open, Monitor, shell_send and the string leaves of other tools,
  including ExecuteExtraTool's inner call.
- The custom http tool's rendered URL and the URLs of a rendered command go to
  the same URL rules (gateRendered takes the URLs).
- Known limit, stated in the comments next to the matcher (db.matchOne) and
  at the dispatch match: URL rules match the declared string. exact_url misses
  any other spelling (case, percent-encoding, trailing slash, added query,
  /./), fuzzy_url misses an encoded substring, and a command can build its URL
  at run time. For a host, a domain, IP or CIDR rule is the one to write.

Unchanged: a tool-rule or judge deny still blocks before the gate is reached
(no extraction, no lookup, no request); asset block rules still win over an
allow and an ask; the gate off path does nothing; scripts stay advisory.

Tests:
- intercept: TestBlockRuleOnDeclaredNameNeedsNoLookup (exact_domain and
  fuzzy_domain; zero lookups, also for an unblocked name earlier in the same
  call), TestExtractDeclaredURLs, TestURLBlockRuleAtDispatch (WebFetch, Bash,
  MCP, ExecuteExtraTool, a pinned and an exempt host, a disabled rule, the
  rendered URL and command; zero lookups), TestExactURLRuleMatchesOnlyAsWritten
  (documents the limit).
- guard: TestBlockRuleWinsOverAllowAndAsk (name rule and URL rule, each over a
  rule allow, judge allow, rule ask and judge ask, real interceptor: blocked,
  no allow row, nobody asked, zero lookups). TestDenyRuleWinsBeforeTargetRequest
  now also covers a judge deny and asserts zero lookups with the real gate.
- server: TestBypass_CustomScriptToolTargetNotGated documents that a script
  tool's target, written in its stored code, is not visible to the gate: in a
  gated task the call is allowed and reaches the target with no lookup, no
  request and no row.
2026-11-11 15:47:58 +01:00
..
ask_operator.go feat: ask_operator environmental handoff discipline 2026-10-12 06:45:21 +02:00
ask_operator_test.go feat: ask_operator environmental handoff discipline 2026-10-12 06:45:21 +02:00
assembly.go feat: first-layer prompt-injection hardening for agents 2026-10-12 00:58:53 +02:00
assembly_test.go chore: ARTEX 初始化 2026-07-26 04:27:45 -04:00
asset_intercept.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
assets.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
assets_scope_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
auth.go feat(intercept): target-gate schema, opt-in flag and approval requests (S3b 1.2-1.4) 2026-11-10 23:05:47 +01:00
auth_test.go fix(auth): rate-limit login per IP, 12-character passwords, loopback default 2026-11-05 16:48:27 +01:00
broadcast.go chore: ARTEX 初始化 2026-07-26 04:27:45 -04:00
chat_llm_resolve_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
chat_mentions.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
chat_mentions_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
chatupload.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
claim_heartbeat_test.go feat(engine): intent claim heartbeat, TTL and fencing token (S3c) 2026-11-10 17:45:11 +01:00
commands.go chore: sync upstream v0.3.6 changes 2026-08-28 14:03:07 +08:00
constraints_api.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
conversation_status_test.go feat: 支持会话级漏洞复测与运行状态展示 2026-09-10 16:06:08 +08:00
conversations.go feat(intercept): target-gate schema, opt-in flag and approval requests (S3b 1.2-1.4) 2026-11-10 23:05:47 +01:00
core_test.go fix: test isolation for the escalation streak + compliant goal fixtures 2026-10-21 15:08:37 +02:00
cost_ledger_test.go server: skip Postgres-backed tests when no database is configured 2026-11-10 16:28:26 +01:00
customtool.go feat(intercept): gate the rendered targets of custom tools (S3b 1.8) 2026-11-11 15:04:42 +01:00
customtool_target_gate_test.go fix(intercept): match block rules on the declared targets before any lookup 2026-11-11 15:47:58 +01:00
customtool_test.go feat(intercept): gate the rendered targets of custom tools (S3b 1.8) 2026-11-11 15:04:42 +01:00
dto.go feat(intercept): target-gate schema, opt-in flag and approval requests (S3b 1.2-1.4) 2026-11-10 23:05:47 +01:00
engine.go feat(guard): planner and main-agent hooks, target-gate scope in every session (S3b 1.1) 2026-11-10 22:14:24 +01:00
engine_cancelcause_test.go 重构 worker 对话:复用 resume 机制,改专属 goroutine 运行 2026-08-31 09:00:21 -04:00
engine_emptyturn_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
engine_llm_calls_test.go feat(llm): add profile failover and pool health 2026-08-24 19:28:18 +08:00
engine_timeout.go feat(guard): planner and main-agent hooks, target-gate scope in every session (S3b 1.1) 2026-11-10 22:14:24 +01:00
env_scrub.go fix(security): scrub startup secrets before any child can spawn 2026-11-03 22:14:35 +01:00
env_scrub_test.go fix(security): apply New options so the secret scrub actually runs 2026-11-03 23:47:49 +01:00
finding_retests.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
finding_retests_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
finding_traffic.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
finding_traffic_export.go feat: 支持漏洞关联多条流量证据 2026-09-10 13:03:20 +08:00
finding_traffic_test.go server: skip Postgres-backed tests when no database is configured 2026-11-10 16:28:26 +01:00
finding_verification.go fix(verification): decode gzip/deflate response bodies before the S1 quote check 2026-11-10 12:33:40 +01:00
finding_verification_decode_test.go test(verification): lock that an empty bound body never satisfies a quote 2026-11-10 12:52:56 +01:00
finding_verification_test.go test: use an 8+ rune quote in the unreadable-store case 2026-11-09 20:43:25 +01:00
finding_workflow.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
finding_workflow_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
findings_groups.go feat: verification status badge, filter and note in the findings UI 2026-11-09 21:04:12 +01:00
findings_groups_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
goal_gate.go feat(engine): ouroboros takes - goal ambiguity gate, failover escalation, stagnation surfacing 2026-10-21 14:46:56 +02:00
goal_gate_test.go feat(engine): ouroboros takes - goal ambiguity gate, failover escalation, stagnation surfacing 2026-10-21 14:46:56 +02:00
goals.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
goals_api.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
goals_test.go feat(tasks): add runtime controls and inherited context 2026-08-24 19:29:00 +08:00
inheritance_api_test.go fix: inheritance test teardown closes the manager after the DeleteTask cleanups 2026-10-12 18:43:41 +02:00
inheritance_dto_test.go feat(tasks): add runtime controls and inherited context 2026-08-24 19:29:00 +08:00
intent_intervention.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
intercept.go feat(intercept): target extraction, resolver, exemptions and the gate in the hook (S3b 1.5-1.7) 2026-11-11 00:34:55 +01:00
intercept_decided_by_test.go feat: show and filter the decided_by actor in the approval records 2026-11-09 22:35:09 +01:00
intercept_detail_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
intercept_filter_test.go fix(intercept): judge decisions were stored as unknown (prefix case mismatch) 2026-11-09 12:22:46 +01:00
intercept_live_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
intercept_review_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
lessons.go feat(rsi): evidence-gated lesson library in shadow mode 2026-10-21 14:25:35 +02:00
lessons_test.go feat(rsi): evidence-gated lesson library in shadow mode 2026-10-21 14:25:35 +02:00
llm_key_endpoint_test.go fix(llm): validate custom User-Agent in the connection-test path 2026-11-08 18:15:33 +01:00
llm_ollama_test.go server: skip Postgres-backed tests when no database is configured 2026-11-10 16:28:26 +01:00
llm_test_fallback_test.go server: skip Postgres-backed tests when no database is configured 2026-11-10 16:28:26 +01:00
llmpool.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
llmpool_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
llmrec_raw_test.go feat(llmrec): 录制 LLM 请求/响应 HTTP 原文 2026-08-25 09:40:05 -04:00
llmretry.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
llmretry_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
login_limit.go fix(auth): trusted proxies for the login rate limit, 12 characters in reset-password.sh 2026-11-05 16:57:48 +01:00
login_limit_test.go fix(auth): trusted proxies for the login rate limit, 12 characters in reset-password.sh 2026-11-05 16:57:48 +01:00
logsink.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
manager.go feat(intercept): target extraction, resolver, exemptions and the gate in the hook (S3b 1.5-1.7) 2026-11-11 00:34:55 +01:00
manager_delete_files_test.go feat(tasks): add runtime controls and inherited context 2026-08-24 19:29:00 +08:00
manager_lifecycle_test.go feat(tasks): add runtime controls and inherited context 2026-08-24 19:29:00 +08:00
mcp_health_test.go feat: surface MCP server connect health to operators and agents 2026-10-11 22:50:00 +02:00
mcpdiscover.go feat: surface MCP server connect health to operators and agents 2026-10-11 22:50:00 +02:00
mgmt_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
notifier.go notify: make the summary and asset limits configurable 2026-11-10 16:05:31 +01:00
notify_api.go notify: make the summary and asset limits configurable 2026-11-10 16:05:31 +01:00
notify_api_test.go notify: make the summary and asset limits configurable 2026-11-10 16:05:31 +01:00
orchestration.go Merge pull request #130 from kiserufetch/fix/list-task-credentials-empty-required 2026-11-10 10:43:29 +01:00
planner_quiet_test.go server: skip Postgres-backed tests when no database is configured 2026-11-10 16:28:26 +01:00
platform_tools.go feat: ask_operator tool - workers can request operator input (captcha/OTP) with a screenshot and pause 2026-10-11 23:06:39 +02:00
platform_tools_test.go chore: ARTEX 初始化 2026-07-26 04:27:45 -04:00
prompt_vars_test.go 同步 2026-08-24 14:14:15 +08:00
scheduler.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
server.go feat(intercept): target extraction, resolver, exemptions and the gate in the hook (S3b 1.5-1.7) 2026-11-11 00:34:55 +01:00
server_mgmt.go feat(llm): optional custom User-Agent for LLM requests 2026-11-08 17:11:43 +01:00
shipped_skills_test.go feat: codeaudit skill (white-box source audit pipeline) 2026-10-12 06:41:22 +02:00
side_questions.go feat(llm): optional custom User-Agent for LLM requests 2026-11-08 17:11:43 +01:00
side_questions_test.go feat(intent): 意图删除支持假删除/真删除两种模式 2026-09-17 12:52:57 -04:00
skill_frontmatter_test.go fix: emit safe skill frontmatter YAML and verify it round-trips 2026-10-11 22:26:22 +02:00
skill_gaps.go feat(server): capability-gap report from skill misses 2026-10-19 00:33:08 +02:00
skill_gaps_test.go feat(server): capability-gap report from skill misses 2026-10-19 00:33:08 +02:00
skill_upload_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
skill_usage.go feat(skills): track usage and missing dependencies 2026-08-24 19:30:14 +08:00
skill_zip.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
sync_scopesentry.go feat: rea reverse-engineering skill + per-server MCP HTTP request timeout 2026-10-11 19:02:23 +02:00
target_gate_flag_test.go feat(intercept): target-gate schema, opt-in flag and approval requests (S3b 1.2-1.4) 2026-11-10 23:05:47 +01:00
target_gate_scope_test.go feat(intercept): target extraction, resolver, exemptions and the gate in the hook (S3b 1.5-1.7) 2026-11-11 00:34:55 +01:00
target_gate_wiring_test.go feat(intercept): target extraction, resolver, exemptions and the gate in the hook (S3b 1.5-1.7) 2026-11-11 00:34:55 +01:00
task_admission_test.go 同步 2026-08-24 14:14:15 +08:00
task_archive_package.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
task_archive_package_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
task_archives.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
task_archives_test.go 归档 2026-08-28 12:56:29 +08:00
task_assets.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
task_categories.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
task_categories_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
task_control.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
task_control_routes_test.go feat(tasks): add runtime controls and inherited context 2026-08-24 19:29:00 +08:00
task_credentials.go feat(tasks): per-task test-account credentials 2026-10-09 14:28:08 +02:00
task_credentials_test.go fix: test isolation for the escalation streak + compliant goal fixtures 2026-10-21 15:08:37 +02:00
task_delete_barrier_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
task_detail_metrics_test.go fix(server): fill task metrics on the detail endpoint 2026-10-13 14:49:47 +02:00
task_intercept.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
task_llm.go Merge pull request #114 from BaaRai/feat/per-intent-llm-rotation 2026-10-21 15:13:56 +02:00
task_llm_escalation_test.go fix(test): escalation test to the ctx-aware hooks.current signature 2026-10-21 15:16:25 +02:00
task_llm_rotation_test.go feat(engine): per-intent LLM chain-head rotation (opt-in llm_rotate) 2026-10-21 15:00:16 +02:00
task_llm_test.go Merge pull request #114 from BaaRai/feat/per-intent-llm-rotation 2026-10-21 15:13:56 +02:00
task_metadata.go feat(intercept): target-gate schema, opt-in flag and approval requests (S3b 1.2-1.4) 2026-11-10 23:05:47 +01:00
task_metadata_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
task_outcome.go feat(server): per-task outcome card for RSI baselines 2026-10-19 00:28:27 +02:00
task_outcome_test.go feat(server): per-task outcome card for RSI baselines 2026-10-19 00:28:27 +02:00
task_pause_deadline_test.go fix(tasks): freeze the timeout budget while a task is paused 2026-10-09 11:37:30 +02:00
task_resolution.go ollama llm 2026-10-23 18:12:38 -03:00
task_templates.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
task_templates_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
testmain_test.go server: skip Postgres-backed tests when no database is configured 2026-11-10 16:28:26 +01:00
tool_usage.go 抽屉优化 2026-08-25 12:05:26 +08:00
tool_usage_test.go 抽屉优化 2026-08-25 12:05:26 +08:00
tools_wire_test.go fix(tools): harden obj against blank required names and heal seeded list_task_credentials rows 2026-11-10 09:46:49 +01:00
traffic_ingest.go Traffic ingest: capture operator browsing via a browser extension 2026-10-11 14:53:08 +02:00
traffic_ingest_test.go server: skip Postgres-backed tests when no database is configured 2026-11-10 16:28:26 +01:00
trigger_merge_test.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
triggers.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
webui_embed.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
webui_stub.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00
worker_message_test.go 重构 worker 对话:复用 resume 机制,改专属 goroutine 运行 2026-08-31 09:00:21 -04:00
workspace.go Translate all Chinese text to English 2026-10-08 23:14:34 +02:00