What is the proper way to sanitize user input when using a Ruby system call? -
i have ruby on rails application using x virtual framebuffer along program grab images web. have structured command shown below: xvfb-run --server-args=-screen 0 1024x768x24 /my/c++/app #{user_provided_url}
what best way make call in rails maximum amount of safety user input?
you don't need sanitize input in rails. if it's url , it's in string format has escaped characters passed url net::http call. said, write regular expression check url looks valid. following make sure url parse-able:
uri = uri.parse(user_provided_url)
you can query object it's relevant parts:
uri.path uri.host uri.port
Comments
Post a Comment