From 0d2414d7ece7eaf2b41ed1292e061c54d21bdf99 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Thu, 13 Sep 2012 06:55:58 -0500 Subject: [PATCH] masking passwords in toolbar, thanks Bruno --- VERSION | 2 +- gluon/globals.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index 89ed2b8f..e6967136 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.0.8 (2012-09-12 22:53:52) stable +Version 2.0.8 (2012-09-13 06:55:52) stable diff --git a/gluon/globals.py b/gluon/globals.py index 66051be3..ccaab79f 100644 --- a/gluon/globals.py +++ b/gluon/globals.py @@ -51,6 +51,7 @@ except ImportError: have_minify = False regex_session_id = re.compile('^([\w\-]+/)?[\w\-\.]+$') +regex_nopasswd = re.compile('(?<=\:)([^:@/]+)(?=@.+)') __all__ = ['Request', 'Response', 'Session'] @@ -410,11 +411,13 @@ class Response(Storage): dbstats = [TABLE(*[TR(PRE(row[0]),'%.2fms' % (row[1]*1000)) \ for row in i.db._timings]) \ for i in thread.instances] - dbtables = dict([(i.uri, {'defined': sorted(list(set(i.db.tables) - - set(i.db._LAZY_TABLES.keys()))) or - '[no defined tables]', - 'lazy': sorted(i.db._LAZY_TABLES.keys()) or - '[no lazy tables]'}) + dbtables = dict([(regex_nopasswd.sub('******',i.uri), + {'defined': + sorted(list(set(i.db.tables) - + set(i.db._LAZY_TABLES.keys()))) or + '[no defined tables]', + 'lazy': sorted(i.db._LAZY_TABLES.keys()) or + '[no lazy tables]'}) for i in thread.instances]) else: dbstats = [] # if no db or on GAE