[FIX] avoid sql injection in sequences
authorChristophe Simonis <chs@tinyerp.com>
Wed, 3 Feb 2010 18:32:55 +0000 (19:32 +0100)
committerChristophe Simonis <chs@tinyerp.com>
Wed, 3 Feb 2010 18:32:55 +0000 (19:32 +0100)
lp bug: https://launchpad.net/bugs/512682 fixed

bzr revid: chs@tinyerp.com-20100203183255-21lh44tfloc01wqw

addons/account/sequence.py

index 02af766..8b38fe1 100644 (file)
@@ -44,6 +44,8 @@ class ir_sequence(osv.osv):
         'fiscal_ids' : fields.one2many('account.sequence.fiscalyear', 'sequence_main_id', 'Sequences')
     }
     def get_id(self, cr, uid, sequence_id, test='id=%s', context={}):
+        if test not in ('id=%s', 'code=%s'):
+            raise ValueError('invalid test')
         cr.execute('select id from ir_sequence where '+test+' and active=%s', (sequence_id, True,))
         res = cr.dictfetchone()
         if res: