Repository navigation
Description
Problem Description
Part 3 of #1381. The owner approved the split of #1381 into five parts on 2026-10-28.
The clients of four fixed public APIs build a raw httpx2.Client: OSV, Shodan InternetDB, Cloudflare Radar and the Cloudflare API. They make no address check. httpx2 resolves the API host name at the socket and dials each answer. A bad or rebinding DNS answer for api.osv.dev can thus send the request, and the Cloudflare API token, to a loopback, private or link-local address. #898 closed this gap for the callers that it moved to the egress-checked factory (devops_cli.http.client). This part moves these four clients to the factory at the public level.
Scope, with lines on origin/main d739a47 and the level from the #898 level table:
| Caller | Raw client | Pre-flight check that goes | Level |
|---|---|---|---|
OSV (api.osv.dev), OSVClient |
security/vulnerability_lookup.py:212 |
none today | public; the flag does not widen it (narrower) |
Shodan InternetDB (internetdb.shodan.io), ShodanInternetDBClient |
security/vulnerability_lookup.py:366 |
none today | public; the flag does not widen it (narrower) |
Cloudflare Radar (api.cloudflare.com), CloudflareRadarClient |
security/vulnerability_lookup.py:475, :477 |
none today | public; the flag does not widen it (narrower) |
Cloudflare API (api.cloudflare.com), CloudflareClient._request |
cloudflare/client.py:366 |
none today | public; the flag does not widen it (narrower) |
"The flag" is ai.allow_private_network. "Narrower" means that the client refuses an address that it dials today.
Notes:
CloudflareRadarClient.__init__takes atransportargument (security/vulnerability_lookup.py:466) and builds a raw client around it (:475). No caller insrcortestsgives that argument on d739a47. The factory takes no transport, so the argument goes.- Keep the timeouts: a 1 s connect timeout for the three lookup clients, and
request_timeout(read=30.0)for the Cloudflare API. classify_network_targetinShodanInternetDBClient.check_ip(security/vulnerability_lookup.py:374) decides which addresses the client asks about. It does not check the address that the client dials, so it stays.- The callers of these clients do not change:
ai/review/pipeline.py:2974,:2975,ai/tools/builtin_tools.py:487,:521,:537,security/dependency_remediator.py:214andcommands/cloudflare.py:64.
Out of scope: the GitHub clients, which #983 moved.
Reproduction Steps
- On
origin/main(d739a47), runrg -n -g '*.py' 'httpx2\.((Async)?Client|get|post)\(' src/devops_cli/security/vulnerability_lookup.py src/devops_cli/cloudflare/client.py. - In a test, install
scripted_resolver(monkeypatch, {"api.osv.dev": [["10.0.0.1"]]})andrecord_connects(monkeypatch, [])fromtests/web_fakes.py. - Without
ai.allow_private_network, callOSVClient().query_package("requests", version="2.0.0", ecosystem="PyPI"). - Read
recorder.dialled.
Expected vs Actual Behavior
Expected: each client resolves its API host once, at the connect. It dials only public addresses, with or without the flag. A non-public answer gives SSRFBlockedError before the dial. The factory checks each redirect hop the same way.
Actual: step 1 lists the raw clients in the table. In step 4, the client dials 10.0.0.1 on port 443.
Environment Diagnostics
- DevOps CLI Version: 0.8.3 (
origin/maind739a47) - Python Version: 3.14.10
- OS & Architecture: Linux x86_64
- Execution Environment: DevContainer
Logs, Traces, or Terminal Output
src/devops_cli/cloudflare/client.py:366: with httpx2.Client(timeout=timeout) as client:
src/devops_cli/security/vulnerability_lookup.py:212: self._client = httpx2.Client(timeout=httpx2.Timeout(self.timeout, connect=1.0))
src/devops_cli/security/vulnerability_lookup.py:366: self._client = httpx2.Client(timeout=httpx2.Timeout(self.timeout, connect=1.0))
src/devops_cli/security/vulnerability_lookup.py:475: self._client = httpx2.Client(transport=transport, timeout=timeout_spec)
src/devops_cli/security/vulnerability_lookup.py:477: self._client = httpx2.Client(timeout=timeout_spec)Acceptance criteria
These are the criteria of #1381 that apply to this part.
-
rg -n -g '*.py' 'httpx2\.((Async)?Client|get|post|put|patch|delete|head|request|stream)\(' src/devops_cli/security/vulnerability_lookup.py src/devops_cli/cloudflare/client.pyprints nothing. - Each client in the table comes from
new_http_client(level=EgressLevel.PUBLIC, ...).ai.allow_private_networkdoes not change its level. -
CloudflareRadarClienttakes notransportargument. -
test_each_caller_dials_at_its_levelintests/test_http_egress.pyhas a row for each caller in the table, with and withoutai.allow_private_network. The test resolves the API host names (api.osv.dev,internetdb.shodan.io,api.cloudflare.com). Each row fails on the code before the move. - Tests stay offline (
ScriptedResolverandConnectRecorderintests/web_fakes.py), and each call phase stays under 1 s. - If the move makes a document wrong, the same pull request fixes it. The general statement that every HTTP client is checked at the connect waits for Part 5.
- The required CI checks pass.
Related
- Parent: fix(security): move the remaining HTTP clients onto the egress-checked factory and delete the pre-flight resolve paths #1381. This item is Part 3 of 5. fix(security): move the remaining HTTP clients onto the egress-checked factory and delete the pre-flight resolve paths #1381 closes when all five parts close.
- Level table: fix(security): every HTTP client dials only addresses its egress level allows, checked at the connect and on every redirect #898.
- test(cloudflare): the access policy, include-rule, dns and tunnel write paths of the cloudflare client are tested at the http edge #2153 tests the write paths of the Cloudflare client at the HTTP edge. feat(cloudflare): cloudflare commands list their requests in a dry run and make none #2252 gives the Cloudflare commands a dry run. refactor(ai): the embedding LRU cache, the webhook replay guard and the Radar memory cache use cachetools, with a bound and a TTL #1993 changes the Radar memory cache. test(security): scanner, secret and crypto tests run on the executor, process, http and keyring fakes, and scanners stop looking for mocks #1332 moves the security tests to edge fakes. Each of them touches these files. The one that lands second rebases on the other.
- refactor(cli): Unify HTTP and DNS seams with shared fakes #1314 is not a duplicate. It later replaces the factory functions with one HTTP seam. This part moves callers to the factory that exists now.
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Source: #1381
Proposed design
Problem statement
Four public API clients build raw httpx2.Client instances with no address check. A bad or rebinding DNS answer for their API host can send the request, and the Cloudflare API token, to a loopback, private, or link-local address. This issue moves the OSV, Shodan InternetDB, Cloudflare Radar, and Cloudflare API clients to the egress-checked factory at the public level.
Acceptance criteria
- Criterion 1: No raw httpx2 client or request call remains in the two target files.
Verification: Runrg -n -g '*.py' 'httpx2\.((Async)?Client|get|post|put|patch|delete|head|request|stream)\(' src/devops_cli/security/vulnerability_lookup.py src/devops_cli/cloudflare/client.pyand confirm it prints nothing. - Criterion 2: Each of the four clients is built by new_http_client at EgressLevel.PUBLIC, and ai.allow_private_network does not change that level.
Verification: Inspect the four call sites insrc/devops_cli/security/vulnerability_lookup.pyandsrc/devops_cli/cloudflare/client.pyfornew_http_client(level=EgressLevel.PUBLIC, ...). Confirm no reference toallow_private_networkin those files. - Criterion 3: CloudflareRadarClient takes no transport argument.
Verification: Inspect theCloudflareRadarClient.__init__signature insrc/devops_cli/security/vulnerability_lookup.pyand confirm thetransportparameter is absent. - Criterion 4: test_each_caller_dials_at_its_level has a row for each of the four callers, with and without ai.allow_private_network, resolving the real API host names.
Verification: Runpytest tests/test_http_egress.py::test_each_caller_dials_at_its_level -vand confirm rows for OSV, Shodan InternetDB, Cloudflare Radar, and Cloudflare API appear for both flag values. Confirm the rows fail on the pre-move code. - Criterion 5: All new and existing tests in the affected modules stay offline and each call phase stays under 1 s.
Verification: Runpytest tests/test_http_egress.py tests/test_http_egress.py -v --timeout=2and confirm no test exceeds 1 s per call phase and no test opens a real socket. - Criterion 6: If the move makes a document wrong, the same pull request fixes it. The general statement that every HTTP client is checked waits for Part 5.
Verification: Search the repository for statements claiming all HTTP clients are egress-checked and confirm none are added or modified in this pull request beyond the four named clients. - Criterion 7: The required CI checks pass.
Verification: ConfirmStatic Analysis,Tests & Coverage, andSemantic PR titleall report a passing status on the pull request.
Key questions
- What egress level do the four clients receive?: PUBLIC. The scope table in the issue body assigns each client the public level. [sources: src/devops_cli/security/vulnerability_lookup.py, src/devops_cli/cloudflare/client.py]
- Does ai.allow_private_network change the level of these four clients?: No. The flag does not widen the level; the clients stay at PUBLIC with or without the flag. [sources: src/devops_cli/http/client.py]
- What happens to the transport argument of CloudflareRadarClient.init?: It is removed. The factory takes no transport, and no caller in src or tests passes it on d739a47. (proposed) [sources: src/devops_cli/security/vulnerability_lookup.py:466]
- What timeouts are preserved on the moved clients?: A 1 s connect timeout for OSV, Shodan InternetDB, and Cloudflare Radar. A read timeout of 30.0 s for the Cloudflare API. [sources: src/devops_cli/security/vulnerability_lookup.py:212, src/devops_cli/cloudflare/client.py:366]
- Does classify_network_target in ShodanInternetDBClient.check_ip stay?: Yes. It decides which addresses the client asks about, not which address the client dials. It is not an egress check. [sources: src/devops_cli/security/vulnerability_lookup.py:374]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
Activity
dan-petty commentedon Oct 28, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.
The candidate closes an SSRF gap by routing four clients through the egress-checked factory.A DNS rebinding answer can send the Cloudflare API token to a private address, which is a live security risk.It prevents leakage of API tokens to loopback or private addresses via bad DNS answers.The scope is four named call sites; the change is to replace a raw client build with a factory call and keep timeouts.Both work on the HTTP client factory layer; #1314 refactors the factory architecture while this candidate moves four callers to use the existing factory.dan-petty commentedon Oct 28, 2026
Status set to Ready at 19412fa (see proposed design in issue body).
fix(security): the osv, internetdb, radar and cloudflare api clients …