Skip to content

~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.

fix(security): harden re-run research feature defensively (#2208)

LearningCircuit238dc86dc683
diff --git a/src/local_deep_research/web/static/js/components/history.js b/src/local_deep_research/web/static/js/components/history.js
index 17b39840b3..165e196d6f 100644
--- a/src/local_deep_research/web/static/js/components/history.js
+++ b/src/local_deep_research/web/static/js/components/history.js
@@ -441,12 +441,16 @@
* @param {Object} item - The research item to re-run
*/
function handleRerun(item) {
- const rerunConfig = {
- query: item.query,
- mode: item.mode
- };
-
- sessionStorage.setItem('rerunConfig', JSON.stringify(rerunConfig));
+ if (!item.query) return;
+ try {
+ const rerunConfig = {
+ query: item.query,
+ mode: item.mode
+ };
+ sessionStorage.setItem('rerunConfig', JSON.stringify(rerunConfig));
+ } catch (e) {
+ SafeLogger.warn('Could not save rerun config:', e);
+ }
URLValidator.safeAssign(window.location, 'href', '/');
}
diff --git a/src/local_deep_research/web/static/js/components/research.js b/src/local_deep_research/web/static/js/components/research.js
index 19e594da09..d4a0997657 100644
--- a/src/local_deep_research/web/static/js/components/research.js
+++ b/src/local_deep_research/web/static/js/components/research.js
@@ -120,7 +120,13 @@
* Stores it for later application after initialization completes.
*/
function checkAndApplyRerunConfig() {
- const rerunConfigStr = sessionStorage.getItem('rerunConfig');
+ let rerunConfigStr;
+ try {
+ rerunConfigStr = sessionStorage.getItem('rerunConfig');
+ } catch (e) {
+ SafeLogger.warn('Could not read rerun config from sessionStorage:', e);
+ return;
+ }
if (!rerunConfigStr) return;
try {
@@ -155,7 +161,7 @@
// Set mode via the visible label element so both the radio and
// the visual highlight update correctly
if (config.mode) {
- const modeOption = document.querySelector(`.ldr-mode-option[data-mode="${config.mode}"]`);
+ const modeOption = document.querySelector(`.ldr-mode-option[data-mode="${CSS.escape(config.mode)}"]`);
if (modeOption) {
selectMode(modeOption);
}