Giter Site home page Giter Site logo

Comments (6)

nightscape avatar nightscape commented on July 20, 2024

Ok, turns out that if you run this thing without Rails then Config.mock_dir keeps its default nil:
https://github.com/zeisler/active_mocker/blob/master/lib/active_mocker/config.rb#L34

Wow, so scare, much danger :p

from active_mocker.

zeisler avatar zeisler commented on July 20, 2024

This is not good, I am sorry that this happened. I would of gotten to it sooner, but I am in the middle of a move and didn't see it. I will make a patch asap.

from active_mocker.

zeisler avatar zeisler commented on July 20, 2024

With these commit I have put in several guards to keep this from ever happening again. 86fb8bd db728d0

This has been fixed by raising an error if mock_dir is not set. Also, it will never delete any directories, only files that match *_mock.rb.

Releasing version 1.8.2 shortly. Due to the severity of this issue it highly recommended that everyone upgrade.

from active_mocker.

zeisler avatar zeisler commented on July 20, 2024

After testing this in a virtual machine I found it can only happen if you're running as root. So to make this happen you have to run as root and not have Rails in your gemfile. I would recommend only running as root when absolutely necessary as a general rule in Unix. Neverless the issue is fixed and will not happen no matter if your are running as root or not.

Repeatable Test Steps
DO NOT TRY ON YOUR PERSONAL COMPUTER!

$ sudo irb
irb(main):002:0> require 'fileutils'
=> true
irb(main):003:0> FileUtils.rm_rf("#{nil}/")

from active_mocker.

jmtoball avatar jmtoball commented on July 20, 2024

Although you can still delete all files that belong to you as non-root. At least that's what happened to me and what @nightscape described in this issue. Thank you for fixing this so quickly :-)

from active_mocker.

zeisler avatar zeisler commented on July 20, 2024

Again I apologize for this happening, it's a complete over sight in my part. Hopefully you had backups.

If you find that ActiveMocker brings value to you consider contributing. There are places that need documentation, feature request, code clean up and optimizations that would all be welcome.

from active_mocker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.