You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix pickle deserialization vulnerability in RAG cache #447
src/gaia/rag/sdk.py:1620 uses pickle.load() on cached data without any validation:
cached_data=pickle.load(f)
A corrupted or tampered cache file can cause crashes or arbitrary code execution. There is no size limit check, no format validation, and no hash verification before deserialization.
Impact
Corrupted .pkl files crash the RAG system permanently
No integrity verification of cached data
Potential code execution via crafted pickle files (local attack surface)
Proposed Fix
Add format version header (GAIA_CACHE_V1) to cache files
Store and verify SHA-256 checksum before unpickling
Validate file size before loading (reject unreasonably large caches)
Wrap pickle.load() in robust try/except with specific exception types (EOFError, pickle.UnpicklingError, KeyError)
On any load failure: delete corrupted cache file, log warning, re-index
Long-term: plan migration to JSON metadata + numpy embeddings
Files
src/gaia/rag/sdk.py (lines 1615-1630)
Acceptance Criteria
Corrupted cache files are detected and deleted automatically
Cache load failures trigger clean re-index, not crash
Hi, I'd like to work on this. I have a fix ready that adds a format version header, SHA-256 checksum verification, file size limits, and auto-recovery with cache file deletion. I'll open a PR shortly
Activity
albiol2004 commentedon Apr 8, 2026
Hi, I'd like to work on this. I have a fix ready that adds a format version header, SHA-256 checksum verification, file size limits, and auto-recovery with cache file deletion. I'll open a PR shortly
fix: add integrity verification to RAG cache pickle loading (amd#447)
fix: add integrity verification to RAG cache pickle loading (#447) (#722
Release v0.17.2 (#744)