[FIX] base: ir_config_parameter increase database.uuid.private entropy

Use uuid4 instead of uuid1 to get 128 bits of entropy.

Rename database.uuid.private to the more meaningful database.secret as it
explains the usage instead of the technical details to generate it. And we
might switch to a longer string with more entropy in the future.

This string can be used to sign cookies or token with
sign(src) -> (src, hash(src + secret))
check(msg) -> msg[1] == hash(msg[0] + secret)
This commit is contained in:
Antony Lesuisse
2015-01-28 00:32:51 +01:00
parent 53dcf1b9de
commit 75fa30fc54
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ class Lead(models.Model):
return None
def get_key(self):
return self.pool['ir.config_parameter'].get_param(request.cr, SUPERUSER_ID, 'database.uuid.private')
return self.pool['ir.config_parameter'].get_param(request.cr, SUPERUSER_ID, 'database.secret')
def get_score_domain_cookies(self):
return request.httprequest.host
@@ -33,7 +33,7 @@ from openerp.tools import misc, config
A dictionary holding some configuration parameters to be initialized when the database is created.
"""
_default_parameters = {
"database.uuid.private": lambda: (str(uuid.uuid1()), ['base.group_erp_manager']),
"database.secret": lambda: (str(uuid.uuid1()), ['base.group_erp_manager']),
"database.uuid": lambda: (str(uuid.uuid1()), []),
"database.create_date": lambda: (datetime.datetime.now().strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT), ['base.group_user']),
"web.base.url": lambda: ("http://localhost:%s" % config.get('xmlrpc_port'), []),