Skip to content

Recursive temporary-directory cleanup should assert the directory is under an expected safe root #3379

Description

@Widthdom

Found while dogfooding the current source.

DbCommandRunner.TryDeleteTemporaryDirectory calls Directory.Delete(path, recursive: true) on caller-provided temp paths after only Directory.Exists(path).

Evidence: src/CodeIndex/Cli/DbCommandRunner.cs:893

The current callers appear to pass checkpoint/restore temp directories, but recursive delete helpers are high-impact enough to deserve a descendant/safe-root assertion before deleting.

Expected: require cleanup targets to be under the expected .cdidx temp/checkpoint root or another explicit safe base, and test that accidental or malformed paths are rejected before recursive deletion.

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