in reply to Re^6: Insecure dependency in system under -T, with list form invocation
in thread Insecure dependency in system under -T, with list form invocation

Wrapping the untainting into a sub for things that should be untainted the same way does make sense.

Your specific regex for untaining Unix paths works for common cases, but not for everything that's a valid path on most file systems. If you really want to make sure only that regex matches and ignore the more general case, that's fine but then the name of the sub is a bit misleading. Perhaps something like "untaintsimpleunixpath" or "untaintcommonunixpath". Alternately, having some good documentation that explains the limited range of paths it will allow could help clear up any confusion. Always assume you're writing code for another programmer as much as for the computer. If you're that programmer six months from now, you just might thank yourself.

On a stylistic note, and this is a personal preference but one that's pretty common, don't be afraid to use underscores between words in subroutine names. I find "untaint_unix_path" much more readable than "untaintunixpath". Some others would rewrite that as "untaintUnixPath", which I find clearer than the all-lowercase version but not as clear and the underscored version.

  • Comment on Re^7: Insecure dependency in system under -T, with list form invocation