mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-12-03 13:11:05 +00:00
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. |
||
|---|---|---|
| .. | ||
| activity_page_test.go | ||
| asset_dsl.go | ||
| asset_intercept.go | ||
| asset_intercept_match.go | ||
| asset_intercept_match_test.go | ||
| assets.go | ||
| assets_test.go | ||
| chat_mentions.go | ||
| commands.go | ||
| companies.go | ||
| companies_test.go | ||
| company_lock_test.go | ||
| company_scope.go | ||
| company_scope_consistency_test.go | ||
| company_scope_test.go | ||
| config.go | ||
| config_max_tokens_test.go | ||
| config_test.go | ||
| constants.go | ||
| constraints.go | ||
| conversation.go | ||
| conversation_pin_test.go | ||
| customtool_test.go | ||
| db.go | ||
| db_test.go | ||
| digest.go | ||
| exploration.go | ||
| exploration_sources.go | ||
| exploration_sources_test.go | ||
| exploration_test.go | ||
| exploration_tokens_test.go | ||
| export_test.go | ||
| finding_assets.go | ||
| finding_assets_test.go | ||
| finding_retests.go | ||
| finding_retests_test.go | ||
| finding_retests_verification_test.go | ||
| finding_traffic.go | ||
| finding_traffic_archive.go | ||
| finding_traffic_archive_test.go | ||
| finding_verification.go | ||
| findings.go | ||
| findings_test.go | ||
| intent_admission.go | ||
| intent_claim_test.go | ||
| intent_control_test.go | ||
| intent_delete_test.go | ||
| intercept.go | ||
| intercept_decided_by_test.go | ||
| intercept_detail.go | ||
| intercept_detail_test.go | ||
| intercept_execution.go | ||
| intercept_execution_test.go | ||
| intercept_filter_test.go | ||
| intercept_seed_test.go | ||
| intercept_source_test.go | ||
| jsonb_clean_test.go | ||
| lessons.go | ||
| lessons_test.go | ||
| llm_records_migrate_test.go | ||
| llm_usage.go | ||
| llmhealth.go | ||
| llmretry.go | ||
| llmretry_test.go | ||
| logs.go | ||
| nkey.go | ||
| notification.go | ||
| notification_delivery.go | ||
| notification_test.go | ||
| schema.sql | ||
| settings.go | ||
| settings_insert_test.go | ||
| side_questions.go | ||
| side_questions_test.go | ||
| skill_gaps.go | ||
| skill_usage.go | ||
| skill_usage_test.go | ||
| target_pins.go | ||
| target_pins_test.go | ||
| task_archive_aggregate_stats.go | ||
| task_archives.go | ||
| task_archives_restore.go | ||
| task_archives_test.go | ||
| task_assets.go | ||
| task_assets_context.go | ||
| task_assets_test.go | ||
| task_categories.go | ||
| task_categories_test.go | ||
| task_context.go | ||
| task_context_lock_test.go | ||
| task_context_unit_test.go | ||
| task_credentials.go | ||
| task_delete_concurrency_test.go | ||
| task_intercept.go | ||
| task_list_performance_test.go | ||
| task_metadata_test.go | ||
| task_outcome.go | ||
| task_queue_test.go | ||
| task_scope.go | ||
| task_scope_test.go | ||
| task_source_limit_test.go | ||
| task_templates.go | ||
| task_templates_test.go | ||
| tasks.go | ||
| tasks_test.go | ||
| testmain_test.go | ||
| tool_usage.go | ||
| tool_usage_test.go | ||
| tools.go | ||
| triggers.go | ||