Skip to content

Sanitize raw exception messages in indexing and import diagnostics #3796

@Widthdom

Description

@Widthdom

Found while dogfooding the locally built cdidx on branch codex/search-audit-issues-20260619.

Duplicate check: no open issue found for sanitize raw exception messages indexing import manifest diagnostics ex.Message.

Evidence:

  • src/CodeIndex/Cli/IndexCommandRunner.FullScan.cs:27 falls back to raw ex.Message for index file exceptions.
  • src/CodeIndex/Cli/ExportImportCommandRunner.cs:658 returns InvalidDataException.Message from manifest reads.
  • Similar diagnostics already use CommandErrorWriter.FormatSanitizedException in other paths.

Problem:
Raw exception messages can include user-controlled paths or payload fragments. Index/import diagnostics should use consistent bounded and redacted formatting.

Acceptance criteria:

  • Replace raw exception-message fallbacks in indexing/import diagnostics with sanitized bounded formatting.
  • Preserve specific regex timeout and structured manifest depth messages.
  • Add tests for long path/payload fragments in exception messages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions