Repository navigation
Description
Problem
Track reducing Basic Memory's dependency attack surface by removing, replacing, or making optional LiteLLM and/or Pillow. This is separate from the immediate dependency updates and image-decoder restriction in #1805.
Pillow remains locked at 12.3.0 because fastembed constrains Pillow below 13. The GIF allowlist mitigation in #1805 initially left GHSA-74r2-7ff9-mjj2 reachable: quadratic CPU consumption occurs inside Image.open(), before resizing. Follow-up on that PR removes GIF from the allowed decoders, including GIF files disguised with a .png extension. This is a targeted mitigation, not a claim that every Pillow advisory is resolved.
LiteLLM has a documented supply-chain compromise affecting PyPI versions 1.82.7 and 1.82.8. The maintainer report is dated March 24, 2026; this issue does not assert that the current 1.91.5 lock is compromised or that Basic Memory installed an affected release. SDK-only use does not by itself protect against malicious package initialization code.
Work
- Inventory LiteLLM embedding/reranking usage and Pillow decoding, including transitive requirements from fastembed and document ingestion.
- Evaluate direct provider SDKs or smaller adapters in place of LiteLLM, preserving configured provider behavior, cancellation, retries and errors.
- Evaluate removing Pillow-based image transformation, making it optional, or decoding in a resource-limited subprocess. Preserve a clear user-facing unsupported-format response.
- Identify whether removing the direct dependency actually removes it from default and optional dependency graphs.
- Resolve the fastembed/Pillow constraint before claiming a Pillow upgrade is available to PyPI consumers; a local uv override alone is insufficient.
- Review release/lock history against confirmed compromised LiteLLM versions. Escalate any evidence of installation separately; do not assume exposure from package presence alone.
- Refresh the advisory inventory and classify actual reachable paths, especially still-allowed image formats. Do not rely on a fixed advisory count.
Acceptance criteria
- Document the keep/remove/replace decision for each dependency, with compatibility and maintenance costs.
- Ship the selected changes with provider and image behavior regression tests.
- Verify published package metadata, default installation and supported extras, not only uv.lock.
- Ensure blocked formats are rejected before invoking their decoders; test file content independently of extension/MIME.
- Record remaining reachable security risks and owners; do not close this issue solely because fix(deps): update security dependencies and container trust stores #1805 merges.
References
- PR fix(deps): update security dependencies and container trust stores #1805: fix(deps): update security dependencies and container trust stores #1805
- Pillow GIF advisory: GHSA-74r2-7ff9-mjj2
- LiteLLM maintainer incident report: https://github.com/BerriAI/litellm-docs/blob/main/blog/security_update_march_2026/index.md
- Malicious package advisory: GHSA-92x9-889m-jgmw
Activity
claude commentedon Oct 22, 2026
Claude finished @phernandez's task in 21s —— View job
Triage
enhancement.cloudlabel.<13constraint is resolved. A local uv override isn't enough.uv.lock.Suggested split
The issue bundles several separable tracks. Splitting them could make progress easier to track:
I haven't made any code changes. This pass was triage only.
fix(deps): update security dependencies and container trust stores (#…
Flynn-Kawolsky commentedon Oct 30, 2026
Thank you for tracking this. One data point from a user of the LiteLLM path: I use Voyage for both embeddings (
voyage-4-large, with document and query input types) and reranking (rerank-3), throughsemantic_embedding_provider = "litellm"andreranker_provider = "litellm". In 1.0 the rerank factory offers onlyfastembedandlitellm, so LiteLLM is currently the only way to use a hosted reranker. If LiteLLM is replaced with direct adapters, could Voyage embeddings (with input types and output dimensions) and Voyage reranking stay covered? I'd be happy to test a branch on Windows.phernandez commentedon Nov 3, 2026
litellm is an optional dep now fyi
fix(deps): upgrade Pillow to 13.0.0 and fastembed to 0.9.1 (#2100)
phernandez commentedon Nov 12, 2026
Decision
LiteLLM: keep it as an optional extra. No replacement with direct provider SDKs.
Pillow: keep it as a direct dependency, upgraded to 13.0.0 (#2100).
LiteLLM
litellmextra (litellm>=1.91.5,<1.92.0). A default install, from PyPI or Homebrew, doesn't pull it in. Local FastEmbed and OpenAI embeddings don't need it.semantic_embedding_provider = "litellm"orreranker_provider = "litellm"without the extra raisesSemanticDependenciesMissingError. The error says how to installbasic-memory[litellm]with uv, pip, oruvxfor Homebrew installs.uv.lockon 2026-06-07 (feat(core): add LiteLLM embedding provider #809, 1.85.0), after the March 24 incident. Everyuv.lockrevision on main has locked 1.85.0, 1.91.3 or 1.91.5. Releases: v0.22.0–v0.22.1 locked 1.85.0, v0.23.0–v0.23.2 locked 1.91.3, and v0.24.0, v0.24.1 and v1.0.0 locked 1.91.5. v0.24.x listed LiteLLM as a default dependency, and v1.0.0 made it optional.Pillow
bm_readdecodes an image and re-encodes it as a JPEG under the inline size budget (src/basic_memory/mcp/file_content.py). Dropping it would mean returning raw image bytes with no resizing. fastembed (required) and python-pptx (documentsextra) also depend on it, so removing our own use wouldn't take it out of the install.pillow<14, so fix(deps): upgrade Pillow to 13.0.0 and fastembed to 0.9.1 #2100 raises the minimums tofastembed>=0.9.1andpillow>=13.0.0. Pillow 13.0.0 fixes the October/November advisories, including GHSA-74r2-7ff9-mjj2. The higher minimums apply to PyPI installs, not just our lock.bge-small-en-v1.5vectors from fastembed 0.8.0 and 0.9.1 are identical (max abs diff 0.0), so no reindex is needed. The model cache folder was renamed (models--Qdrant--bge-small-en-v1.5-onnx-Q), so a Linux install downloads the model once more. Cloud's image downloads the model at build time and is unaffected; that check is in fix(deps): upgrade Pillow to 13.0.0 and fastembed to 0.9.1 #2100.bm_readstill decodes only PNG, JPEG and WEBP. Pillow chooses the decoder from the file's bytes, not its extension or MIME type, and the allowlist is passed toImage.open(formats=...), so other decoders never run. A GIF named.pngis refused. Tests are intests/mcp/test_tool_bm_read.py.Remaining risk
pillow>=13and take Pillow security releases as they ship.<1.92.0cap stays until 1.92's Rust bridge works on Python 3.14.pillow>=13.0.0override.