Skip to content

Global log max-size settings should cap accepted byte/MB values #2890

Description

@Widthdom

Finding

Global log retention count is clamped, but max-size environment and CLI values are only checked for being positive. Very large values can effectively disable rotation or allow unexpectedly large log files.

Evidence

  • src/CodeIndex/Cli/GlobalToolLog.cs:634 clamps retain count to 1..10000.
  • src/CodeIndex/Cli/GlobalToolLog.cs:638 accepts any positive CDIDX_LOG_MAX_SIZE_MB int and multiplies it by MiB.
  • src/CodeIndex/Cli/GlobalToolLog.cs:640 accepts any positive CDIDX_GLOBAL_TOOL_LOG_MAX_BYTES long.
  • src/CodeIndex/Cli/ProgramRunner.cs:612 validates --log-max-size-mb as positive but does not cap it.

Suggested fix

Add a documented maximum log size, clamp or reject larger CLI/environment values consistently, and cover both MB and bytes inputs in tests.

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