From 53370723df05193938ce3c2d55a8e12f2a87b17b Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Fri, 30 Oct 2026 20:41:25 +0100 Subject: fix(core): replace Huey pickle serialization with JSON Prevent broker-controlled task and result payloads from deserializing arbitrary Python objects by using a restricted JSON serializer with an explicit type allowlist. Fail closed on serializer overrides and document broker isolation and migration requirements for existing pickle-backed deployments. --- tests/test_public_transport.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'tests/test_public_transport.py') diff --git a/tests/test_public_transport.py b/tests/test_public_transport.py index e7d77fa..df7a1c3 100644 --- a/tests/test_public_transport.py +++ b/tests/test_public_transport.py @@ -70,7 +70,10 @@ class FakeStream(httpcore.NetworkStream): self.writes.extend(buffer) def start_tls( - self, ssl_context, server_hostname: str | None = None, timeout: float | None = None + self, + ssl_context, + server_hostname: str | None = None, + timeout: float | None = None, ) -> httpcore.NetworkStream: self.sni = server_hostname return self @@ -107,7 +110,9 @@ def test_deadline_clips_each_read_and_stops_trickle( monkeypatch: pytest.MonkeyPatch, ) -> None: clock = [100.0] - monkeypatch.setattr("webmentions_ssg.public_transport.time.monotonic", lambda: clock[0]) + monkeypatch.setattr( + "webmentions_ssg.public_transport.time.monotonic", lambda: clock[0] + ) fake_stream = Mock() fake_stream.read.return_value = b"x" stream = DeadlineStream(fake_stream, NetworkDeadline(5.0)) @@ -141,7 +146,9 @@ def test_redirects_go_through_same_destination_guard( monkeypatch.setattr(PublicNetworkBackend, "connect_tcp", connect) with ( - httpx.Client(transport=PublicHTTPTransport(5.0), follow_redirects=True) as client, + httpx.Client( + transport=PublicHTTPTransport(5.0), follow_redirects=True + ) as client, pytest.raises(UnsafeAddressError, match="Non-public"), ): client.get("http://source.example/post") -- cgit v1.3.1