Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fool proof subcommands #2

Open
Zhann opened this issue May 5, 2014 · 3 comments
Open

fool proof subcommands #2

Zhann opened this issue May 5, 2014 · 3 comments

Comments

@Zhann
Copy link
Contributor

Zhann commented May 5, 2014

We should think about making subcommands for commonly used patterns (e.g. grep, test, ...). The way it works now, bunka is too dangerous/destructive. One bunka -t 'rm -fr /' and you can close business.

@mimor
Copy link
Contributor

mimor commented Jun 12, 2014

Perhaps list a few commonly (safe) used ones, give a warning a-la 'Are you sure you want to do this?'
We could work with a 'whitelist' that you can populate with what you consider as safe.

@Zhann
Copy link
Contributor Author

Zhann commented Jun 12, 2014

Thing is that I don't know what's the best way forward. Blacklists are a bad idea since you have to treat every unknown command as dangerous. Whitelists, like you mention, not so. But the logic will be fairly complex if you need to whitelist stuff like $ [ "$(ls -A /foo/)" ] || (cat /bar/file | grep 'stuff') and make sure not to whitelust stuff like :(){ :|:& };: # fork bomb.

What I have in mind at the moment is that you could use subcommands, something like:

bunka grep 'foo /path/to/bar'
bunka file-exists '/foo/bar'
bunka dir-exists '/foo/bar/'

And that you can still use regular stuff with:
bunka exec 'touch /foo/bar' 'name:web*

And that this exec subcommand would prompt you with something like:

This will run `touch /foo/bar` on the following servers:
web1
web2
web3
Are you sure you want to do this? [y/N]

If anyone's got any better ideas, feel free to share. But at the moment I think this would be the easiest way forward without adding too much complexity,

@jeroenj
Copy link
Contributor

jeroenj commented Jun 12, 2014

I'd say that @Zhann's approach will be the safest. It will involve more work, but to me it seems the right way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants