2024-07-12 02:30:23 +02:00
|
|
|
from typing import Any
|
2016-06-05 07:51:18 +02:00
|
|
|
|
2017-01-29 23:04:06 +01:00
|
|
|
from django.http import HttpRequest
|
2017-11-16 00:50:28 +01:00
|
|
|
from django.views.debug import SafeExceptionReporterFilter
|
2023-10-12 19:43:45 +02:00
|
|
|
from typing_extensions import override
|
2012-12-07 23:00:13 +01:00
|
|
|
|
2020-06-11 00:54:34 +02:00
|
|
|
|
2013-08-06 21:38:05 +02:00
|
|
|
class ZulipExceptionReporterFilter(SafeExceptionReporterFilter):
|
2023-10-12 19:43:45 +02:00
|
|
|
@override
|
2024-07-12 02:30:23 +02:00
|
|
|
def get_post_parameters(self, request: HttpRequest | None) -> dict[str, Any]:
|
2021-08-18 17:54:22 +02:00
|
|
|
post_data = SafeExceptionReporterFilter.get_post_parameters(self, request)
|
|
|
|
assert isinstance(post_data, dict)
|
|
|
|
filtered_post = post_data.copy()
|
2021-02-12 08:19:30 +01:00
|
|
|
filtered_vars = [
|
2021-02-12 08:20:45 +01:00
|
|
|
"content",
|
|
|
|
"secret",
|
|
|
|
"password",
|
|
|
|
"key",
|
|
|
|
"api-key",
|
|
|
|
"subject",
|
|
|
|
"stream",
|
|
|
|
"subscriptions",
|
|
|
|
"to",
|
|
|
|
"csrfmiddlewaretoken",
|
|
|
|
"api_key",
|
|
|
|
"realm_counts",
|
|
|
|
"installation_counts",
|
2021-02-12 08:19:30 +01:00
|
|
|
]
|
2012-12-19 08:20:49 +01:00
|
|
|
|
|
|
|
for var in filtered_vars:
|
|
|
|
if var in filtered_post:
|
2021-02-12 08:20:45 +01:00
|
|
|
filtered_post[var] = "**********"
|
2012-12-07 23:00:13 +01:00
|
|
|
return filtered_post
|