Re:Show HN: Lychee — Self-hosted photo-management done right
by electerious on Wednesday January 22, 2014 @07:27AM
(#7102170)
All calls to the API are going through the api.php where every $_POST gets escaped. I'm not an expert when it comes to SQL injection, but I think this should prevent it. See line 61 in php/api.php. It would be great to know if this actually helps or not.
[ Parent
| on HN ]
Re:Show HN: Lychee — Self-hosted photo-management done right
by roeme on Wednesday January 22, 2014 @08:32AM
(#7102416)
Having read your code and quickly brushing up the little bits of PHP knowledge from years ago, I'd say it helps only a little. mysqli_real_escape_string alone doesn't protect you completely from sql injection attacks, it just makes it harder - see the second answer at http://stackoverflow.com/questions/5741187/sql-injection-tha... for an example. Also, the homegrown $albumID validation allows bad payload to reach mysqli_real_escape_string().
Re:Show HN: Lychee — Self-hosted photo-management done right
by electerious on Wednesday January 22, 2014 @10:07AM
(#7102898)
Thanks! Good to know.
Re:Show HN: Lychee — Self-hosted photo-management done right
by stefs on Wednesday January 22, 2014 @07:33AM
(#7102192)
i haven't looked at the code, but you really should switch to prepared statements. they make your code cleaner and more secure (and maybe faster, but that's pretty negligible in this case). have a look at PDO.
Re:Show HN: Lychee — Self-hosted photo-management done right
by electerious on Wednesday January 22, 2014 @08:26AM
(#7102400)
I will. Thanks for the notice!