Merge pull request #457 from tipabu/secure-logging

Secure logging by default
This commit is contained in:
Peter Hamilton 2018-10-10 08:51:07 -04:00 committed by GitHub
commit 1365047dcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -47,6 +47,10 @@ class ConfigHelper(object):
def __init__(self, path=None):
self.logger = logging.getLogger(__name__)
# DEBUG logging here may expose passwords, so log at INFO by default.
# However, if consumers know the risks, let them go ahead and override.
if self.logger.level == logging.NOTSET:
self.logger.setLevel(logging.INFO)
self.conf = SafeConfigParser()

View File

@ -27,6 +27,10 @@ class KMIPProtocol(object):
def __init__(self, socket, buffer_size=1024):
self.socket = socket
self.logger = logging.getLogger(__name__)
# DEBUG logging here may expose secrets, so log at INFO by default.
# However, if consumers know the risks, let them go ahead and override.
if self.logger.level == logging.NOTSET:
self.logger.setLevel(logging.INFO)
def write(self, data):
if len(data) > 0: