in reply to Safely passing CGI form data to a shell command
First off, qx is not going to be easily secure. Use system LIST, or, in your case, IPC::Open2 with a list. (You can close the writer handle immediately since you don't need it.) This helps get rid of the shell, which is a huge annoyance except when it's a huge help. This isn't one of those help times.
Second, as has been mentioned, you want to detaint whatever is passed in. You want to use /([[:alpha:]-]+)/ or something like that. [:alpha:] is a character class (thus must also be inside []'s) which honours locale information. Which may mean setting your locale (say to a UTF8 locale) and decoding the input to UTF8 as well (before detainting, of course) - I'm not too sure here because I've not had a reason to cross codepages before (that is, what is passed in may be a different codepage than what I'm running in).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Safely passing CGI form data to a shell command
by Tommy (Chaplain) on Apr 21, 2005 at 19:10 UTC | |
by salva (Canon) on Apr 21, 2005 at 19:48 UTC | |
by Tommy (Chaplain) on Apr 21, 2005 at 19:43 UTC | |
by Tanktalus (Canon) on Apr 21, 2005 at 19:53 UTC | |
by Tommy (Chaplain) on Apr 21, 2005 at 22:56 UTC |