mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-01 14:43:28 +08:00
fix: harden utils.js edge cases and add input validation
- Guard findFiles() against null/undefined dir and pattern parameters (previously crashed with TypeError on .replace() or fs.existsSync()) - Wrap countInFile() and grepFile() regex construction in try-catch to handle invalid regex strings like '(unclosed' (previously crashed with SyntaxError: Invalid regular expression) - Add try-catch to replaceInFile() with descriptive error logging - Add 1MB size limit to readStdinJson() matching the PostToolUse hooks (previously had unbounded stdin accumulation) - Improve ensureDir() error message to include the directory path - Add 128-char length limit to setAlias() to prevent oversized alias names from inflating the JSON store - Update utils.d.ts with new maxSize option on ReadStdinJsonOptions
This commit is contained in:
5
scripts/lib/utils.d.ts
vendored
5
scripts/lib/utils.d.ts
vendored
@@ -123,6 +123,11 @@ export interface ReadStdinJsonOptions {
|
||||
* if stdin never closes. Default: 5000
|
||||
*/
|
||||
timeoutMs?: number;
|
||||
/**
|
||||
* Maximum stdin data size in bytes. Prevents unbounded memory growth.
|
||||
* Default: 1048576 (1MB)
|
||||
*/
|
||||
maxSize?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user