webhooks: Move the extra logging information into a formatter.

This clears it out of the data sent to Sentry, where it is duplicative
with the indexed metadata -- and potentially exposes PHI if Sentry's
"make this issue public" feature is used.
This commit is contained in:
Alex Vandiver
2020-09-03 18:38:24 -07:00
committed by Tim Abbott
parent b8a2e6b5f8
commit 3f6e4ff303
6 changed files with 69 additions and 153 deletions

View File

@@ -32,19 +32,15 @@ fixture_to_headers = get_http_headers_from_filename("HTTP_X_GITHUB_EVENT")
class Helper:
def __init__(
self,
request: HttpRequest,
payload: Dict[str, Any],
include_title: bool,
) -> None:
self.payload = payload
self.include_title = include_title
self._request = request
def log_unsupported(self, event: str) -> None:
summary = f"The '{event}' event isn't currently supported by the GitHub webhook"
request = self._request
log_exception_to_webhook_logger(
request=request,
summary=summary,
unsupported_event=True,
)
@@ -630,7 +626,6 @@ def api_github_webhook(
body_function = EVENT_FUNCTION_MAPPER[event]
helper = Helper(
request=request,
payload=payload,
include_title=user_specified_topic is not None,
)