dylanjcastillo / shell-genie

Your wishes are my commands
MIT License
478 stars 36 forks source link

[Proposal] Prevent destructive commands #14

Closed danimesq closed 11 months ago

danimesq commented 11 months ago

I'm using a basic bash wrapper for shell-genie, BTW: but this doesn't affect the result, in no way.

Screenshot from 2023-09-03 15-22-57

You can simply ask "Explode my Linux" and ironically it will prompt to do; this kind of behavior should be prevented, returning a sorry message.

danimesq commented 11 months ago

@dylanjcastillo I have some initial prompts instructing about safety-first, if you are interested.

dylanjcastillo commented 11 months ago

Hi @danimesq,

Thanks for the feedback. I'll make it clearer in the limitations that you can generate dangerous commands, and that you should not run commands that you don't know how they work.

Though I won't make a safety filter, because:

  1. shell-genie asks the user before running any command.
  2. I haven't come across situations where I ask a question, and it returns a dangerous command without me asking for it. In your example, you ask for a command to make your linux explode, and it kind of gave you a command for that
danimesq commented 11 months ago

Thanks for the feedback. I'll make it clearer in the limitations that you can generate dangerous commands, and that you should not run commands that you don't know how they work.

Implemented in the commits https://github.com/dylanjcastillo/shell-genie/commit/a0a65ccd3cf4abe69a5e4d22e9b268f935f2ff02 and https://github.com/dylanjcastillo/shell-genie/commit/c9991375fa72c7528b1176a25b139abebaf00150.

danimesq commented 11 months ago

@dylanjcastillo, the initial prompt is stored in the user-side or in the backend?

In a fork, can I prepend some custom instructions?

dylanjcastillo commented 11 months ago

Here you go: https://github.com/dylanjcastillo/shell-genie/blob/c9991375fa72c7528b1176a25b139abebaf00150/shell_genie/backends.py#L18

Yes, feel free to edit the instructions as you prefer.

danimesq commented 11 months ago

@dylanjcastillo, I've sent you a tweet requesting a DM.

And I'll come with a PR soon (that's not about adding a prepend instruction).