in reply to Re: Re: Cleaning up directory paths.
in thread Cleaning up directory paths.

But even if I were to present a list with a fixed list of paths, I would still end up needing to clean up and untaint that incoming variable anyways.

Right. Good point. (Sorry I didn't think of that at first... did I mention that web programming is something I do relatively seldom in my job?)

So, if you have the list that you present on people's browsers, and you get back a parameter string, rather than trying to untaint the parameter string, you just need to check whether it's an exact match to a particular string in your list of allowable paths. And this would be easy if you just store the allowed path list as keys of a hash.

Once you establish that it does match, you don't really need the parameter string after that (no need to untaint it) -- just use the matched item from your list (which the script reads directly from the server). And if there was no match, you just send whatever alternative feedback you deem appropriate...

  • Comment on Re: Re: Re: Cleaning up directory paths.