ulysses/services
Ernest Hysa 5e9b415bd9
fix(search): pin httpx connection to resolved IP to block DNS rebinding (#704)
* fix(search): pin DNS-validated fetch connections

Rebase the DNS-rebinding SSRF fix onto current dev after search content moved behind the services.search.content canonical module.

Integrate the pinned httpcore NetworkBackend/BaseTransport approach with the current size-capped Client.stream fetch path, preserving Host/SNI semantics while forcing TCP connect to the already validated resolved IP.

Keep src.search.content as the compatibility wrapper and preserve existing OG-image http(s) behavior; this avoids reintroducing the unrelated scope changes that previously blocked review.

Add the explicit httpcore>=1.0,<2.0 requirement used by the public httpcore NetworkBackend and ConnectionPool APIs.

* test(search): restore and rebase DNS rebinding regressions

Keep the current security regression coverage that the stale PR branch had deleted, including auth-disabled localhost bypass and Ollama cookbook hardening tests.

Carry forward the DNS-rebinding coverage for private resolve blocking, pinned TCP connect behavior, Host header preservation, redirect revalidation, and the BaseTransport/public-httpcore static guard.

Update redirect tests to mock the current Client.stream-based capped fetch path rather than the older httpx.stream/get path.

* test(search): adapt size-cap fetch tests to pinned client stream

The DNS-rebinding repair moved _get_public_url from the module-level httpx.stream shortcut to httpx.Client(...).stream(...) so the fetch can use the pinned transport.

Keep the existing size-cap test fakes by routing Client.stream through the monkeypatched httpx.stream only when a test has installed that fake; otherwise fall back to a real Client.

This fixes the CI failures in tests/test_web_fetch_size_caps.py without touching unrelated upload-handler atomicity behavior, which is already flaky on clean origin/dev.

---------

Co-authored-by: Alexandre Teixeira <alexandremagteixeira@gmail.com>
2026-07-02 13:08:06 +01:00
..
docs refactor(constants): single source of truth for data dir (#3368) 2026-06-08 09:58:52 +02:00
faces Odysseus v1.0 2026-05-31 23:58:26 +09:00
hwfit Stabilize chat and cookbook workflows 2026-07-01 10:09:25 +00:00
memory fix(agent): skill-prescribed tools never reach the model's schema list (#4008) 2026-06-15 20:32:43 +09:00
research fix(research): track analyzed URLs separately (#3125) 2026-06-10 12:08:22 +01:00
search fix(search): pin httpx connection to resolved IP to block DNS rebinding (#704) 2026-07-02 13:08:06 +01:00
shell fix: use running loop for shell stream deadlines (#1694) 2026-06-03 13:37:46 +09:00
stt STT: clean temp audio files on transcription failure 2026-06-02 20:43:24 +09:00
tts refactor(constants): single source of truth for data dir (#3368) 2026-06-08 09:58:52 +02:00
youtube fix(youtube): consolidate duplicate handler 2026-06-15 15:03:41 +09:00
__init__.py Odysseus v1.0 2026-05-31 23:58:26 +09:00