You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i use rimraf to remove specified file,but i used like this rimrafSync('') unexpectedly,then, all files under my project was deleted,i think ,is it necessary to validate the params path in rimrafSync('') ,this params can not be an empty string.it is to dangerous
The root cause is that path.resolve('') returns process.cwd(), so an empty string silently becomes a valid path pointing to the current directory. The fix adds validation to reject empty and whitespace-only paths before they're resolved, throwing ERR_INVALID_ARG_VALUE with a clear error message.
This is consistent with how rimraf already validates other dangerous inputs (null bytes, root directory).
Activity
fix: reject empty or whitespace-only paths to prevent accidental cwd …
abhu85 commentedon Feb 23, 2026
I've submitted a fix for this in #342.
The root cause is that
path.resolve('')returnsprocess.cwd(), so an empty string silently becomes a valid path pointing to the current directory. The fix adds validation to reject empty and whitespace-only paths before they're resolved, throwingERR_INVALID_ARG_VALUEwith a clear error message.This is consistent with how rimraf already validates other dangerous inputs (null bytes, root directory).
mimic node's intended behavior with weird paths
mimic node's intended behavior with weird paths
mimic node's intended behavior with weird paths
mimic node's intended behavior with weird paths