Skip to content

fix(input): enforce maxFileSize while reading path inputs #63

Description

@Ramzi-Abidi

Problem

Path inputs validate size using stat(), then later read using unrestricted readFile().

If file grows or is replaced between these operations, it can exceed maxFileSize, consume excessive memory, and return stale size metadata.

Proposed fix

  • Read from one opened file handle
  • Read at most maxBytes + 1
  • Throw InputTooLargeError when exceeded
  • Close handle in finally
  • Report actual bytes read

Acceptance criteria

  • Oversized path input rejected
  • File growth/replacement cannot bypass limit
  • result.size matches actual input
  • Add generated temporary-file regression tests

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions