diff options
| author | Olivier Dony <odo@openerp.com> | 2010-10-13 12:57:13 +0200 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2010-10-13 12:57:13 +0200 |
| commit | cd5659e4a6053bfa39accdebacbbd3cb5cf7e436 (patch) | |
| tree | 21e148913b90693bf2ae49d2696eb3ebe9aeae78 /bin/netsvc.py | |
| parent | e96691da232792c32a090077eb345640d4a36d03 (diff) | |
[IMP] netsvc: remove plain password from logs, safer for forwarding for diagnostics/debugging
bzr revid: odo@openerp.com-20101013105713-y1m8baczvdjbab1c
Diffstat (limited to 'bin/netsvc.py')
| -rw-r--r-- | bin/netsvc.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/netsvc.py b/bin/netsvc.py index 54a8ac68b14..7cb7e73c9df 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -464,6 +464,14 @@ class OpenERPDispatcherException(Exception): self.exception = exception self.traceback = traceback +def replace_request_password(args): + # password is always 3rd argument in a request, we replace it in RPC logs + # so it's easier to forward logs for diagnostics/debugging purposes... + args = list(args) + if len(args) > 2: + args[2] = '*' + return args + class OpenERPDispatcher: def log(self, title, msg, channel=logging.DEBUG_RPC, depth=2): logger = logging.getLogger(title) @@ -476,7 +484,7 @@ class OpenERPDispatcher: logger = logging.getLogger('result') self.log('service', service_name) self.log('method', method) - self.log('params', params, depth=(logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) and 3 or 1)) + self.log('params', replace_request_password(params), depth=(logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) and 3 or 1)) auth = getattr(self, 'auth_provider', None) result = ExportService.getService(service_name).dispatch(method, auth, params) self.log('result', result, channel=logging.DEBUG_RPC_ANSWER, depth=(logger.isEnabledFor(logging.DEBUG_SQL) and 5 or 3)) |
