comparison test/memorydb.py @ 4781:6e9b9743de89

Implementation for: http://issues.roundup-tracker.org/issue2550731 Add mechanism for the detectors to be able to tell the source of the data changes. Support for tx_Source property on database handle. Can be used by detectors to find out the source of a change in an auditor to block changes arriving by unauthenticated mechanisms (e.g. plain email where headers can be faked). The property db.tx_Source has the following values: * None - Default value set to None. May be valid if it's a script that is created by the user. Otherwise it's an error and indicates that some code path is not properly setting the tx_Source property. * "cli" - this string value is set when using roundup-admin and supplied scripts. * "web" - this string value is set when using any web based technique: html interface, xmlrpc .... * "email" - this string value is set when using an unauthenticated email based technique. * "email-sig-openpgp" - this string value is set when email with a valid pgp signature is used. (*NOTE* the testing for this mode is incomplete. If you have a pgp infrastructure you should test and verify that this is properly set.) This also includes some (possibly incomplete) tests cases for the modes above and an example of using ts_Source in the customization.txt document.
author John Rouillard <rouilj@ieee.org>
date Tue, 23 Apr 2013 23:06:09 -0400
parents 6e3e4f24c753
children dad18ee491a9
comparison
equal deleted inserted replaced
4774:3adff0fb0207 4781:6e9b9743de89
47 for fn in os.listdir(dirname): 47 for fn in os.listdir(dirname):
48 if not fn.endswith('.py'): continue 48 if not fn.endswith('.py'): continue
49 vars = {} 49 vars = {}
50 execfile(os.path.join(dirname, fn), vars) 50 execfile(os.path.join(dirname, fn), vars)
51 vars['init'](db) 51 vars['init'](db)
52
53 vars = {}
54 execfile("test/tx_Source_detector.py", vars)
55 vars['init'](db)
52 56
53 ''' 57 '''
54 status = Class(db, "status", name=String()) 58 status = Class(db, "status", name=String())
55 status.setkey("name") 59 status.setkey("name")
56 priority = Class(db, "priority", name=String(), order=String()) 60 priority = Class(db, "priority", name=String(), order=String())
192 self.cache = {} # cache of nodes loaded or created 196 self.cache = {} # cache of nodes loaded or created
193 self.dirtynodes = {} # keep track of the dirty nodes by class 197 self.dirtynodes = {} # keep track of the dirty nodes by class
194 self.newnodes = {} # keep track of the new nodes by class 198 self.newnodes = {} # keep track of the new nodes by class
195 self.destroyednodes = {}# keep track of the destroyed nodes by class 199 self.destroyednodes = {}# keep track of the destroyed nodes by class
196 self.transactions = [] 200 self.transactions = []
201 self.tx_Source = None
197 202
198 def filename(self, classname, nodeid, property=None, create=0): 203 def filename(self, classname, nodeid, property=None, create=0):
199 shutil.copyfile(__file__, __file__+'.dummy') 204 shutil.copyfile(__file__, __file__+'.dummy')
200 return __file__+'.dummy' 205 return __file__+'.dummy'
201 206

Roundup Issue Tracker: http://roundup-tracker.org/