Repository navigation
Description
Part of #13623. Found comparing our connector egress against an external implementation of the same problem (docs/research/connector-credential-egress-audit.md).
Not a duplicate of #13204 — that issue is scoped to the four browser execution paths and never mentions connectors or integrations. This is a separate family.
Connectors with a user-configured host reach it over bare aiohttp, with no URL guard
These read a host from stored connector config and string-concatenate it into the request URL:
| connector | config key | concat site |
|---|---|---|
knowledge/connectors/confluence.py:92 |
base_url |
:225 |
knowledge/connectors/jira.py:100 |
base_url |
:240 |
knowledge/connectors/gitlab.py:134 |
gitlab_url |
:135 |
knowledge/connectors/gitlab.py:486 (Gitea) |
gitea_url |
:487 |
knowledge/connectors/nextcloud.py:94 |
nextcloud_url |
:113 |
integrations/base.py:125-149 |
per-integration | builds a bare aiohttp.ClientSession per request |
Grepped all of the above for is_public_url|ssrf_guard|pinned_connector: zero hits. The guard exists (autobot_shared/security/ssrf_guard.py) and simply is not wired into this family.
Why it was probably never guarded — and the fix that resolves the conflict
A self-hosted Confluence / GitLab / Nextcloud instance legitimately lives on a private network, so applying is_public_url as-is would break the feature it is meant to protect. That is very likely why nobody added it.
The pattern that resolves this conflict is a deployment-gated opt-in:
- A deployment flag permits RFC-1918 / private targets while still hard-blocking reserved, loopback, link-local, and cloud-metadata addresses — those stay blocked even with the flag on.
- The opt-in applies only to the trusted, operator-configured instance host. User-supplied content/download URLs are validated public-only, unconditionally, with a separate non-private-aware fetcher.
Delta we need
autobot_shared/url_safety.py:88-96 collapses private / loopback / link-local / multicast / reserved into a single boolean:
def _ip_is_public(ip) -> bool:
if ip.is_private or ip.is_loopback or ip.is_link_local or ip.is_multicast or ip.is_reserved or ip.is_unspecified:
return False"Private" has to become separable from the rest so it can be selectively permitted while the others stay hard-blocked.
Scope
- Split
_ip_is_public; addallow_private: bool = Falsethreaded throughis_public_url/is_public_url_async/resolve_safe_ip_async. - Add the deployment flag (default off).
- Validate the configured base URL once at config-store time (not per request) with the opt-in applied.
- Route the six connectors' egress through the guarded fetch.
- Add the rule to
docs/developer/CLAUDE_RULES.md: all outbound connector/integration HTTP goes through the guarded fetch; the private-network opt-in covers the operator-configured instance host only, never user-supplied URLs. The rule currently lives only in a docstring insidessrf_guard.py, which is plausibly why six connectors were written against bareaiohttpwithout anyone noticing.
Acceptance criteria
-
_ip_is_publicsplit; private separable from reserved/loopback/link-local/metadata - Deployment flag defaults off; loopback/link-local/metadata blocked in both states
- All six sites route through the guarded fetch
- Test: flag off → private base URL rejected; flag on → private base URL accepted, metadata address still rejected
- Test: the opt-in does not leak into content-URL fetching
- Rule block landed in
CLAUDE_RULES.md
Activity
security(egress): add the private-network egress flag and the guarded…
chore: merge auto-fix formatting (#13625)
mrveiss commentedon Aug 8, 2026
Item 4's premise has changed since filing — reporting before implementing
The issue describes six connectors that "reach it over bare
aiohttp" and build "a bareaiohttp.ClientSessionper request". That is no longer what the code does. Measured on currentDev_new_gui:Confluence, Jira, GitLab, Gitea and Nextcloud now go through the shared client —
get_http_client().tracked_request(...)— and importaiohttponly forBasicAuth,ClientTimeoutand exception types. So the six sites are one seam, not six.The finding itself still stands:
autobot_shared/http_client.pycontains zero references tois_public_url,pinned_connectororssrf_guard. The egress is unguarded. Only the shape of the fix changes.Why I am not simply guarding the shared client
tracked_requestdelegates toHTTPClientManager.request(), which is the single choke point — and that is exactly the problem:Guarding
request()wholesale would apply connector egress policy to 81 unrelated call sites, including internal service-to-service traffic (NPU workers, SLM nodes) that legitimately targets private addresses. With the flag off by default, that would break internal traffic the moment it merged; with the flag on, it would silently widen egress policy for everything.Recommendation
A guarded entry point that connectors opt into, rather than a blanket change to a shared utility:
allow_private: bool | None = NonetoHTTPClientManager.request(), defaulting to no guarding at all — behaviour identical to today for all 103 callers.ssrf_guardwith that opt-in, per Rule 8.That keeps the fix at one seam, leaves 81 callers untouched, and makes "this request is guarded" visible at the call site instead of implicit in a shared default.
The alternative — guarding
request()for everyone and adding escape hatches for internal traffic — inverts the default in a way that fails open for anything that forgets to opt out, which is the failure mode Rule 8 exists to prevent.Proceeding on the recommendation unless told otherwise; recording it here rather than deciding it silently, since it deviates from the issue's prescribed scope.
security(egress): add an opt-in SSRF guard to the shared HTTP client (#…
test(egress): pin the opt-in guard contract and its inert default (#1…
fix(egress): keep the one-argument call shape on the default async pa…
chore: merge auto-fix formatting (#13625)
chore: update from Dev_new_gui (#13625)
security(connectors): route confluence, jira and audio downloads thro…
mrveiss commentedon Aug 8, 2026
Item 4 started — the two URL classes, wired distinctly
base.pynow carries the policy decision once, so no call site re-derives it:Wired so far, each classified by where the URL actually comes from:
confluence.py:229base_urlinstance_host_egress()jira.py:244base_urlinstance_host_egress()audio_connector.py:381CONTENT_URL_EGRESSThat last row is the distinction Rule 8 exists for.
_download_direct_url(url, ...)takes its URL as a parameter, not from configuration — if it inherited the instance-host exemption, a document could name169.254.169.254and turn the connector into an SSRF vector against the operator's own network.Verified end-to-end through the shared client rather than by inspection:
Note on
nextcloud.py:165file_url = urljoin(self._webdav_base, encoded_path)derives from the instance base, so it is instance-host traffic despite looking like a content download. Classifying it by name rather than by origin would have got it wrong in the safe-looking direction. Remaining sites (nextcloud x3, gitlab, gitea, and the integrations) follow next.12 remaining items
feat(mcp): thread an opt-in egress guard through MCPClient's remote t…
feat(mcp): thread an opt-in egress guard through MCPClient's remote t…
feat(mcp): thread an opt-in egress guard through MCPClient's remote t…
mrveiss commentedon Sep 20, 2026
Session ending (weekly token limit, owner call to drop concurrency). Not started -- no branch checks, no code reading done on this issue yet. Handing off as-is so the next session doesn't assume any progress here.
Context that may help: this issue was in a batch of 15 open security issues with unlanded branch work, dispatched by autobot-ai-df (queue coordinator) as part of a repo-wide stale-branch audit. Before touching any assigned branch, verify supersession first (compare each touched file's blob at branch tip against origin/main -- several branches in this same batch turned out to be stale pre-merge duplicates of already-merged PRs). Also check autobot-ai-df's trap.json scan (revival hazard: a branch whose removed lines cite an issue number lower than a later fix to the same file) before reviving anything -- this issue may or may not be on it, worth checking fresh.
mrveiss commentedon Oct 4, 2026
Closing — every criterion verified against merged
main@8bd2d70b04.The guard is split so private is separable from hard-blocked.
autobot_shared/url_safety.py:138Hard-blocked is checked first and unconditionally, so the opt-in cannot reach loopback, link-local or the cloud metadata address in either state. Threaded through
is_public_url(:152) andis_public_url_async(:203).The deployment flag defaults off.
autobot_shared/ssot_config.py:2181—connector_private_network_egress: bool = Field(default=False, alias="AUTOBOT_CONNECTOR_PRIVATE_NETWORK_EGRESS").url_safety_test.py:353-354asserts each hard-blocked kind is refused with the flag both off and on, which is the assertion that makes the split safe rather than merely present.All six sites route through the guarded fetch, each passing
guard_egress=instance_host_egress()onget_http_client().tracked_request(...):confluence.py:236,jira.py:252,gitlab.py:416(GitLab) and:782(Gitea),nextcloud.py:130/:180/:282,integrations/base.py:151.Tests cover both directions and the leak.
http_client_test.py:289 test_egress_guard_permits_private_only_with_the_opt_in; andknowledge/connectors/egress_policy_test.py:43 test_content_urls_never_use_the_instance_host_opt_in— the one that matters most, since the risk of an instance-host opt-in is that it silently widens content fetching too.The rule is recorded where the next author meets it:
docs/developer/CLAUDE_RULES.md:368, Rule 8 — every outbound connector/integration request must declare an egress policy.fix(egress): four knowledge connectors go through the egress guard, a…