diff options
author | anti.veeranna | 2011-12-06 08:17:40 +0000 |
---|---|---|
committer | anti.veeranna | 2011-12-06 08:17:40 +0000 |
commit | 1b77c60b0a7cc85db26f28addd0f9459520936b3 (patch) | |
tree | 71e5384874849cabdcccf3e8a814bcc19ee6d0c0 /python/skytools/scripting.py | |
parent | 245b5a79e88681529631edcc7f7e5b1cacfe1d04 (diff) |
filter potential passwords in connstr before logging it
Diffstat (limited to 'python/skytools/scripting.py')
-rw-r--r-- | python/skytools/scripting.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/python/skytools/scripting.py b/python/skytools/scripting.py index b0badda9..8bce30fe 100644 --- a/python/skytools/scripting.py +++ b/python/skytools/scripting.py @@ -3,7 +3,7 @@ """ -import sys, os, signal, optparse, time, errno, select +import sys, os, signal, optparse, time, errno, select, re import logging, logging.handlers, logging.config import skytools @@ -712,7 +712,9 @@ class DBScript(BaseScript): else: if not connstr: connstr = self.cf.get(dbname) - self.log.debug("Connect '%s' to '%s'" % (cache, connstr)) + # connstr might contain password, it is not a good idea to log it + filtered_connstr = re.sub(' password=\S+', ' password=***HIDDEN***', connstr) + self.log.debug("Connect '%s' to '%s'" % (cache, filtered_connstr)) dbc = DBCachedConn(cache, connstr, params['max_age'], setup_func = self.connection_hook) self.db_cache[cache] = dbc |