8000 fix: PII bugs in _wsgi, ignore django.server logger · etherscan-io/sentry-python@067ea92 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 067ea92

Browse files
committed
fix: PII bugs in _wsgi, ignore django.server logger
1 parent 0e3d0ec commit 067ea92

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

sentry_sdk/integrations/_wsgi.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ def get_environ(environ):
1414
"""
1515
Returns our whitelisted environment variables.
1616
"""
17-
for key in ("REMOTE_ADDR", "SERVER_NAME", "SERVER_PORT"):
17+
keys = ("SERVER_NAME", "SERVER_PORT")
18+
if _should_send_default_pii():
19+
keys += ("REMOTE_ADDR",)
20+
21+
for key in keys:
1822
if key in environ:
1923
yield key, environ[key]
2024

sentry_sdk/integrations/django/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ def setup_once():
6060
install_sql_hook()
6161
# Patch in our custom middleware.
6262

63+
# logs an error for every 500
64+
ignore_logger("django.server")
65+
6366
from django.core.handlers.wsgi import WSGIHandler
6467

6568
old_app = WSGIHandler.__call__

0 commit comments

Comments
 (0)
0