views:

33

answers:

1

I'm generating text images using imagemagick by passing user inputs via command. I'm concerned that a user could enter something malicious.

# regex pattern
[^\s\w\.&!?"]

# image generation code, in Ruby
"convert -quality 100 -background black -fill red -font Times-Bold -size x50 label:'#{@line1}' output.jpg"
+1  A: 

No it's a not :)

have a look at this chapter of programming ruby for more security options: http://ruby-doc.org/docs/ProgrammingRuby/html/taint.html

hellvinz