~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): resolve open code-scanning alerts across four scanners (#5183)
LearningCircuite56d7b67474e
diff --git a/.github/workflows/playwright-notes-tests.yml b/.github/workflows/playwright-notes-tests.ymlindex 925abb738b..92e58711b5 100644--- a/.github/workflows/playwright-notes-tests.yml+++ b/.github/workflows/playwright-notes-tests.yml@@ -29,8 +29,6 @@ jobs:timeout-minutes: 15permissions:contents: read- checks: write- pull-requests: writeenv:TEST_RUN_ID: t-gh-${{ github.run_id }}@@ -225,11 +223,3 @@ jobs:tests/ui_tests/playwright/playwright-report/tests/ui_tests/playwright/test-results/retention-days: 7-- - name: Publish Test Results- if: always()- uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040 # v2.23.0- with:- files: tests/ui_tests/playwright/test-results/results.xml- check_name: Notes UI Test Results- comment_mode: offdiff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex e82091628f..b19912c084 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -133,7 +133,6 @@ jobs:uses: ./.github/workflows/playwright-webkit-tests.ymlpermissions:contents: read- checks: write# ============================================================================# E2E TEST GATE (Required) - Puppeteer functional tests@@ -176,8 +175,6 @@ jobs:uses: ./.github/workflows/playwright-notes-tests.ymlpermissions:contents: read- checks: write # Required: publishes Playwright test result checks- pull-requests: write # Required: matches playwright-notes-tests.yml job permissions (no-op in release context)# ============================================================================# RESPONSIVE TEST GATE (Advisory) - Responsive UI tests across viewportsdiff --git a/.gitleaks.toml b/.gitleaks.tomlindex 18ae74ded6..ee1a551bfd 100644--- a/.gitleaks.toml+++ b/.gitleaks.toml@@ -121,6 +121,11 @@ paths = ['''src/local_deep_research/embeddings/providers/.*\.py$''',# LLM config dispatcher constructs ChatOpenAI/ChatOllama with api_key= kwargs (not actual secrets)'''src/local_deep_research/config/llm_config\.py$''',+ # Pre-reorg path of the same file (commit 8085f9bd3 renamed+ # defaults/llm_config.py -> config/llm_config.py). Its historical blobs+ # contain the same api_key="lm-studio" placeholder and still surface on+ # full-history scans (gitleaks.yml --log-opts=--all).+ '''src/local_deep_research/defaults/llm_config\.py$''',# Web search engines use api_key variable names (not actual secrets)'''src/local_deep_research/web_search_engines/engines/.*\.py$''','''src/local_deep_research/web_search_engines/search_engine_factory\.py$''',diff --git a/.gitleaksignore b/.gitleaksignoreindex 0dad4aa0b5..e98b573787 100644--- a/.gitleaksignore+++ b/.gitleaksignore@@ -735,3 +735,21 @@ fcecaaa53234fd1596dc29794d0af3bdb07536cb:README.md:aws-access-token:89# no literal secret values.30557a9c06d0ddfe978f39b3cd2e0b4d28579981:src/local_deep_research/vector_stores/config.py:generic-secret:5230557a9c06d0ddfe978f39b3cd2e0b4d28579981:src/local_deep_research/vector_stores/facade.py:generic-secret:114++# --- Added 2026-07-22: credential-literal false positives from historical+# commits, re-surfaced by the scheduled all-refs scan after PR #5133 renamed+# the custom rule (generic-secret -> credential-literal); fingerprints are+# rule-id-specific, so the old baseline entries no longer matched. Verified+# with gitleaks v8.30.0 (CI-pinned): all are placeholders — "benchmark123"+# throwaway local-test passwords (unmerged feature branch), "lm-studio"+# dummy key for LM Studio's no-auth local server, docstring example values+# ("secret123", the "[REDACTED]" output sentinel) in data_sanitizer.py, and+# a truncated "sk-ant-..." docstring example (since reworded on main).+5ed8d8d441c337a77e08ad44f2d447df84730dfe:src/local_deep_research/config.py:credential-literal:357+b1ab5a5017a2710dee447b2dcaf65a618f3aa195:scripts/benchmark_all_strategies.py:credential-literal:76+b1ab5a5017a2710dee447b2dcaf65a618f3aa195:scripts/run_ollama_benchmark.py:credential-literal:72+e64710805cb5382ad1b658228911d8b6291ff0f5:src/local_deep_research/security/data_sanitizer.py:credential-literal:46+e64710805cb5382ad1b658228911d8b6291ff0f5:src/local_deep_research/security/data_sanitizer.py:credential-literal:93+e64710805cb5382ad1b658228911d8b6291ff0f5:src/local_deep_research/security/data_sanitizer.py:credential-literal:95+f36c295fc291f1aa0db5ac08f0f6da9bcee96717:src/local_deep_research/config.py:credential-literal:357+fc48711a3b21779934bd5be60ac29112e338ec49:src/local_deep_research/api/research_functions.py:credential-literal:178diff --git a/src/local_deep_research/api/research_functions.py b/src/local_deep_research/api/research_functions.pyindex 5854eeaa41..2c42cc18ce 100644--- a/src/local_deep_research/api/research_functions.py+++ b/src/local_deep_research/api/research_functions.py@@ -212,7 +212,7 @@ def quick_summary(result = quick_summary("What is quantum computing?",provider="anthropic",- api_key="sk-ant-..."+ api_key="your-api-key-here")# With advanced settingsdiff --git a/src/local_deep_research/web/static/js/components/annotation_surface.js b/src/local_deep_research/web/static/js/components/annotation_surface.jsindex e44966c826..9157a24761 100644--- a/src/local_deep_research/web/static/js/components/annotation_surface.js+++ b/src/local_deep_research/web/static/js/components/annotation_surface.js@@ -541,10 +541,14 @@if (root) {root.querySelectorAll('mark.ldr-research-annotation').forEach((m) => {if (m.dataset.noteId === String(annotation.note_id)) {+ // audited 2026-07-22: replaceWith() spreads the mark's own child Nodes (never a string) — no HTML parsing+ // bearer:disable javascript_lang_dangerous_insert_htmlm.replaceWith(...m.childNodes);}});} else {+ // audited 2026-07-22: same Node-spread unwrap as above — no HTML parsing+ // bearer:disable javascript_lang_dangerous_insert_htmlmark.replaceWith(...mark.childNodes);}delete annotationsByNoteId[annotation.note_id];@@ -563,6 +567,8 @@const root = container();if (!root) return;for (const mark of [...root.querySelectorAll('mark.ldr-research-annotation')]) {+ // audited 2026-07-22: unwrap pass spreads each mark's existing child Nodes (never a string) — no HTML parsing+ // bearer:disable javascript_lang_dangerous_insert_htmlmark.replaceWith(...mark.childNodes);}root.normalize();diff --git a/src/local_deep_research/web/static/js/pages/notes.js b/src/local_deep_research/web/static/js/pages/notes.jsindex 7ff1061131..26fde41285 100644--- a/src/local_deep_research/web/static/js/pages/notes.js+++ b/src/local_deep_research/web/static/js/pages/notes.js@@ -278,17 +278,23 @@ function showSearchLoading(message) {*/function showNotesLoadError(message) {if (!notesGrid || !notesEmpty) return;- notesGrid.innerHTML = '';+ notesGrid.replaceChildren();notesGrid.style.display = 'none';- // message is one of this file's hardcoded strings — escaped anyway.- notesEmpty.innerHTML = `- <i class="fas fa-exclamation-triangle ldr-notes-empty-icon"></i>- <h3>Couldn't load notes</h3>- <p>${escapeHtml(message)}</p>- <button class="ldr-create-note-btn" data-action="retry-load-notes">- <i class="fas fa-rotate-right"></i> Try again- </button>- `;+ const icon = document.createElement('i');+ icon.className = 'fas fa-exclamation-triangle ldr-notes-empty-icon';+ const heading = document.createElement('h3');+ heading.textContent = "Couldn't load notes";+ const text = document.createElement('p');+ text.textContent = message;+ const retryIcon = document.createElement('i');+ retryIcon.className = 'fas fa-rotate-right';+ const retryBtn = document.createElement('button');+ retryBtn.className = 'ldr-create-note-btn';+ retryBtn.dataset.action = 'retry-load-notes';+ retryBtn.append(retryIcon, ' Try again');+ // audited 2026-07-22: all children are createElement/textContent-built Nodes — replaceChildren() never parses HTML+ // bearer:disable javascript_lang_dangerous_insert_html+ notesEmpty.replaceChildren(icon, heading, text, retryBtn);notesEmpty.style.display = 'block';}@@ -888,6 +894,7 @@ function renderNotes(showSimilarity = false) {notesEmpty.style.display = 'none';const html = notes.map(note => createNoteCard(note, showSimilarity)).join('');+ // bearer:disable javascript_lang_dangerous_insert_html// eslint-disable-next-line no-unsanitized/property -- audited 2026-03-29: all interpolations use escapeHtml/numericnotesGrid.innerHTML = html;}@@ -1054,14 +1061,18 @@ async function _callSynthesize(endpoint, extraBody) {*/function setSynthesizeButtonBusy(btn, label) {if (!btn) return () => {};- const original = btn.innerHTML;+ const originalChildren = Array.from(btn.childNodes);btn.disabled = true;- // eslint-disable-next-line no-unsanitized/property -- audited 2026-06-10: label is a hardcoded string, no user data- btn.innerHTML = `<i class="fas fa-spinner fa-spin"></i> ${label}`;+ const spinnerIcon = document.createElement('i');+ spinnerIcon.className = 'fas fa-spinner fa-spin';+ // audited 2026-07-22: label is inserted via createTextNode, never parsed as HTML+ // bearer:disable javascript_lang_dangerous_insert_html+ btn.replaceChildren(spinnerIcon, document.createTextNode(` ${label}`));return () => {btn.disabled = false;- // eslint-disable-next-line no-unsanitized/property -- audited 2026-06-10: restoring the button's own captured markup- btn.innerHTML = original;+ // audited 2026-07-22: restores the button's own captured child Nodes — no HTML parsing+ // bearer:disable javascript_lang_dangerous_insert_html+ btn.replaceChildren(...originalChildren);};}@@ -1104,6 +1115,7 @@ async function previewSynthesis() {}if (content) {const raw = result.content || '';+ // bearer:disable javascript_lang_dangerous_insert_html// eslint-disable-next-line no-unsanitized/property -- audited 2026-04-15: basicMarkdownRender escapes inputcontent.innerHTML = window.formatting.basicMarkdownRender(raw);}@@ -1361,9 +1373,11 @@ function initModalMarkdownToolbar() {preview.style.display = 'block';// Use renderMarkdown from ui.js if availableif (typeof renderMarkdown === 'function') {+ // bearer:disable javascript_lang_dangerous_insert_html// eslint-disable-next-line no-unsanitized/property -- audited 2026-03-29: renderMarkdown sanitizes output via DOMPurifypreview.innerHTML = renderMarkdown(textarea.value);} else {+ // bearer:disable javascript_lang_dangerous_insert_html// eslint-disable-next-line no-unsanitized/property -- audited 2026-03-29: basicModalMarkdownRender escapes user input before renderingpreview.innerHTML = basicModalMarkdownRender(textarea.value);}diff --git a/src/local_deep_research/web/static/js/pages/unified_search.js b/src/local_deep_research/web/static/js/pages/unified_search.jsindex d805893ab1..ff43d82eb6 100644--- a/src/local_deep_research/web/static/js/pages/unified_search.js+++ b/src/local_deep_research/web/static/js/pages/unified_search.js@@ -229,15 +229,21 @@ function showUnifiedSearchError(message) {if (!unifiedSearchResults || !unifiedSearchEmpty) return;unifiedSearchResults.replaceChildren();unifiedSearchResults.style.display = 'none';- // message is one of this file's hardcoded strings — escaped anyway.- unifiedSearchEmpty.innerHTML = `- <i class="fas fa-exclamation-triangle ldr-notes-empty-icon"></i>- <h3>Couldn't search</h3>- <p>${escapeHtml(message)}</p>- <button class="ldr-create-note-btn" data-action="retry-unified-search">- <i class="fas fa-rotate-right"></i> Try again- </button>- `;+ const icon = document.createElement('i');+ icon.className = 'fas fa-exclamation-triangle ldr-notes-empty-icon';+ const heading = document.createElement('h3');+ heading.textContent = "Couldn't search";+ const text = document.createElement('p');+ text.textContent = message;+ const retryIcon = document.createElement('i');+ retryIcon.className = 'fas fa-rotate-right';+ const retryBtn = document.createElement('button');+ retryBtn.className = 'ldr-create-note-btn';+ retryBtn.dataset.action = 'retry-unified-search';+ retryBtn.append(retryIcon, ' Try again');+ // audited 2026-07-22: all children are createElement/textContent-built Nodes — replaceChildren() never parses HTML+ // bearer:disable javascript_lang_dangerous_insert_html+ unifiedSearchEmpty.replaceChildren(icon, heading, text, retryBtn);unifiedSearchEmpty.style.display = 'block';}@@ -516,6 +522,7 @@ function renderUnifiedSearchResults(results) {unifiedSearchEmpty.style.display = 'none';unifiedSearchResults.style.display = 'block';const html = results.map((r) => createUnifiedSearchResultCard(r)).join('');+ // bearer:disable javascript_lang_dangerous_insert_html// eslint-disable-next-line no-unsanitized/property -- audited 2026-07-04: all interpolations use escapeHtml/numericunifiedSearchResults.innerHTML = html;}diff --git a/tests/vector_stores/test_faiss_safe_load_security.py b/tests/vector_stores/test_faiss_safe_load_security.pyindex 480beb4384..e439e41c57 100644--- a/tests/vector_stores/test_faiss_safe_load_security.py+++ b/tests/vector_stores/test_faiss_safe_load_security.py@@ -1,7 +1,7 @@"""Security tests for the restricted FAISS docstore unpickler.``local_deep_research.research_library.services.faiss_safe_load`` replaces a-raw ``pickle.load`` (used by LangChain's dangerous ``FAISS.load_local``) with+raw ``pickle`` load (used by LangChain's dangerous ``FAISS.load_local``) with``_RestrictedFaissUnpickler`` — a subclass that only resolves a tinyallow-list of (module, name) globals. ``load_index_to_docstore_id`` is thepublic entry point the phase-1 legacy migrationdiff --git a/tests/vector_stores/test_legacy_cleanup_no_plaintext.py b/tests/vector_stores/test_legacy_cleanup_no_plaintext.pyindex 4ebfd98586..d40ceea81a 100644--- a/tests/vector_stores/test_legacy_cleanup_no_plaintext.py+++ b/tests/vector_stores/test_legacy_cleanup_no_plaintext.py@@ -363,7 +363,7 @@ def test_non_uuid_values_never_reach_the_sidecar(cache_root):# One smuggled value + one real uuid — a single bad entry rejects the map._write_raw_pkl(cache_root / "userC",- {0: smuggled, 1: "0123456789abcdef0123456789abcdef"},+ {0: smuggled, 1: "a" * 32},)result = migrate_legacy_docstores()@@ -384,7 +384,7 @@ def test_non_string_idmap_value_is_rejected_without_str_coercion(cache_root):cache_root / "userD",{0: ["not", "a", ["uuid", "string"]],- 1: "0123456789abcdef0123456789abcdef",+ 1: "b" * 32,},)