-
-
Notifications
You must be signed in to change notification settings - Fork 161
Description
Summary
I configured Aruba in an incorrect-but-reasonable way and it deleted my entire repository.
Current Behavior
I was trying to get Aruba to run processes in the same working directory as the test runner, so I set:
Aruba.configure do |config|
config.working_directory = '.'
end
It was not at all obvious to me that this would treat the current working directory as a temp directory and so completely delete it once testing was finished. The term "working directory" is not generally associated with temporary directories, so it seems extremely dangerous to delete it prompting.
I was lucky not to lose too much work to this, but this seems like an extremely dangerous footgun in general.
Possible Solution
I could see a couple mitigations:
-
Warn users wherever possible in the documentation that any directory passed to this option will be deleted.
-
Rename the configuration variable to something clearer, like
temp_directory
. -
Before deleting everything, check to make sure if it looks like it shouldn't be deleted (e.g. contains a
.git
/.hg
directory, is the same as the test process's CWD, etc) and prompt or refuse to delete. -
Provide a more obvious way of configuring the behavior I was trying to set, that is, the working directory in which the process runs.