Re: taint
| From: | Ángel González | Date: | Tue, 15 Sep 2015 23:12:42 +0000 |
| Subject: | Re: taint | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88221@lists.php.net to get a copy of this message | ||
On 15/09/15 18:23, Anthony Ferrara wrote:
Third, it ignores context. This is related to the first two, but I think is a separate concern. An example from the taint RFC (https://wiki.php.net/rfc/taint) is the shell-execution. If the variable is used in the context of command, one escape function is needed. If it's used as an argument, another is needed. Detecting which is not something that's trivial for a language-level taint function. (…) Actually, you almost always will want escapeshellarg(). escapeshellcmd()_might_ be useful for a code like the function example, where you want the user to explicitely provide *several* parameters, *and* you somehow don't want to split by spaces and apply escapeshellarg to each. And even then, there are non-working edge-cases awaiting to bite you, as shown in the comments. You have a good point, but escapeshellcmd or "let's change the SQL encoding" are things that you better avoid, security-wise. Best regards