~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: resolve security-tests and devskim failures
LearningCircuit6304006e0ba6
diff --git a/src/local_deep_research/benchmarks/web_api/benchmark_service.py b/src/local_deep_research/benchmarks/web_api/benchmark_service.pyindex 6957a043ef..051c102faa 100644--- a/src/local_deep_research/benchmarks/web_api/benchmark_service.py+++ b/src/local_deep_research/benchmarks/web_api/benchmark_service.py@@ -61,6 +61,7 @@ class BenchmarkService:k: v for k, v in relevant_params.items() if v is not None}config_str = json.dumps(relevant_params, sort_keys=True)+ # DevSkim: ignore DS126858 - MD5 used for non-cryptographic config hash generationreturn hashlib.md5(config_str.encode(), usedforsecurity=False).hexdigest()[:8]@@ -68,6 +69,7 @@ class BenchmarkService:def generate_query_hash(self, question: str, dataset_type: str) -> str:"""Generate a hash for a query to enable deduplication."""query_content = f"{question.strip()}|{dataset_type.lower()}"+ # DevSkim: ignore DS126858 - MD5 used for non-cryptographic query hash generationreturn hashlib.md5(query_content.encode(), usedforsecurity=False).hexdigest()diff --git a/src/local_deep_research/utilities/search_cache.py b/src/local_deep_research/utilities/search_cache.pyindex 2225898d1a..b74cf9c932 100644--- a/src/local_deep_research/utilities/search_cache.py+++ b/src/local_deep_research/utilities/search_cache.py@@ -85,6 +85,7 @@ class SearchCache:"""Generate hash for query + search engine combination."""normalized_query = self._normalize_query(query)cache_key = f"{search_engine}:{normalized_query}"+ # DevSkim: ignore DS126858 - MD5 used for non-cryptographic cache key generationreturn hashlib.md5(cache_key.encode(), usedforsecurity=False).hexdigest()diff --git a/src/local_deep_research/web/services/research_service.py b/src/local_deep_research/web/services/research_service.pyindex a8dcc61ff7..26bced3bc4 100644--- a/src/local_deep_research/web/services/research_service.py+++ b/src/local_deep_research/web/services/research_service.py@@ -308,6 +308,7 @@ def _generate_report_path(query: str) -> Path:"""# Generate a unique filename that does not contain# non-alphanumeric characters.+ # DevSkim: ignore DS126858 - MD5 used for non-cryptographic filename generationquery_hash = hashlib.md5(query.encode("utf-8"), usedforsecurity=False).hexdigest()[:10]diff --git a/src/local_deep_research/web_search_engines/engines/search_engine_local.py b/src/local_deep_research/web_search_engines/engines/search_engine_local.pyindex 485c192475..c371fbfcfb 100644--- a/src/local_deep_research/web_search_engines/engines/search_engine_local.py+++ b/src/local_deep_research/web_search_engines/engines/search_engine_local.py@@ -271,6 +271,7 @@ class LocalEmbeddingManager:# Canonicalize the path so we don't have weird Windows vs. Linux# problems or issues with trailing slashes.canonical_folder_path = "/".join(folder_path.parts)+ # DevSkim: ignore DS126858 - MD5 used for non-cryptographic folder hash generationreturn hashlib.md5(canonical_folder_path.encode(), usedforsecurity=False).hexdigest()@@ -849,6 +850,7 @@ class LocalSearchEngine(BaseSearchEngine):previews = []for i, result in enumerate(raw_results):# Create a unique ID+ # DevSkim: ignore DS126858 - MD5 used for non-cryptographic result ID generationresult_id = f"local-{i}-{hashlib.md5(result['content'][:50].encode(), usedforsecurity=False).hexdigest()}"# Extract filename and pathdiff --git a/tests/security/test_sql_injection.py b/tests/security/test_sql_injection.pyindex 02909279c2..242e4f64da 100644--- a/tests/security/test_sql_injection.py+++ b/tests/security/test_sql_injection.py@@ -57,22 +57,22 @@ class TestSQLInjectionPrevention:f"Malicious ID not properly handled: {malicious_id}")- def test_username_filter_sql_injection(self, test_db_session):- """Test that username filtering prevents SQL injection."""- # Malicious usernames that could attempt SQL injection- malicious_usernames = [+ def test_query_filter_sql_injection(self, test_db_session):+ """Test that query filtering prevents SQL injection."""+ # Malicious queries that could attempt SQL injection+ malicious_queries = ["admin' OR '1'='1",- "user'; DROP TABLE users;--",+ "query'; DROP TABLE research_history;--","' OR 1=1--","admin'/*",- "user' UNION SELECT password FROM users--",+ "query' UNION SELECT * FROM research_history--",]- for username in malicious_usernames:- # Query should handle malicious username safely+ for query in malicious_queries:+ # Query should handle malicious input safelyresult = (test_db_session.query(ResearchHistory)- .filter_by(username=username)+ .filter_by(query=query).first())# Should return None (no match) rather than executing injection@@ -85,7 +85,6 @@ class TestSQLInjectionPrevention:id="test-id-123",query="Test query",report_content="Test content",- username="testuser",)test_db_session.add(research)test_db_session.commit()@@ -138,7 +137,6 @@ class TestSQLInjectionPrevention:research = ResearchHistory(id="test-metadata-injection",query="Test query",- username="testuser",)test_db_session.add(research)test_db_session.commit()@@ -184,7 +182,6 @@ class TestSQLInjectionPrevention:research = ResearchHistory(id=f"test-{hash(input_str)}",query=input_str,- username="testuser",)test_db_session.add(research)@@ -223,14 +220,12 @@ class TestDatabaseStorageSecurityIntegration:attack_vectors = {"research_id": "1' OR '1'='1","content": "'; DROP TABLE research_history;--",- "username": "admin'--",}# Create research with attack vectorsresearch = ResearchHistory(id=attack_vectors["research_id"],query="Normal query",- username=attack_vectors["username"],)test_db_session.add(research)test_db_session.commit()@@ -239,16 +234,13 @@ class TestDatabaseStorageSecurityIntegration:result = storage.save_report(attack_vectors["research_id"],attack_vectors["content"],- username=attack_vectors["username"],)# All operations should complete safelyassert result is True# Retrieve and verify all malicious inputs are stored as literals- retrieved = storage.get_report(- attack_vectors["research_id"], username=attack_vectors["username"]- )+ retrieved = storage.get_report(attack_vectors["research_id"])assert retrieved == attack_vectors["content"]# Database should still be intact (no tables dropped)