Repository navigation
Description
Problem
#898 ("PR A") added the connect-time egress check: devops_cli.http.egress (EgressLevel, vet_addresses/avet_addresses, VettingBackend/AsyncVettingBackend) and the factory in devops_cli.http.client. It moved the broker, the shared pool, web_fetch, Jaeger, the sandbox probe, tool downloads and the existing factory callers onto them. Every other client still builds a raw httpx2.Client / httpx2.AsyncClient or calls httpx2.get/post. Those clients check a hostname before the dial (some check nothing) and let httpx2 resolve it again at the socket, which is the rebinding window #898 closed for the moved callers.
Scope (the PR B part of #898's body, now its own issue)
- Move the remaining raw clients to
new_http_client/new_async_http_client/get_shared_clientat the levels in fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898's level table:- fixed public APIs at public: GitHub
github/graphql.py,github/ssh.py; Cloudflarecloudflare/client.py; OSV, InternetDB and Radarsecurity/vulnerability_lookup.py; the pricing registryai/spend/pricing.py; - configured: the AI providers
ai/providers/*, embeddingsai/rag/embeddings.py, the pydantic-ai Ollama modelai/models/ollama.py, the gateway and backend probesai/gateway.pyandcommands/ai_gateway.py, the benchmark runners, Grafana (commands/grafana.py), ArgoCD (commands/argo.py,argo/*), the ArgoCD and Grafana session and token checksk8s/credentials.py, the Prometheus commands,devops ai cost --source; - private: Loki
k8s/logql.py, the pool-load queryai/pool_load.py, the OTLP exporter and connection probetelemetry/tracer.py(which validates no URL today); - loopback: the sandbox metrics scrape
sandbox/metrics.py.
- fixed public APIs at public: GitHub
- Delete the pre-flight address checks those clients make, except the callers listed under fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898's pre-flight key question: qdrant-client,
devops k8s apply, the container engine endpoint (fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108), Valkey GLIDE (fix(valkey): one validated URL names every Valkey endpoint, valkey-py dials an address that one check vetted, and the unused cache layer goes #1113), the PlaywrightBrowser stub (fix(security): local names come from the public suffix list, and domains match on DNS labels, not string suffixes #887), the sandbox CIDR builders and the config wizard. Each one left callsvet_addressesat its level and names its time-of-check gap in a docstring. This also removes the pre-flight atk8s/service_http.py(direct URLs). - Delete
_resolve_host_ipsand_enforce_non_private_ssrf(core/validation.py). - Documentation crawler (
ai/library/docs_ingester.py): public-only factory client. Coordinate with fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112: whichever of the two lands second moves the crawler. github/client.py: after refactor(github): the github session owns transport, ledger, error classes and link pagination #983 lands.- Update the docs that fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898 left naming only the factory-built clients as checked at the connect: the SSRF paragraph in
AGENTS.md,.devops/review.md,README.md,docs/ROUTINE_TASKS.md, the knowledge base'slibraries/httpx2.mdand theHALLUCINATION-INTERNAL-SERVICE-PRIVATE-NETWORKcatalog entry.
Acceptance criteria
-
rg -n -g '*.py' '_resolve_host_ips|_enforce_non_private_ssrf' srcprints nothing. -
rg -n -g '*.py' 'httpx2\.((Async)?Client|get|post|put|patch|delete|head|request|stream)\(' srclists onlysrc/devops_cli/http/client.py, plusgithub/client.pyuntil refactor(github): the github session owns transport, ledger, error classes and link pagination #983 lands. - The level-table test in
tests/test_http_egress.py(test_each_caller_dials_at_its_level) covers every moved caller, with and withoutai.allow_private_network. Each narrower or wider row has a case that fails on the code before the move. - Address pre-flight checks remain only at the callers listed above.
- The review guidance and docs say every HTTP client is checked at the connect only once that is true.
- Tests stay offline (ScriptedResolver and ConnectRecorder in
tests/web_fakes.py), each call phase stays under 1 s, anduv run devops cipasses.
Context
Split from #898: readiness requires a PR to close exactly one issue, and #898's task file reads Done in the PR A commit. Depends on #898. Related: #1001 (AI clients take a factory client but stay off the broker), #1112, #983, #1108, #1113, #887.
Split from #898 on 2026-10-08 (borrow reason: split). Filed directly with no priority; the roadmap service's intake sets Priority, Value and Effort.
Update 2026-10-08: refinement
github/graphql.py is gone; the raw GitHub clients move with #983, and #1331 deletes the legacy providers' clients. #1001 rebuilds create_pydantic_ai_provider on the factory. #1319 moves the tracer clients.
- (replaces the second criterion) The httpx2
rglists onlyhttp/client.py, plusgithub/until refactor(github): the github session owns transport, ledger, error classes and link pagination #983 and the legacy providers until test(ai): the remaining ai modules are tested through their public interfaces on edge fakes, and the legacy provider layer leaves src #1331.
Proposed design
Problem statement
The remaining HTTP clients in devops-cli build raw httpx2 connections that check a hostname before the dial. httpx2 then resolves the name again at the socket, which opens a DNS rebinding window. This issue moves every such client to the egress-checked factory so the address is checked at the connect. It also deletes the pre-flight resolve functions and updates the documentation to state that every client is checked at the connect.
Acceptance criteria
- Criterion 1: The pre-flight resolve functions are deleted from the codebase.
Verification: Runrg -n -g '*.py' '_resolve_host_ips|_enforce_non_private_ssrf' srcand confirm it prints nothing. - Criterion 2: Only the factory and the deferred callers build raw httpx2 connections.
Verification: Runrg -n -g '*.py' 'httpx2\.((Async)?Client|get|post|put|patch|delete|head|request|stream)\(' srcand confirm the output lists onlysrc/devops_cli/http/client.py, plusgithub/until refactor(github): the github session owns transport, ledger, error classes and link pagination #983 lands and the legacy providers until test(ai): the remaining ai modules are tested through their public interfaces on edge fakes, and the legacy provider layer leaves src #1331 lands. - Criterion 3: The level-table test covers every moved caller with a failing case on the pre-move code.
Verification: Runuv run pytest tests/test_http_egress.py -k test_each_caller_dials_at_its_level -vand confirm each moved caller has a row, with and withoutai.allow_private_network, and each narrower or wider row fails on the code before the move. - Criterion 4: Address pre-flight checks remain only at the callers listed in the issue body.
Verification: Runrg -n 'vet_addresses' srcand confirm the results are limited to the callers that fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898's pre-flight key question names (qdrant-client, k8s apply, container engine, Valkey GLIDE, PlaywrightBrowser stub, sandbox CIDR builders, config wizard) plusk8s/service_http.py. - Criterion 5: The review guidance and project docs state that every HTTP client is checked at the connect.
Verification: ReadAGENTS.md,.devops/review.md,README.md,docs/ROUTINE_TASKS.md, the knowledge baselibraries/httpx2.md, and theHALLUCINATION-INTERNAL-SERVICE-PRIVATE-NETWORKcatalog entry. Confirm each one says every HTTP client is checked at the connect and no longer names only the factory-built clients. - Criterion 6: Tests run offline and the full CI suite passes.
Verification: Runuv run devops ciand confirm it passes. Confirm tests useScriptedResolverandConnectRecorderfromtests/web_fakes.pyand each call phase stays under 1 second.
Key questions
- Which clients are in scope after the 2026-10-08 refinement update?: The AI and data services (embeddings, gateway, ai_gateway, pool_load, pricing, docs_ingester, vulnerability_lookup), the Prometheus commands, Loki, Grafana, Argo CD, sandbox metrics scrape, Cloudflare, and the k8s credentials checks. The GitHub clients move with refactor(github): the github session owns transport, ledger, error classes and link pagination #983, the legacy providers are deleted by test(ai): the remaining ai modules are tested through their public interfaces on edge fakes, and the legacy provider layer leaves src #1331, the pydantic-ai provider is rebuilt by refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001, and the tracer clients are moved by refactor(telemetry): OTLP export goes through one exporter seam, and tests read exported spans and metrics from a shared fake #1319. [sources: src/devops_cli/ai/rag/embeddings.py, src/devops_cli/ai/gateway.py, src/devops_cli/commands/ai_gateway.py, src/devops_cli/ai/pool_load.py, src/devops_cli/ai/spend/pricing.py, src/devops_cli/ai/library/docs_ingester.py, src/devops_cli/security/vulnerability_lookup.py, src/devops_cli/commands/prometheus.py, src/devops_cli/k8s/logql.py, src/devops_cli/commands/grafana.py, src/devops_cli/k8s/credentials.py, src/devops_cli/commands/argo.py, src/devops_cli/argo/fleet.py, src/devops_cli/argo/gitops.py, src/devops_cli/sandbox/metrics.py, src/devops_cli/cloudflare/client.py]
- Does refactor(cli): Unify HTTP and DNS seams with shared fakes #1314 duplicate this issue?: Intake flagged refactor(cli): Unify HTTP and DNS seams with shared fakes #1314 as a possible duplicate because both name the change of moving HTTP clients to the egress-checked factory. A person must close one of the two if they ask for the same result and the same acceptance criteria. (proposed)
- Which pre-flight checks remain after the move?: The callers listed under fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898's pre-flight key question keep their checks: qdrant-client,
devops k8s apply, the container engine endpoint (fix(docker): the Docker endpoint check covers the endpoint the SDK dials, including contexts and the TUI, and pushes accept registry ports #1108), Valkey GLIDE (fix(valkey): one validated URL names every Valkey endpoint, valkey-py dials an address that one check vetted, and the unused cache layer goes #1113), the PlaywrightBrowser stub (fix(security): local names come from the public suffix list, and domains match on DNS labels, not string suffixes #887), the sandbox CIDR builders, and the config wizard. Each callsvet_addressesat its level and names its time-of-check gap in a docstring. The pre-flight atk8s/service_http.pyis also removed. [sources: src/devops_cli/k8s/service_http.py, src/devops_cli/core/validation.py] - What egress level does each moved client use?: Fixed public APIs (GitHub, Cloudflare, OSV, InternetDB, Radar, pricing registry) use the public level. Configured services (AI providers, embeddings, Ollama model, gateway probes, benchmark runners, Grafana, ArgoCD, credentials checks, Prometheus,
devops ai cost --source) use the configured level. Internal infrastructure (Loki, pool-load, OTLP exporter) uses the private level. The sandbox metrics scrape uses the loopback level. [sources: src/devops_cli/http/egress.py, src/devops_cli/http/client.py] - Who moves the documentation crawler in
ai/library/docs_ingester.py?: This issue and fix(security): URL and host:port reads use the sending client's parser, so key trust, crawls, probes and settings act on the host actually dialled #1112 coordinate: whichever of the two lands second moves the crawler onto the public-only factory client. (proposed)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
Sub-issues
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
- StatusShow more project fieldsNew
Activity
dan-petty-bot commentedon Oct 8, 2026
Closed as a duplicate of #898:
The candidate is explicitly the 'PR B part of #898's body, now its own issue,' and #898's scope already includes 'PR B moves the remaining clients and deletes the old resolve paths.'If it is not a duplicate, reopen it: intake then places it without the duplicate check.
dan-petty commentedon Oct 8, 2026
Reopening. #1382 closed #898 with "PR A" only, and its body moves the remaining clients, the pre-flight deletions, the docs crawler and
github/client.pyhere. Intake then closed this issue as a duplicate of #898, so nothing tracks the move any more.These sites still build raw clients outside the egress-checked factory at release/v0.2.29 (05e9388).
AI and data services (15 sites):
ai/rag/embeddings.py:380,:629,:659,:796ai/gateway.py:250,:384,:591commands/ai_gateway.py:174ai/pool_load.py:49ai/spend/pricing.py:463,:472ai/library/docs_ingester.py:247security/vulnerability_lookup.py:185,:307,:377Dead code that #1005 or #1331 deletes:
ai/providers/anthropic.py:77,ai/providers/openai.py:62,ai/providers/ollama.py:37,:65.pydantic-ai providers.
create_pydantic_ai_providerbuilds them withouthttp_client(ai/providers/__init__.py:104-110, reached fromai/pydantic_ai_bridge.py:136-142), so they use pydantic-ai's own client. If that path survives #1005, they needhttp_client=new_async_http_client(level=configured_level(...)).GitHub (two bare
httpx2.Clientcalls to api.github.com):GitHubClient.get_pr_diff(github/client.py:131-148, client at:140), which also follows a redirect by hand (:142-146); the factory checks each redirect hop at the connect;_add_signing_key(github/ssh.py:148-163, client at:150).The infrastructure sites follow in a separate comment.
Found by the 2026-10-08 client-library audit.
dan-petty commentedon Oct 8, 2026
Raw httpx2 clients in the infrastructure, observability and security slice, checked at 05e9388 (
release/v0.2.29). Each one dials outside the egress factory.telemetry/tracer.py:1213, the OTLP export client (_get_http_client);telemetry/tracer.py:1180, the collector probe;:1143.commands/prometheus.py:144,:198,:280,:334,:376;argo/rollouts.py:92, the rollout metric-gate query.k8s/logql.py:365(module-levelhttpx2.get).commands/grafana.py:106,:158,:219,:334,:452,:492,:529;k8s/credentials.py:315(service-account token mint) and:434(token check).commands/argo.py:203,:256,:285;argo/fleet.py:59;argo/gitops.py:369;k8s/credentials.py:222(session) and:403(token check).sandbox/metrics.py:433.sandbox/probe.pyalready uses the factory (:124,:291); test(infra): infrastructure tests run on edge fakes #1335's:197/:346citation predates that.cloudflare/client.py:286.security/vulnerability_lookup.py:185,:307,:377(OSV, InternetDB, Radar).Items from the same audit touch several of these clients: the tracer (OTel SDK), Loki (LogQL sent unchanged), Argo CD (sync body), Cloudflare (pagination and retry) and the sandbox scrape (prometheus-client). Whichever lands second moves its client onto the factory.
Found by the 2026-10-08 client-library audit.
dan-petty commentedon Oct 8, 2026
Linked: #1317 and #1329 move the embedding clients in this inventory, and #1314 builds the seam on the same factory; whichever lands second builds on the other. Found by the 2026-10-08 backlog review.
dan-petty-bot commentedon Oct 8, 2026
Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.
A known SSRF/rebinding gap remains open for many production HTTP clients, and the fix is already scoped and partially landed via #898.Every unmigrated client is exposed to DNS-rebinding SSRF, so closing the gap protects all users who rely on the egress policy.The scope spans dozens of call sites across many modules, requires deleting legacy helpers, updating six+ docs, adding per-caller level tests, and coordinating with at least three other issues.refactor(review): the review orchestrator and the scanners take the r…
4 remaining items
dan-petty commentedon Oct 27, 2026
Status set to Ready at 15bd601 (see proposed design in issue body).
dan-petty commentedon Oct 28, 2026
The owner approved the split of this issue into five parts on 2026-10-28. Each part is a sub-issue of this issue:
vet_addressesin the sandbox address-range builders._resolve_host_ipsand_enforce_non_private_ssrf, change the kept pre-flight checks tovet_addresses, add thergchecks as ast-grep rules, and update the documents. fix(ai): the ai service clients dial through the egress-checked factory, and their pre-flight address checks go #2422, fix(k8s): the grafana, prometheus, argo cd and loki clients dial through the egress-checked factory, and their pre-flight address checks go #2424, fix(security): the osv, internetdb, radar and cloudflare api clients dial through the egress-checked factory at the public level #2430, fix(sandbox): the metrics scrape loses its pre-flight address check, and the sandbox address-range builders resolve with vet_addresses #2431, refactor(telemetry): OTLP export goes through one exporter seam, and tests read exported spans and metrics from a shared fake #1319 and fix(ai): replies carry their server as an httpx2 origin, so a password in an AI URL stays out of output, the spend ledger, metrics, spans and cache #1110 block it.No pull request closes this issue. This issue closes when all five parts close.
Changes to the scope above, checked on
origin/maind739a47:github/has no raw client now, because refactor(github): the github session owns transport, ledger, error classes and link pagination #983 moved them.commands/k8s/cluster_context.py:197is fordevops k8s apply. kubectl dials that URL, so the check stays as a pre-flight check. Part 5 changes it tovet_addresses.ai/client/*goes to Part 5, after fix(ai): replies carry their server as an httpx2 origin, so a password in an AI URL stays out of output, the spend ledger, metrics, spans and cache #1110, because fix(ai): replies carry their server as an httpx2 origin, so a password in an AI URL stays out of output, the spend ledger, metrics, spans and cache #1110 changes those files.AGENTS.mdhas no SSRF paragraph now, and refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150 deleted the catalog that heldHALLUCINATION-INTERNAL-SERVICE-PRIVATE-NETWORK. Part 5 also updatesdocs/KNOWN_ISSUES.md.dan-petty commentedon Oct 28, 2026
Closed as not planned: five newer issues supersede this issue (AGENTS.md rule 2). The owner approved the split on 2026-10-28, because the remaining scope was about 68 files in six separate areas, too large for one pull request.
The newer issues hold all of the work of this issue:
vet_addresses, and the documents say that every HTTP client is checked at the connect: fix(security): the pre-flight resolve paths go, the kept pre-flight checks call vet_addresses, and the docs say every http client is checked at the connect #2437. It waits for parts 1 to 4 and refactor(telemetry): OTLP export goes through one exporter seam, and tests read exported spans and metrics from a shared fake #1319.This replaces the earlier comment that said this issue closes when all five close. The sub-issue links stay for the history.
fix(ai): the AI service clients dial through the egress-checked facto…
fix(k8s): the grafana, prometheus, argo cd and loki clients dial thro…
fix(sandbox): the metrics scrape and the whitelist NetworkPolicy reso…
docs(openspec): plan the move of the osv, internetdb, radar and cloud…
fix(security): the osv, internetdb, radar and cloudflare api clients …
fix(security): remove pre-flight resolve paths for egress (#2845)