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.

security: replace gosu with setpriv and suppress 8 unfixable CVEs (#2501)

LearningCircuit04a55f106f2e
diff --git a/.file-whitelist.txt b/.file-whitelist.txt
index 5855fcb396..2deb6091aa 100644
--- a/.file-whitelist.txt
+++ b/.file-whitelist.txt
@@ -37,6 +37,7 @@
^\.github/.*\.(yml|yaml)$
^\.semgrep/.*\.(yml|yaml)$
^bearer\.yml$
+^\.grype\.yaml$
^\.hadolint\.yaml$
^\.pre-commit-config\.yaml$
^\.safety-policy\.yml$
diff --git a/.github/workflows/docker-tests.yml b/.github/workflows/docker-tests.yml
index 339c5deeb7..e13058f83f 100644
--- a/.github/workflows/docker-tests.yml
+++ b/.github/workflows/docker-tests.yml
@@ -836,7 +836,7 @@ jobs:
mkdir -p "$PWD/ci-data-prod"
# Run with the same security settings as docker-compose.yml so CI
# catches capability regressions (e.g., missing cap_add that breaks
- # the entrypoint's chown/gosu in restricted environments).
+ # the entrypoint's chown/setpriv in restricted environments).
docker run -d \
--name ldr-prod-test \
-p 5001:5000 \
diff --git a/.github/workflows/dockle.yml b/.github/workflows/dockle.yml
index 70ee7669d9..c454ac0fbd 100644
--- a/.github/workflows/dockle.yml
+++ b/.github/workflows/dockle.yml
@@ -51,8 +51,8 @@ jobs:
# Exit code 1 means issues found, but we don't fail the workflow
#
# Ignored checks (false positives or intentional design):
- # - CIS-DI-0001: Create a user - image uses gosu entrypoint pattern for privilege drop
- # (see scripts/ldr_entrypoint.sh which uses gosu to switch to ldruser)
+ # - CIS-DI-0001: Create a user - image uses setpriv entrypoint pattern for privilege drop
+ # (see scripts/ldr_entrypoint.sh which uses setpriv to switch to ldruser)
# - CIS-DI-0005: Enable Content trust for Docker - runtime env var (DOCKER_CONTENT_TRUST),
# not a Dockerfile concern; enforced at deployment time
# - CIS-DI-0008: setuid/setgid files - unix_chkpwd is standard Debian base utility
@@ -189,7 +189,7 @@ jobs:
echo "- Scan images with both Dockle (runtime) and Hadolint (build)"
echo ""
echo "#### 🔇 Ignored Checks (false positives or intentional design):"
- echo "- **CIS-DI-0001** (Create a user): Uses gosu entrypoint pattern for privilege drop"
+ echo "- **CIS-DI-0001** (Create a user): Uses setpriv entrypoint pattern for privilege drop"
echo "- **CIS-DI-0005** (Content trust): Runtime env var, not Dockerfile concern"
echo "- **CIS-DI-0008** (setuid/setgid): unix_chkpwd from Debian base, required for PAM"
echo "- **DKL-DI-0005** (apt-get cache): Dockerfile clears caches, base image triggers this"
diff --git a/.gitignore b/.gitignore
index 99eb7025f6..59b4bfc619 100644
--- a/.gitignore
+++ b/.gitignore
@@ -92,6 +92,7 @@
!.github/CODEOWNERS
!.github/security/*.txt
!.gitleaksignore
+!.grype.yaml
# Allow installer files only in installers directory (text scripts only)
!installers/**/*.bat
diff --git a/.grype.yaml b/.grype.yaml
new file mode 100644
index 0000000000..e6e8a48495
--- /dev/null
+++ b/.grype.yaml
@@ -0,0 +1,28 @@
+# Grype vulnerability ignore rules
+# All suppressions document unfixable CVEs in Debian Trixie (13)
+# Review: 2026-09-01
+ignore:
+ # libtiff6 — CLI tool crashes only, Debian: "no security impact"
+ # Fix in 4.7.1-1 (sid only), Trixie has 4.7.0-3+deb13u1
+ - vulnerability: CVE-2025-8176
+ reason: "Crash in tiffmedian CLI tool, no security impact. Not backported to Trixie."
+ - vulnerability: CVE-2025-8177
+ reason: "Crash in thumbnail CLI tool, no security impact. Not backported to Trixie."
+
+ # coreutils — race condition in chown -R -L, upstream won't fix
+ - vulnerability: CVE-2017-18018
+ reason: "Upstream chose documentation-only fix. Container doesn't use chown -R -L."
+
+ # Chrome DevTools — requires malicious extension, low risk in headless Docker
+ - vulnerability: CVE-2026-3063
+ reason: "DevTools issue via malicious extension. Container runs headless for scraping."
+
+ # libc6/libc-bin — needs glibc 2.43, Trixie has 2.41. Debian: no-dsa (minor)
+ - vulnerability: CVE-2026-0861
+ reason: "Heap overflow in memalign. Needs glibc 2.43, Trixie has 2.41. Debian no-dsa."
+ - vulnerability: CVE-2026-0915
+ reason: "NSS DNS info disclosure. Needs glibc 2.43, Trixie has 2.41. Debian no-dsa."
+
+ # libc6 — upstream explicitly says "not a legitimate security issue"
+ - vulnerability: CVE-2019-1010023
+ reason: "Library remapping via ldd. Upstream: not a security issue. Debian: unimportant."
diff --git a/.trivyignore b/.trivyignore
index d34aa64fa3..b5b296a088 100644
--- a/.trivyignore
+++ b/.trivyignore
@@ -81,3 +81,70 @@ CVE-2025-7709 exp:2026-07-01
# Monitoring: Check future setuptools releases for updated vendor.
# As of setuptools 80.10.1, the vendored wheel is still 0.45.1.
CVE-2026-24049
+
+# =============================================================================
+# DEBIAN TRIXIE (13) OS-LEVEL CVEs (No fix available)
+# =============================================================================
+
+# CVE-2025-8176: libtiff6 — crash in tiffmedian CLI tool
+# Severity: HIGH
+# Review: 2026-09-01
+#
+# UNFIXABLE IN TRIXIE: Fix only in sid (4.7.1-1), Trixie has 4.7.0-3+deb13u1.
+# Debian classified as "no security impact" — CLI tool crash only.
+# Container does not use libtiff CLI tools.
+# Tracking: https://security-tracker.debian.org/tracker/CVE-2025-8176
+CVE-2025-8176 exp:2026-09-01
+
+# CVE-2025-8177: libtiff6 — crash in thumbnail CLI tool
+# Severity: HIGH
+# Review: 2026-09-01
+#
+# UNFIXABLE IN TRIXIE: Fix only in sid (4.7.1-1), Trixie has 4.7.0-3+deb13u1.
+# Debian classified as "no security impact" — CLI tool crash only.
+# Container does not use libtiff CLI tools.
+# Tracking: https://security-tracker.debian.org/tracker/CVE-2025-8177
+CVE-2025-8177 exp:2026-09-01
+
+# CVE-2017-18018: coreutils — race condition in chown -R -L
+# Severity: HIGH
+# Review: 2026-09-01
+#
+# UPSTREAM WON'T FIX: Chose documentation-only fix.
+# Container entrypoint uses chown -R (without -L), not affected.
+# Tracking: https://security-tracker.debian.org/tracker/CVE-2017-18018
+CVE-2017-18018 exp:2026-09-01
+
+# CVE-2026-3063: Chrome DevTools — requires malicious extension
+# Severity: HIGH
+# Review: 2026-09-01
+#
+# UNFIXABLE: Chrome 145.0.7632.6 in Playwright, fix requires newer version.
+# Requires malicious browser extension — low risk in headless Docker scraping.
+# Tracking: https://chromereleases.googleblog.com/
+CVE-2026-3063 exp:2026-09-01
+
+# CVE-2026-0861: libc6/libc-bin — heap overflow in memalign
+# Severity: HIGH
+# Review: 2026-09-01
+#
+# UNFIXABLE IN TRIXIE: Needs glibc 2.43, Trixie has 2.41. Debian no-dsa.
+# Tracking: https://security-tracker.debian.org/tracker/CVE-2026-0861
+CVE-2026-0861 exp:2026-09-01
+
+# CVE-2026-0915: libc6/libc-bin — NSS DNS info disclosure
+# Severity: HIGH
+# Review: 2026-09-01
+#
+# UNFIXABLE IN TRIXIE: Needs glibc 2.43, Trixie has 2.41. Debian no-dsa.
+# Tracking: https://security-tracker.debian.org/tracker/CVE-2026-0915
+CVE-2026-0915 exp:2026-09-01
+
+# CVE-2019-1010023: libc6 — library remapping via ldd
+# Severity: HIGH
+# Review: 2026-09-01
+#
+# UPSTREAM NOT A SECURITY ISSUE: Upstream explicitly classified as
+# "not a legitimate security issue". Debian: unimportant.
+# Tracking: https://security-tracker.debian.org/tracker/CVE-2019-1010023
+CVE-2019-1010023 exp:2026-09-01
diff --git a/Dockerfile b/Dockerfile
index 98927d9b24..21d6a603af 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,7 @@
####
# Used for building the LDR service dependencies.
####
-FROM python:3.14-slim@sha256:9006fc63e3eaedc00ebc81193c99528575a2f9b9e3fb36d95e94814c23f31f47 AS builder-base
+FROM python:3.14-slim@sha256:6a27522252aef8432841f224d9baaa6e9fce07b07584154fa0b9a96603af7456 AS builder-base
# Set shell to bash with pipefail for safer pipe handling
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
@@ -49,7 +49,7 @@ RUN apt-get update -o Acquire::Retries=3 && apt-get upgrade -y -o Acquire::Retri
# Note: hishel<1.0.0 is required due to https://github.com/pdm-project/pdm/issues/3657
# Note: wheel>=0.46.2 is required for CVE-2026-24049 fix (path traversal)
RUN pip3 install --no-cache-dir pip==26.0 \
- && pip install --no-cache-dir pdm==2.26.2 "hishel<1.0.0" playwright==1.57.0 "wheel>=0.46.2"
+ && pip install --no-cache-dir pdm==2.26.2 "hishel<1.0.0" playwright==1.58.0 "wheel>=0.46.2"
# disable update check
ENV PDM_CHECK_UPDATE=false
# Increase PDM request timeout from default 15s to 120s for large packages (numpy, torch)
@@ -173,7 +173,7 @@ RUN CHROME_PATH=$(find /root/.cache/ms-playwright -name chrome -type f 2>/dev/nu
# Set environment variables for Puppeteer to use Playwright's Chrome
ENV PUPPETEER_SKIP_DOWNLOAD=true
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
-ENV PUPPETEER_EXECUTABLE_PATH=/root/.cache/ms-playwright/chromium-1181/chrome-linux/chrome
+ENV PUPPETEER_EXECUTABLE_PATH=/root/.cache/ms-playwright/chromium-1208/chrome-linux/chrome
# Copy test files to /app where they will be run from
RUN mkdir -p /app && cp -r /install/tests /app/
@@ -197,7 +197,7 @@ ENV PATH="/install/.venv/bin:$PATH"
####
# Runs the LDR service.
###
-FROM python:3.14-slim@sha256:9006fc63e3eaedc00ebc81193c99528575a2f9b9e3fb36d95e94814c23f31f47 AS ldr
+FROM python:3.14-slim@sha256:6a27522252aef8432841f224d9baaa6e9fce07b07584154fa0b9a96603af7456 AS ldr
# Set shell to bash with pipefail for safer pipe handling
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
@@ -212,8 +212,9 @@ RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
sqlcipher \
libsqlcipher1 \
- # gosu for safe user switching in entrypoint
- gosu \
+ # setpriv (from util-linux, already in base image) handles user switching
+ # in the entrypoint — no additional package needed
+ #
# WeasyPrint dependencies for PDF generation
libcairo2 \
libpango-1.0-0 \
@@ -237,15 +238,17 @@ RUN mkdir -p /app/.config/local_deep_research /home/ldruser/.local/share && \
COPY --chown=ldruser:ldruser --from=builder /install/.venv/ /install/.venv
ENV PATH="/install/.venv/bin:$PATH"
-# Verify SQLCipher, then install browsers — both as ldruser via gosu.
+# Verify SQLCipher, then install browsers — both as ldruser via setpriv.
# Running as ldruser ensures:
# 1. Python __pycache__ files created during import are owned by ldruser
# 2. Browser binaries land in ldruser's $HOME (~/.cache/ms-playwright/)
# This avoids the need to chown 500MB+ of files later.
-RUN HOME=/home/ldruser gosu ldruser python -c "from local_deep_research.database.sqlcipher_compat import get_sqlcipher_module; \
+RUN HOME=/home/ldruser setpriv --reuid=ldruser --regid=ldruser --init-groups -- \
+ python -c "from local_deep_research.database.sqlcipher_compat import get_sqlcipher_module; \
sqlcipher = get_sqlcipher_module(); \
print(f'✓ SQLCipher module loaded successfully: {sqlcipher}')" \
- && HOME=/home/ldruser gosu ldruser playwright install
+ && HOME=/home/ldruser setpriv --reuid=ldruser --regid=ldruser --init-groups -- \
+ playwright install
# Create volume for persistent configuration
# Use /app for configuration to support non-root user
diff --git a/cookiecutter-docker/{{cookiecutter.config_name}}/docker-compose.{{cookiecutter.config_name}}.yml b/cookiecutter-docker/{{cookiecutter.config_name}}/docker-compose.{{cookiecutter.config_name}}.yml
index 860c81bf9d..600faac119 100644
--- a/cookiecutter-docker/{{cookiecutter.config_name}}/docker-compose.{{cookiecutter.config_name}}.yml
+++ b/cookiecutter-docker/{{cookiecutter.config_name}}/docker-compose.{{cookiecutter.config_name}}.yml
@@ -43,8 +43,8 @@ services:
- CHOWN # chown -R ldruser:ldruser /data
- FOWNER # chmod on files not owned by root
- DAC_OVERRIDE # mkdir in /home/ldruser (.config dir)
- - SETUID # gosu setuid() to switch to ldruser
- - SETGID # gosu setgid() to switch group
+ - SETUID # setpriv setuid() to switch to ldruser
+ - SETGID # setpriv setgid() to switch group
restart: unless-stopped
{%- if cookiecutter._enable_ollama or cookiecutter.enable_searxng %}
depends_on:
diff --git a/docker-compose.yml b/docker-compose.yml
index cb549597b2..9180e8520c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -139,15 +139,15 @@ services:
# CONTAINER SECURITY — Principle of Least Privilege
# ============================================================================
# The entrypoint (scripts/ldr_entrypoint.sh) runs as root to fix Docker
- # volume ownership, then drops to ldruser (UID 1000) via gosu before
+ # volume ownership, then drops to ldruser (UID 1000) via setpriv before
# starting the application. The privilege timeline is:
#
# 1. Root phase (brief): mkdir, chmod, chown on /data and /home/ldruser
- # 2. gosu execve(): irreversible switch to ldruser (empty capability set)
+ # 2. setpriv exec: irreversible switch to ldruser (empty capability set)
# 3. App phase: runs as ldruser with zero capabilities
#
# We drop ALL capabilities, then add back only what the root phase needs.
- # no-new-privileges prevents re-escalation after gosu drops privileges.
+ # no-new-privileges prevents re-escalation after setpriv drops privileges.
#
# WARNING: Removing cap_add entries will break container startup — the
# entrypoint will fail with "Operation not permitted" on chown/chmod.
@@ -161,8 +161,8 @@ services:
- CHOWN # chown -R ldruser:ldruser /data
- FOWNER # chmod on files not owned by root (after chown to ldruser)
- DAC_OVERRIDE # mkdir in /home/ldruser (.config dir, mode 755 = no write for others)
- - SETUID # gosu setuid() syscall to switch to ldruser
- - SETGID # gosu setgid() syscall to switch group
+ - SETUID # setpriv setuid() syscall to switch to ldruser
+ - SETGID # setpriv setgid() syscall to switch group
restart: unless-stopped
depends_on:
ollama:
diff --git a/docs/faq.md b/docs/faq.md
index 71416fc58e..d2ed478d16 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -440,7 +440,7 @@ or:
error: failed switching to "ldruser": operation not permitted
```
-This means Linux capabilities needed by the entrypoint are blocked by the LXC container. The `chown` error indicates missing `CAP_CHOWN`/`CAP_FOWNER`, while the `gosu` error indicates missing `CAP_SETUID`/`CAP_SETGID`.
+This means Linux capabilities needed by the entrypoint are blocked by the LXC container. The `chown` error indicates missing `CAP_CHOWN`/`CAP_FOWNER`, while the `setpriv` error indicates missing `CAP_SETUID`/`CAP_SETGID`.
**Solutions (try in order):**
@@ -458,7 +458,7 @@ This means Linux capabilities needed by the entrypoint are blocked by the LXC co
3. **Use a privileged LXC container** (trades security for compatibility):
- When creating the LXC with Proxmox community scripts, select "Privileged" in advanced settings
-**Background:** The LDR container runs its entrypoint as root to fix volume permissions, then uses `gosu` to drop to a non-root user (`ldruser`) for security. `gosu` calls `setuid()`/`setgid()` which require these capabilities. In standard Docker this works out of the box, but Docker-inside-LXC inherits the outer container's capability restrictions.
+**Background:** The LDR container runs its entrypoint as root to fix volume permissions, then uses `setpriv` to drop to a non-root user (`ldruser`) for security. `setpriv` calls `setuid()`/`setgid()` which require these capabilities. In standard Docker this works out of the box, but Docker-inside-LXC inherits the outer container's capability restrictions.
## Platform-Specific Issues
diff --git a/scripts/ldr_entrypoint.sh b/scripts/ldr_entrypoint.sh
index c09d693759..16bd8cd03f 100755
--- a/scripts/ldr_entrypoint.sh
+++ b/scripts/ldr_entrypoint.sh
@@ -34,14 +34,14 @@ chmod -R 700 /home/ldruser/.config
echo "Starting LDR application as ldruser..."
# Switch to ldruser and execute the command.
-# gosu needs CAP_SETUID and CAP_SETGID to call setuid()/setgid() syscalls.
+# setpriv needs CAP_SETUID and CAP_SETGID to call setuid()/setgid() syscalls.
# These are granted via cap_add in docker-compose.yml, but in restricted
# environments (e.g. Proxmox LXC) the outer container may block them.
-if ! gosu ldruser true 2>/dev/null; then
+if ! setpriv --reuid=ldruser --regid=ldruser --init-groups -- true 2>/dev/null; then
echo ""
echo "ERROR: Failed to switch to non-root user 'ldruser'."
echo ""
- echo " gosu requires CAP_SETUID and CAP_SETGID Linux capabilities."
+ echo " setpriv requires CAP_SETUID and CAP_SETGID Linux capabilities."
echo " This typically happens in LXC containers (e.g. Proxmox) that"
echo " restrict these capabilities."
echo ""
@@ -53,4 +53,4 @@ if ! gosu ldruser true 2>/dev/null; then
echo ""
exit 1
fi
-exec gosu ldruser "$@"
+exec setpriv --reuid=ldruser --regid=ldruser --init-groups -- "$@"