Skip to content

Bound update-check cache reads before JSON parsing #2870

Description

@Widthdom

Summary

The update-check cache is parsed from a full-file read without first bounding the file size.

Evidence

src/CodeIndex/Cli/UpdateChecker.cs has ReadCache parse JsonDocument.Parse(File.ReadAllText(cachePath)). There is no maximum byte count before the full string allocation and JSON parse.

Impact

A corrupted cache file can make routine update checks allocate excessive memory or fail noisily. Because update checks run around CLI startup paths, this should stay cheap and bounded.

Suggested fix

Use a small cache-size limit before reading/parsing, ignore over-limit cache files, and preserve the existing non-fatal behavior.

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