Finding
SQLite performance pragmas accept environment-provided cache and mmap sizes with no explicit upper bound. Accidental or hostile environment values can request very large SQLite cache or mmap windows for every DbContext connection.
Evidence
src/CodeIndex/Database/DbContext.cs:486 applies PRAGMA cache_size=-{ReadPositiveIntEnvironment(...)}.
src/CodeIndex/Database/DbContext.cs:489 applies PRAGMA mmap_size={ReadNonNegativeLongEnvironment(...)} on 64-bit processes.
src/CodeIndex/Database/DbContext.cs:492 accepts any positive int for CDIDX_SQLITE_CACHE_KB.
src/CodeIndex/Database/DbContext.cs:498 accepts any non-negative long for CDIDX_SQLITE_MMAP_BYTES.
Suggested fix
Define documented maximums, clamp or reject larger values with a warning, and add tests for overflow and excessive values.
Finding
SQLite performance pragmas accept environment-provided cache and mmap sizes with no explicit upper bound. Accidental or hostile environment values can request very large SQLite cache or mmap windows for every
DbContextconnection.Evidence
src/CodeIndex/Database/DbContext.cs:486appliesPRAGMA cache_size=-{ReadPositiveIntEnvironment(...)}.src/CodeIndex/Database/DbContext.cs:489appliesPRAGMA mmap_size={ReadNonNegativeLongEnvironment(...)}on 64-bit processes.src/CodeIndex/Database/DbContext.cs:492accepts any positive int forCDIDX_SQLITE_CACHE_KB.src/CodeIndex/Database/DbContext.cs:498accepts any non-negative long forCDIDX_SQLITE_MMAP_BYTES.Suggested fix
Define documented maximums, clamp or reject larger values with a warning, and add tests for overflow and excessive values.