note 85962 added to pdo.prepare
| From: | Anonymous at osu1 dot php dot net | Date: | Fri, 26 Sep 2008 10:25:13 +0000 |
| Subject: | note 85962 added to pdo.prepare | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144734@lists.php.net to get a copy of this message | ||
@ jacques at chester dot id dot au
If your table names are configurable (and came from a safe source, like your own config), you can
easily use string concatenation to put them in a query.
If the source is unknown / unsafe, it's usually a sign of terrible design flaws. in example if
you have N tables with the same set of fields, it would be much safer to make just two tables - mark
(containing list of names of what "used to be" old tables) and real data (with one more
column referencing key). Then, all operations on data can be performed using the db user unable to
delete all your data, and (the point this all started) you know names of both tables when preparing
statement, so no problem with PDO not converting/escaping it properly.
Only exception is when you're writing DB management system. Then, however, user is supported to
have access to everything db user has, so SQL Injection is a cese of no gain == no problem.
As far as I understand, those were main reason nobody even thought that serious developer will need
functioning table names sql injection prevention so near to db drivers.
----
Server IP: 217.13.201.10
Probable Submitter: 193.164.157.81
----
Manual Page -- http://www.php.net/manual/en/pdo.prepare.php
Edit -- https://master.php.net/note/edit/85962
Del: integrated -- https://master.php.net/note/delete/85962/integrated
Del: useless -- https://master.php.net/note/delete/85962/useless
Del: bad code -- https://master.php.net/note/delete/85962/bad+code
Del: spam -- https://master.php.net/note/delete/85962/spam
Del: non-english -- https://master.php.net/note/delete/85962/non-english
Del: in docs -- https://master.php.net/note/delete/85962/in+docs
Del: other reasons-- https://master.php.net/note/delete/85962
Reject -- https://master.php.net/note/reject/85962
Search -- https://master.php.net/manage/user-notes.php