Skip to content

db restore staging and backup directories should use private permissions #2882

Description

@Widthdom

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsecurity

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions