Skip to content

Commit

Permalink
Fixed #436 WSGIRequest has no attribute sensitive_post_parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmorell committed Sep 15, 2023
1 parent 9fe5f8e commit c22c482
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions rollbar/contrib/django/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,23 @@ def _should_ignore_404(url):
return any(p.search(url) for p in url_patterns)

def _apply_sensitive_post_params(request):
if request.sensitive_post_parameters:
mutable = request.POST._mutable
request.POST._mutable = True
for param in request.sensitive_post_parameters:
if param in request.POST:
request.POST[param] = "******"
request.POST._mutable = mutable
sensitive_post_parameters = getattr(
request, "sensitive_post_parameters", []
)
if not sensitive_post_parameters:
return
mutable = request.POST._mutable
request.POST._mutable = True

if sensitive_post_parameters == "__ALL__":
for param in request.POST:
request.POST[param] = "******"
return

for param in sensitive_post_parameters:
if param in request.POST:
request.POST[param] = "******"
request.POST._mutable = mutable

class RollbarNotifierMiddleware(MiddlewareMixin):
def __init__(self, get_response=None):
Expand Down

0 comments on commit c22c482

Please sign in to comment.