~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
"""Case-insensitivity of the scheme-less notification URL fragment guard.
Hostnames are case-insensitive (RFC 4343), so the ``localhost`` alternative in
``_SCHEMELESS_URL_FRAGMENT_RE`` must reach the same verdict regardless of how
the fragment is capitalized. The guard is fail-closed integrity rather than a
reachable SSRF -- a fragment it misses is kept as inert URL data, not dialed --
but the two spellings disagreeing was plainly unintended.
"""
from __future__ import annotations
import pytest
from local_deep_research.security.notification_validator import (
NotificationURLValidator,
_is_scheme_less_url_fragment,
)
@pytest.mark.parametrize(
"fragment",
[
"localhost",
"LOCALHOST",
"Localhost",
"LocalHost",
"localhost:8080/x",
"LOCALHOST:8080/x",
"LocalHost:8080/x",
"lOcAlHoSt/webhook",
],
)
def test_schemeless_localhost_fragment_detected_in_any_case(
fragment: str,
) -> None:
# Given
candidate = fragment
# When
is_fragment = _is_scheme_less_url_fragment(candidate)
# Then
assert is_fragment is True
@pytest.mark.parametrize(
"urls",
[
"slack://t/x/y,LOCALHOST:8080/x",
"slack://t/x/y Localhost/webhook",
"slack://t/x/y,LocalHost",
],
)
def test_mixed_case_localhost_fragment_refuses_entire_partition(
urls: str,
) -> None:
# Given
service_urls = urls
# When
is_valid, error = NotificationURLValidator.validate_multiple_urls(
service_urls
)
# Then
assert is_valid is False
assert error is not None
assert "protocol" in error.lower()
@pytest.mark.parametrize(
"fragment",
[
# A pattern-wide ``re.IGNORECASE`` folds U+017F and U+212A into the
# ``A-Za-z`` classes of the domain alternative, admitting these as
# hostname characters. Scoping the flag to ``localhost`` keeps that
# alternative exactly as strict as it was.
"\u017fervice.example/x",
"example.com\u212a/x",
"\u212aelvin.example/x",
],
)
def test_unicode_case_folds_are_not_admitted_as_host_characters(
fragment: str,
) -> None:
# Given
candidate = fragment
# When
is_fragment = _is_scheme_less_url_fragment(candidate)
# Then
assert is_fragment is False