~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
refactor(security): expand danger-zone paths + fix security/** label misnomer (#3534)
LearningCircuit45801b066471
diff --git a/.github/workflows/danger-zone-alert.yml b/.github/workflows/danger-zone-alert.ymlindex 744cdefd49..3b96d5f86e 100644--- a/.github/workflows/danger-zone-alert.yml+++ b/.github/workflows/danger-zone-alert.yml@@ -6,10 +6,29 @@ on:paths:# Explicit paths only — no keyword globs. A filename containing# "decrypt" or "password" is not enough to imply security impact.+ #+ # ⚠️ KEEP IN SYNC with two other lists below:+ # 1. EXPLICIT_WATCHED array in the "Validate watchlist" step+ # (drops glob entries; literal paths only — used for drift detection).+ # 2. `case` patterns in the "Classify critical changes" step+ # (routes each path to a label bucket).+ # A path here that's missing from (2) silently fails to label;+ # a path in (2) that's missing here never triggers the workflow.+ #+ # Encryption / at-rest crypto / credential storage- 'src/local_deep_research/database/encrypted_db.py'- 'src/local_deep_research/database/sqlcipher_*.py'+ - 'src/local_deep_research/database/credential_store_base.py'+ - 'src/local_deep_research/database/backup/**'+ # Authentication / sessions / passwords / auth DB / tenant isolation- 'src/local_deep_research/web/auth/**'+ - 'src/local_deep_research/database/auth_db.py'+ - 'src/local_deep_research/database/session_passwords.py'+ - 'src/local_deep_research/database/temp_auth.py'+ - 'src/local_deep_research/database/session_context.py'+ # Web hardening — CSP, SSRF, CSRF, rate-limit, headers, validators- 'src/local_deep_research/security/**'+ - 'src/local_deep_research/settings/env_definitions/security.py'permissions: {} # Minimal top-level for OSSF Scorecard Token-Permissions@@ -20,6 +39,7 @@ jobs:contents: readpull-requests: writechecks: write+ issues: write # needed for createLabel (auto-create on first run)steps:- name: Harden the runner (Audit all outbound calls)@@ -33,6 +53,36 @@ jobs:persist-credentials: falsefetch-depth: 0+ - name: Validate watchlist against repo tree+ # Drift-guard: every explicit (non-glob) path below must exist on the+ # branch head. Fails the workflow if a watched file has been renamed+ # or deleted without updating this list. Glob patterns are excluded+ # — they self-heal on rename and would false-positive this check.+ # (Tradeoff: if all files matching a glob like `sqlcipher_*.py` are+ # deleted, the trigger path silently becomes a no-op. Acceptable —+ # disappearing an entire subsystem will be caught in code review.)+ #+ # ⚠️ KEEP IN SYNC with `on.pull_request.paths` above and the `case`+ # patterns in the "Classify critical changes" step below.+ run: |+ EXPLICIT_WATCHED=(+ "src/local_deep_research/database/encrypted_db.py"+ "src/local_deep_research/database/credential_store_base.py"+ "src/local_deep_research/database/auth_db.py"+ "src/local_deep_research/database/session_passwords.py"+ "src/local_deep_research/database/temp_auth.py"+ "src/local_deep_research/database/session_context.py"+ "src/local_deep_research/settings/env_definitions/security.py"+ )+ missing=0+ for p in "${EXPLICIT_WATCHED[@]}"; do+ if [ ! -e "$p" ]; then+ echo "::error::danger-zone-alert watchlist drift: $p does not exist"+ missing=1+ fi+ done+ [ $missing -eq 0 ]+- name: Classify critical changesid: analyzeenv:@@ -43,18 +93,37 @@ jobs:ENCRYPTION_MODIFIED=falseAUTH_MODIFIED=false+ HARDENING_MODIFIED=false+ # Shell `case` `*` matches `/` (unlike file globs), so `web/auth/*`+ # and `backup/*` cover nested subdirs — equivalent to the `**` in+ # GitHub Actions path globs above. Do NOT "fix" these to `**` —+ # bash `case` treats `**` as two literal `*`s with no special+ # meaning and it would stop matching anything with a slash.+ #+ # ⚠️ KEEP IN SYNC with `on.pull_request.paths` above and the+ # EXPLICIT_WATCHED array in the "Validate watchlist" step above.for file in $CHANGED; docase "$file" in- src/local_deep_research/database/encrypted_db.py|src/local_deep_research/database/sqlcipher_*.py)+ src/local_deep_research/database/encrypted_db.py|\+ src/local_deep_research/database/sqlcipher_*.py|\+ src/local_deep_research/database/credential_store_base.py|\+ src/local_deep_research/database/backup/*)ENCRYPTION_MODIFIED=true ;;- src/local_deep_research/web/auth/*|src/local_deep_research/security/*)+ src/local_deep_research/web/auth/*|\+ src/local_deep_research/database/auth_db.py|\+ src/local_deep_research/database/session_passwords.py|\+ src/local_deep_research/database/temp_auth.py|\+ src/local_deep_research/database/session_context.py)AUTH_MODIFIED=true ;;+ src/local_deep_research/security/*|\+ src/local_deep_research/settings/env_definitions/security.py)+ HARDENING_MODIFIED=true ;;esacdoneHAS_CRITICAL=false- if [ "$ENCRYPTION_MODIFIED" = "true" ] || [ "$AUTH_MODIFIED" = "true" ]; then+ if [ "$ENCRYPTION_MODIFIED" = "true" ] || [ "$AUTH_MODIFIED" = "true" ] || [ "$HARDENING_MODIFIED" = "true" ]; thenHAS_CRITICAL=truefi@@ -62,6 +131,7 @@ jobs:echo "has_critical=$HAS_CRITICAL"echo "encryption_modified=$ENCRYPTION_MODIFIED"echo "auth_modified=$AUTH_MODIFIED"+ echo "hardening_modified=$HARDENING_MODIFIED"} >> "$GITHUB_OUTPUT"- name: Create status check@@ -81,7 +151,7 @@ jobs:conclusion: 'neutral',output: {title: 'Security-sensitive paths modified',- summary: 'This PR modifies critical security code (encryption or authentication). Please review carefully.'+ summary: 'This PR modifies critical security code (encryption, authentication, or web hardening). Please review carefully.'}});@@ -91,17 +161,41 @@ jobs:env:ENCRYPTION_MODIFIED: ${{ steps.analyze.outputs.encryption_modified }}AUTH_MODIFIED: ${{ steps.analyze.outputs.auth_modified }}+ HARDENING_MODIFIED: ${{ steps.analyze.outputs.hardening_modified }}with:script: |- const labels = [];- if (process.env.ENCRYPTION_MODIFIED === 'true') labels.push('touches-encryption');- if (process.env.AUTH_MODIFIED === 'true') labels.push('touches-authentication');-- if (labels.length > 0) {- await github.rest.issues.addLabels({- owner: context.repo.owner,- repo: context.repo.repo,- issue_number: context.issue.number,- labels: labels- });+ const wanted = [];+ if (process.env.ENCRYPTION_MODIFIED === 'true') {+ wanted.push({ name: 'touches-encryption', color: 'b60205', description: 'Modifies at-rest crypto, credential storage, or backup encryption' });+ }+ if (process.env.AUTH_MODIFIED === 'true') {+ wanted.push({ name: 'touches-authentication', color: 'd93f0b', description: 'Modifies login, sessions, passwords, auth DB, or tenant isolation' });}+ if (process.env.HARDENING_MODIFIED === 'true') {+ wanted.push({ name: 'touches-web-hardening', color: 'fbca04', description: 'Modifies CSP, SSRF, CSRF, rate-limit, headers, validators, or hardening config' });+ }++ if (wanted.length === 0) return;++ // Ensure each label exists before applying (addLabels 422s on unknown labels).+ for (const l of wanted) {+ try {+ await github.rest.issues.createLabel({+ owner: context.repo.owner,+ repo: context.repo.repo,+ name: l.name,+ color: l.color,+ description: l.description,+ });+ } catch (e) {+ // 422 = already exists; anything else is a real failure.+ if (e.status !== 422) throw e;+ }+ }++ await github.rest.issues.addLabels({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: context.issue.number,+ labels: wanted.map(l => l.name),+ });