I am taking an input string from a user and using that as the parameters for a command line back-end program.
What is the best way to ensure that this input is "safe"? Aka they haven't inserted "; cd /; rm -rf" or some other ugliness into field?
Without any sanitizing I have...
@query = params[:query]
@result = %x( mycommand #{@query} )
I need to get the output of the command, so I can't use system("command","parameters") as that only returns true or false but would provide protection.
I know this is dangerous... thanks in advance.