Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(mcp): address security review — auth, host binding, injection, Do…
…cker

- [Critical] Add optional API key auth middleware (--api-key /
  NOTEBOOKLM_MCP_API_KEY); returns HTTP 401 without valid Bearer token;
  warns at startup if unconfigured
- [High] Change default --host from 0.0.0.0 to 127.0.0.1; Dockerfile
  CMD retains explicit 0.0.0.0 for container use
- [High] Fix _wait_and_download_media bug: file_path now only set on
  successful download via dispatch dict, not unconditionally
- [Medium] Add _sanitize_text_input() helper; apply to all free-text
  inputs (instructions, custom_prompt, title, question, content) to
  prevent prompt injection
- [Medium] Add ensure_ascii=False to all json.dumps() calls
- [Medium] Refactor _dispatch_tool into per-tool _handle_* functions
  with a dispatch dict
- [Medium] Move import json, ReportFormat, ArtifactType to top-level
- [Medium] Dockerfile: replace COPY . . with selective COPY; add
  non-root appuser before CMD
- [Medium] .dockerignore: exclude storage_state.json and .notebooklm/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
  • Loading branch information
s4steve and claude committed Mar 9, 2026
commit 69d7847936a420bd4d11a6525357d064ffa274b3
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ __pycache__/
tests/
*.png
*.pptx
storage_state.json
.notebooklm/
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
FROM python:3.12-slim

WORKDIR /app
COPY . .
COPY pyproject.toml .
COPY src/ src/
COPY README.md .

RUN pip install --no-cache-dir -e ".[mcp]"

# Auth file is mounted at runtime (not baked into image)
ENV NOTEBOOKLM_HOME=/data
ENV NOTEBOOKLM_DOWNLOAD_DIR=/downloads

RUN groupadd --system appgroup && useradd --system --gid appgroup appuser
USER appuser

EXPOSE 8765

CMD ["notebooklm-mcp", "--host", "0.0.0.0", "--port", "8765"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

Binding to 0.0.0.0 by default in the Docker container exposes the application to the network. In this application, which handles sensitive Google session cookies and has optional authentication, this default configuration is insecure. It is safer to bind to 127.0.0.1 by default or ensure the application enforces authentication when exposed.

Loading