3 ms·
The sql executes they are using build queries with "%s" instead of using ? parameters. I guess they foresee that those scripts only see friendly data but it's b
by pmontra 10y ago
The sql executes they are using build queries with "%s" instead of using ? parameters. I guess they foresee that those scripts only see friendly data but it's better to be safe than sorry and protect against sql injection from day 1.
Example https://github.com/dropbox/securitybot/blob/master/plugins/splunk/apps/securitybot_alerts/bin/bot_lookup.py https://github.com/dropbox/securitybot/blob/master/plugins/s...
- lwf 10y agoI work on the security engineering team at Dropbox, and help manage our open source programmes. Note that we aren't doing ``.format()`` or ``%``, but passing the fill text as the second parameter to ``.execute()`` — this is the correct way to protect against SQLi using MySQLdb. I actually mistakenly thought this was SQLi when I was reviewing this code for release. Unfortunately, the MySQLdb documentation doesn't make that obvious. See http://stackoverflow.com/a/7929438 http://stackoverflow.com/a/7929438