~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
test(security): pin the IPv4-Translated prefix block across all surfaces (#6595)
LearningCircuit51ecd7af82d6
diff --git a/tests/security/test_ip_ranges.py b/tests/security/test_ip_ranges.pyindex 49cd41df0c..07d0b9af4b 100644--- a/tests/security/test_ip_ranges.py+++ b/tests/security/test_ip_ranges.py@@ -184,6 +184,17 @@ class TestPrivateIPRanges:ipv4_compat = ipaddress.ip_network("::/96")assert ipv4_compat in PRIVATE_IP_RANGES+ def test_contains_ipv4_translated_prefix(self):+ """Should contain ::ffff:0:0:0/96 (RFC 2765 / SIIT IPv4-Translated).+ Containment is the convention every PRIVATE_IP_RANGES entry meets.+ This is the direct pin for the entry added by #6460 — dropping it+ from the list fails here first, instead of only indirectly via+ validate_url assertions in a different file."""+ from local_deep_research.security.ip_ranges import PRIVATE_IP_RANGES++ translated = ipaddress.ip_network("::ffff:0:0:0/96")+ assert translated in PRIVATE_IP_RANGES+class TestPrivateIPDetection:"""Tests for using PRIVATE_IP_RANGES to detect private IPs."""diff --git a/tests/security/test_notification_validator.py b/tests/security/test_notification_validator.pyindex dead8a01a2..c03b7e07f5 100644--- a/tests/security/test_notification_validator.py+++ b/tests/security/test_notification_validator.py@@ -1386,6 +1386,31 @@ class TestIPv4TranslatedPrefixInNotificationValidator:NotificationURLValidator._is_private_ip("::ffff:127.0.0.1") is True)+ def test_ipv4_translated_rejected_under_allow_private_ips(self):+ """``validate_service_url`` must refuse the translated IMDS embed+ even with ``allow_private_ips=True`` — the flag widens the+ RFC1918/loopback literals, not the transition-prefix block+ (mirror of the SSRF surface's allow-flag matrix).+ """+ is_valid, _ = NotificationURLValidator.validate_service_url(+ "http://[::ffff:0:169.254.169.254]/", allow_private_ips=True+ )+ assert is_valid is False++ def test_ipv4_translated_public_embed_blocked(self):+ """``::ffff:0:8.8.8.8`` — translated wrap of a PUBLIC IPv4 is+ private here too.++ Intentional divergence from the mapped family (whose public+ wraps unwrap and pass, as pinned by the control above): the+ translated prefix has no legitimate endpoint use, so the whole+ /96 is refused. Pins the widening so a later "refinement"+ cannot narrow the block to private embeds only.+ """+ assert (+ NotificationURLValidator._is_private_ip("::ffff:0:8.8.8.8") is True+ )+class TestNat64EnvOptOutInNotificationValidator:"""Mirror of ssrf_validator's TestNat64EnvOptOut for the notificationdiff --git a/tests/security/test_ssrf_validator.py b/tests/security/test_ssrf_validator.pyindex e2094d1333..3584a069ab 100644--- a/tests/security/test_ssrf_validator.py+++ b/tests/security/test_ssrf_validator.py@@ -1401,6 +1401,33 @@ class TestIPv6TransitionPrefixesBlocked:assert ipaddress.ip_address("::ffff:127.0.0.1").ipv4_mapped is not Noneassert reported.ipv4_mapped is None+ def test_ipv4_translated_public_embed_blocked(self):+ """[::ffff:0:8.8.8.8] — translated wrap of a PUBLIC IPv4.++ Intentional divergence from the mapped family one group below:+ a mapped public address is unwrapped and judged on its payload+ (and passes), but the translated prefix has no legitimate+ endpoint use, so the whole /96 is refused regardless of what it+ wraps. Pins the widening so a later "refinement" cannot narrow+ the block to private embeds only.+ """+ from local_deep_research.security.ssrf_validator import (+ validate_url,+ )++ assert validate_url("http://[::ffff:0:8.8.8.8]/") is False++ def test_ipv4_mapped_public_embed_still_passes(self):+ """Boundary from the other side: [::ffff:8.8.8.8] is IPv4-MAPPED+ wrapping the same public payload and passes via the unwrap — the+ translated block is scoped, not a blanket embedded-IPv4 refusal+ (this pass-through was previously unpinned on this surface)."""+ from local_deep_research.security.ssrf_validator import (+ validate_url,+ )++ assert validate_url("http://[::ffff:8.8.8.8]/") is True+class TestIPv6TransitionPrefixesAllowFlagMatrix:"""Lock in the design decision: ``allow_private_ips=True`` does NOT@@ -1445,6 +1472,38 @@ class TestIPv6TransitionPrefixesAllowFlagMatrix:assert is_ip_blocked("64:ff9b::a00:1", allow_private_ips=True) is True+ def test_ipv4_translated_blocked_under_allow_localhost(self):+ """``::ffff:0:7f00:1`` is 127.0.0.1 in RFC 2765 translated form —+ the SIIT family joins the matrix so an allow-flag change cannot+ sweep the translated prefix back into the carve-out."""+ from local_deep_research.security.ssrf_validator import (+ is_ip_blocked,+ )++ assert is_ip_blocked("::ffff:0:7f00:1", allow_localhost=True) is True++ def test_ipv4_translated_blocked_under_allow_private_ips(self):+ """``::ffff:0:c0a8:101`` is 192.168.1.1 in translated form."""+ from local_deep_research.security.ssrf_validator import (+ is_ip_blocked,+ )++ assert (+ is_ip_blocked("::ffff:0:c0a8:101", allow_private_ips=True) is True+ )++ def test_ipv4_translated_linklocal_blocked_under_allow_private_ips(self):+ """Full-URL form: the translated link-local wrap stays refused+ through ``validate_url`` even with the operator override set."""+ from local_deep_research.security.ssrf_validator import (+ validate_url,+ )++ assert (+ validate_url("http://[::ffff:0:a9fe:a9fe]/", allow_private_ips=True)+ is False+ )+def test_teredo_blocked_under_allow_private_ips(self):from local_deep_research.security.ssrf_validator import (is_ip_blocked,