Don't pollute WSGI environ with OS environ

This commit is contained in:
Unrud 2018-08-16 07:59:59 +02:00
parent e5e13faa7c
commit 6f15cddfbc
3 changed files with 2 additions and 12 deletions

3
config
View File

@ -128,9 +128,6 @@
# Set the logging level to debug # Set the logging level to debug
#debug = False #debug = False
# Store all environment variables (including those set in the shell)
#full_environment = False
# Don't include passwords in logs # Don't include passwords in logs
#mask_passwords = True #mask_passwords = True

View File

@ -206,6 +206,8 @@ class ThreadedHTTPSServer(socketserver.ThreadingMixIn, HTTPSServer):
class ServerHandler(wsgiref.simple_server.ServerHandler): class ServerHandler(wsgiref.simple_server.ServerHandler):
# Don't pollute WSGI environ with OS environment
os_environ = {}
def log_exception(self, exc_info): def log_exception(self, exc_info):
logger.error("An exception occurred during request: %s", logger.error("An exception occurred during request: %s",
@ -269,11 +271,6 @@ class Application:
"""Sanitize headers for logging.""" """Sanitize headers for logging."""
request_environ = dict(environ) request_environ = dict(environ)
# Remove environment variables
if not self.configuration.getboolean("logging", "full_environment"):
for shell_variable in os.environ:
request_environ.pop(shell_variable, None)
# Mask passwords # Mask passwords
mask_passwords = self.configuration.getboolean( mask_passwords = self.configuration.getboolean(
"logging", "mask_passwords") "logging", "mask_passwords")

View File

@ -178,10 +178,6 @@ INITIAL_CONFIG = OrderedDict([
"help": "print debug information", "help": "print debug information",
"aliases": ["-D", "--debug"], "aliases": ["-D", "--debug"],
"type": bool}), "type": bool}),
("full_environment", {
"value": "False",
"help": "store all environment variables",
"type": bool}),
("mask_passwords", { ("mask_passwords", {
"value": "True", "value": "True",
"help": "mask passwords in logs", "help": "mask passwords in logs",