Skip to content

rimraf params validate problem #326

Open

Description

@zuishuaicc

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

Activity

  1. added a commit that references this issue on Feb 23, 2026
    5cb3ec8
  2. abhu85 commented on Feb 23, 2026

    @abhu85

    I've submitted a fix for this in #342.

    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).

  3. added 4 commits that reference this issue on Mar 4, 2026
    b684074
    59359ac
    cce8085
    5f57697
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions