Finding
db restore creates staging and backup directories next to the live database, then copies or moves DB/WAL/SHM files through them. These temporary directories can contain full database contents but are created through default Directory.CreateDirectory permissions.
Evidence
src/CodeIndex/Cli/DbCommandRunner.cs:611 builds .restore-tmp-* and .restore-backup-* paths.
src/CodeIndex/Cli/DbCommandRunner.cs:613 creates the restore temp directory.
src/CodeIndex/Cli/DbCommandRunner.cs:622 creates the backup directory.
- The following moves and copies handle the live SQLite database and sidecars.
Suggested fix
Create restore staging and backup directories with owner-only permissions on POSIX, keep Windows behavior compatible, and add permission regression tests.
Finding
db restorecreates staging and backup directories next to the live database, then copies or moves DB/WAL/SHM files through them. These temporary directories can contain full database contents but are created through defaultDirectory.CreateDirectorypermissions.Evidence
src/CodeIndex/Cli/DbCommandRunner.cs:611builds.restore-tmp-*and.restore-backup-*paths.src/CodeIndex/Cli/DbCommandRunner.cs:613creates the restore temp directory.src/CodeIndex/Cli/DbCommandRunner.cs:622creates the backup directory.Suggested fix
Create restore staging and backup directories with owner-only permissions on POSIX, keep Windows behavior compatible, and add permission regression tests.