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: Address AI reviewer feedback for Docker security

LearningCircuit9233e8ed3cd2
diff --git a/Dockerfile b/Dockerfile
index 680a9f678b..351198c5f6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -90,14 +90,15 @@ ENV DOCKER_ENV=true
# Don't skip Chrome download - let Puppeteer download its own Chrome as fallback
# ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
-# Create non-root user for running tests
+# Create non-root user for running tests (UID 1000 is standard for first non-root user)
RUN groupadd -r ldruser && useradd -r -g ldruser -u 1000 ldruser
-# Create puppeteer cache directory with proper permissions
-# Use user ownership instead of 777 for security
-RUN mkdir -p /app/puppeteer-cache && \
- chown -R ldruser:ldruser /app/puppeteer-cache && \
- chmod -R 755 /app/puppeteer-cache
+# Create directories with proper permissions for non-root user
+# - puppeteer-cache: for Puppeteer/Chrome cache
+# - /app/.config: for application configuration volume
+RUN mkdir -p /app/puppeteer-cache /app/.config/local_deep_research && \
+ chown -R ldruser:ldruser /app && \
+ chmod -R 755 /app
# Install Playwright with Chromium first (before npm packages)
RUN playwright install --with-deps chromium || echo "Playwright install failed, will use Puppeteer's Chrome"
@@ -114,24 +115,33 @@ RUN npm install
WORKDIR /install/tests/ui_tests
RUN npm install
+# Copy Playwright Chrome to a location accessible by ldruser and set permissions
+RUN mkdir -p /app/playwright-cache && \
+ cp -r /root/.cache/ms-playwright/* /app/playwright-cache/ 2>/dev/null || true && \
+ chown -R ldruser:ldruser /app/playwright-cache && \
+ chmod -R 755 /app/playwright-cache
+
# Set CHROME_BIN to help Puppeteer find Chrome from Playwright
# Try to find and set Chrome binary path from Playwright's installation
-RUN CHROME_PATH=$(find /root/.cache/ms-playwright -name chrome -type f 2>/dev/null | head -1) && \
+RUN CHROME_PATH=$(find /app/playwright-cache -name chrome -type f 2>/dev/null | head -1) && \
if [ -n "$CHROME_PATH" ]; then \
echo "export CHROME_BIN=$CHROME_PATH" >> /etc/profile.d/chrome.sh; \
echo "export PUPPETEER_EXECUTABLE_PATH=$CHROME_PATH" >> /etc/profile.d/chrome.sh; \
fi || true
-# Set environment variables for Puppeteer to use Playwright's Chrome
+# Set environment variables for Puppeteer to use Playwright's Chrome (copied to /app)
ENV PUPPETEER_SKIP_DOWNLOAD=true
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
-ENV PUPPETEER_EXECUTABLE_PATH=/root/.cache/ms-playwright/chromium-1181/chrome-linux/chrome
+# Use path in /app which is accessible by ldruser
+ENV PUPPETEER_EXECUTABLE_PATH=/app/playwright-cache/chromium-1181/chrome-linux/chrome
+ENV PLAYWRIGHT_BROWSERS_PATH=/app/playwright-cache
# Copy test files to /app where they will be run from
RUN mkdir -p /app && cp -r /install/tests /app/
-# Ensure Chrome binaries have correct permissions
-RUN chmod -R 755 /app/puppeteer-cache
+# Ensure all /app directories have correct ownership for ldruser
+RUN chown -R ldruser:ldruser /app && \
+ chmod -R 755 /app
WORKDIR /install
@@ -142,6 +152,9 @@ RUN pdm install --no-editable
# Configure path to default to the venv python.
ENV PATH="/install/.venv/bin:$PATH"
+# Switch to non-root user for running tests (security best practice)
+USER ldruser
+
####
# Runs the LDR service.
###