Skip to content

Bound git exclude reads when adding cdidx database ignores #2871

Description

@Widthdom

Summary

Adding the cdidx database ignore entry reads .git/info/exclude completely and splits it into a set without a size cap.

Evidence

src/CodeIndex/Cli/IndexCommandRunner.cs has AddToGitExclude load ioExcludeFile with File.ReadAllText(ioExcludeFile) and then Split('\n').ToHashSet(...). There is no limit on the existing exclude file size or line count.

Impact

A very large or corrupted exclude file can cause avoidable memory use during indexing/setup paths that only need to append a small managed entry.

Suggested fix

Check file length before reading, stream only enough to detect the managed entry when possible, and fail or skip gracefully when the exclude file is unexpectedly large.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions