Topic: Security Issue
Just started to use FA and it's a breath of fresh air compared to using openERP for basic accounting functions. Sometimes, you just want to stick with the basics.
Well, I was looking to customize the customers page to display a paginated list of customers instead of the drop down list. I noticed some SQL code that I thought should be brought to you guys attention.
Look at customers line 221 (and several other places):
$sql = "SELECT * FROM ".TB_PREF."debtors_master WHERE debtor_no = '" . $_POST['customer_id'] . "'";
A big red flag is how data is being posted into the sql statement without being cleansed first. I know that these variables are posted with AJAX but with something as simple as Firebug (which allows you to change HTML in real time, i.e one could created their own form) one can easily post arbitrary code into these statements and even possibly wipe out an entire DB.
An easy fix would be to simply perform the db_escape function and set it equal to the post.
$_POST['customer_id'] = db_escape($_POST['customer_id']);
(might not work if this includes functions that require the connection to already be established.)
This will eliminate the need to change every instance in the entire script but either way this could be an unfortunate way to lose all your data.
This is just what I see on first glance, so if I'm wrong please correct me.
Thanks,
Yeshua