Skip to content

Protect pony-lint against oversize ignore files#5140

Merged
SeanTAllen merged 1 commit intomainfrom
ignore-file-size-bound
Apr 5, 2026
Merged

Protect pony-lint against oversize ignore files#5140
SeanTAllen merged 1 commit intomainfrom
ignore-file-size-bound

Conversation

@SeanTAllen
Copy link
Copy Markdown
Member

IgnoreMatcher._load_file reads .gitignore and .ignore files without checking size first. With hierarchical ignore loading, each directory in the walk can have its own ignore files, so an oversized one could cause unexpected memory consumption.

Adds a 64 KB size check (matching the config file bound from #5138) and also reports files that exist but cannot be opened. Errors surface as lint/ignore-error diagnostics with exit code 2, following the same pattern as config file errors.

Closes #5137

IgnoreMatcher._load_file reads .gitignore and .ignore files without
checking size first. With hierarchical ignore loading, each directory in
the walk can have its own ignore files, so an oversized one could cause
unexpected memory consumption.

Add a 64 KB size check (matching the config file bound) and also report
files that exist but cannot be opened. Errors surface as lint/ignore-error
diagnostics with exit code 2, following the same pattern as config file
errors.

Closes #5137
@SeanTAllen SeanTAllen added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Apr 5, 2026
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Apr 5, 2026
@SeanTAllen SeanTAllen added changelog - added Automatically add "Added" CHANGELOG entry on merge and removed changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge labels Apr 5, 2026
@SeanTAllen SeanTAllen merged commit 1157bf8 into main Apr 5, 2026
16 checks passed
@SeanTAllen SeanTAllen deleted the ignore-file-size-bound branch April 5, 2026 22:45
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Apr 5, 2026
github-actions bot pushed a commit that referenced this pull request Apr 5, 2026
github-actions bot pushed a commit that referenced this pull request Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog - added Automatically add "Added" CHANGELOG entry on merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pony-lint: add size bound for ignore files

2 participants