Skip to content

cdidx import should bound archive entry size before extraction #2835

Description

@Widthdom

Summary

cdidx import extracts codeindex.db from a zip archive without checking compressed or uncompressed size. A crafted archive can force excessive disk writes before SQLite validation runs.

Evidence

  • src/CodeIndex/Cli/ExportImportCommandRunner.cs:79 obtains the codeindex.db entry.
  • src/CodeIndex/Cli/ExportImportCommandRunner.cs:83 calls dbEntry.ExtractToFile(tempPath, overwrite: true) with no entry length or copy limit check.
  • Validation with DbContext.TryValidateExistingCodeIndexDb happens only after the extraction completes.

Expected

Import should enforce a maximum uncompressed database size and fail before or during extraction when the archive exceeds that bound.

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