~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
fix(security): fail closed on malformed bracketed IPv6 notification fragments (#7176)
Ehsan80505e5cef30
diff --git a/changelog.d/5942.security.md b/changelog.d/5942.security.mdnew file mode 100644index 0000000000..6546a8a305--- /dev/null+++ b/changelog.d/5942.security.md@@ -0,0 +1,7 @@+- A notification URL list that ends in a malformed bracketed IPv6 fragment is+ now refused instead of being dispatched with the fragment glued to the+ preceding URL. `[::1`, `[[::1]]` and `[::1]x` all name the host that the+ well-formed `[::1]` names, and Apprise's own `parse_list` normalizes all+ three onto it, so they now fail closed the same way. A bracketed+ fragment whose contents are not an IPv6 address, such as+ `[not-an-addr]`, is still ordinary URL data.diff --git a/src/local_deep_research/security/notification_validator.py b/src/local_deep_research/security/notification_validator.pyindex 10fd48edae..25295acd88 100644--- a/src/local_deep_research/security/notification_validator.py+++ b/src/local_deep_research/security/notification_validator.py@@ -92,9 +92,12 @@ _NUMERIC_HOST_FRAGMENT_RE = re.compile()# Keep candidate detection deliberately broad. IPv6Address below is the sole# authority for validity, including dotted-quad and scoped IPv6 forms.+# Brackets delimit the authority instead of belonging to the address, so the+# bracketed arm takes a repeated or unclosed pair and any trailing run that+# is not a separator: ``[::1``, ``[[::1]]`` and ``[::1]x`` each name ``::1``._IPV6_FRAGMENT_CANDIDATE_RE = re.compile(- r"^(?://)?(?:\[(?P<bracketed>[^\s,\]/?#]+)\]"- r"(?::[^\s,/?#]*)?|"+ r"^(?://)?(?:\[+(?P<bracketed>[^\s,\[\]/?#]+)"+ r"[^\s,/?#]*|"r"(?P<bare>(?=[^\s,/?#]*:[^\s,/?#]*:)[^\s,/?#]+))"r"(?:[/?#]|$)")diff --git a/tests/security/test_notification_ipv6_fragments.py b/tests/security/test_notification_ipv6_fragments.pyindex dbcbd194d4..126d0e1ab1 100644--- a/tests/security/test_notification_ipv6_fragments.py+++ b/tests/security/test_notification_ipv6_fragments.py@@ -23,6 +23,9 @@ from local_deep_research.security.notification_validator import ("slack://t/x/y [::1]:/x","slack://t/x/y,[::1]:name/x","slack://t/x/y [::1]:name/x",+ "slack://t/x/y,[::1/x",+ "slack://t/x/y,[[::1]]/x",+ "slack://t/x/y,[::1]x/x",],)def test_scheme_less_ipv6_fragment_fails_closed(urls: str) -> None:@@ -109,6 +112,41 @@ def test_scheme_less_ipv6_fragment_helper_accepts_literals(assert is_fragment is True+ "fragment",+ [+ "[::1",+ "[::1/x",+ "[[::1]]",+ "[[::1]]/x",+ "[[::1",+ "[::1]x",+ "[::1]x/x",+ "//[::1",+ "%5B::1",+ ],+)+def test_malformed_bracket_ipv6_fragment_fails_closed(fragment: str) -> None:+ """The guard recognizes a bracket pair that is unclosed, repeated or+ trailed, so a list carrying one is refused rather than dispatched.++ Recognition is all this asserts. ``_is_scheme_less_url_fragment`` is the+ predicate ``parse_notification_url_list`` consults, and these spellings+ used to route around it; nothing here exercises delivery to any address.+ They are worth refusing because Apprise's own ``parse_list`` normalizes+ ``[::1``, ``[[::1]]`` and ``[::1]x`` onto the same standalone ``::1``+ entry as the well-formed ``[::1]`` the guard already recognized.+ """+ # Given+ candidate = fragment++ # When+ is_fragment = _is_scheme_less_url_fragment(candidate)++ # Then+ assert is_fragment is True++@pytest.mark.parametrize("fragment",[@@ -116,6 +154,9 @@ def test_scheme_less_ipv6_fragment_helper_accepts_literals("12:30","12:30:45","aa:bb:cc:dd:ee:ff/path",+ "[not-an-addr]",+ "[not-an-addr]x",+ "[[not-an-addr]]",],)def test_scheme_less_ipv6_fragment_helper_rejects_colon_rich_tokens(