Expand description
Outbound network allowlist / denylist for HTTP tools.
Applied to tools that open arbitrary or fixed remote URLs (webfetch,
websearch, GitHub REST helpers). Shell network remains binary
(security.sandbox_network); domain filtering for shell would need a
userspace proxy and is out of scope here.
§Semantics
- Empty allowlist → all hosts allowed (subject to denylist).
- Non-empty allowlist → host must match at least one pattern.
- Denylist always wins over allowlist.
§Pattern syntax
example.com— apex and any subdomain (api.example.com).*.example.com— subdomains only (not the apex).*— match any host.
Matching is case-insensitive. Ports and userinfo are stripped before match.
Structs§
- Network
Policy - Resolved network policy carried on
crate::ToolContext.
Functions§
- host_
from_ url - Extract hostname from an
http://orhttps://URL. - host_
matches_ pattern - Whether
hostmatches a single pattern (see module docs). - normalize_
host - Lowercase host, strip trailing dots and IPv6 brackets.
- parse_
domain_ list - Split a comma- or whitespace-separated env list into patterns.