Skip to content

[BUG] Critical: Script Deletes Entire Working Directory Without Safety Checks #441

@thaZecca

Description

@thaZecca

Hi, I encountered a critical issue in the updater script that can easily lead to complete data loss.

The function keep_specific_items() is called like this:

keep_specific_items(".", "Video", "upload.py")

This means the script deletes everything in the current working directory, except:

  • the “Video” folder,
  • the “upload.py” file,
  • and .git.

This is extremely dangerous because:

  1. If the user runs the script from the wrong folder (e.g., Desktop or another project), the script will delete all their files.
  2. There is no safety check to ensure the script is inside the correct project directory.
  3. There is no backup or recovery mechanism.
  4. The confirmation prompt is easy to skip using -y even accidentally.

For example: On macOS + SSD/APFS, deleted files cannot be recovered, making this behavior catastrophic.

Suggested fixes:

  • Hard-code a safe base path and abort if CWD is not the project folder.
  • Require a second confirmation explicitly typing a phrase (e.g. “DELETE MY FILES”).
  • NEVER run destructive operations on "." — operate only inside a dedicated subfolder.
  • Add a dry-run mode showing what will be deleted.
  • Add validation that the expected files/folders exist before starting deletion.
  • Add an environment variable or config flag to prevent accidental mass deletion.
  • Specify better on the guide how to use it

Please consider addressing this for user safety — the current behavior can easily wipe a user's personal files permanently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions