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.
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:634clamps retain count to 1..10000.src/CodeIndex/Cli/GlobalToolLog.cs:638accepts any positiveCDIDX_LOG_MAX_SIZE_MBint and multiplies it by MiB.src/CodeIndex/Cli/GlobalToolLog.cs:640accepts any positiveCDIDX_GLOBAL_TOOL_LOG_MAX_BYTESlong.src/CodeIndex/Cli/ProgramRunner.cs:612validates--log-max-size-mbas 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.