Improve robustness of sender_id extraction in Bitbucket app server by using safe dictionary access

This commit is contained in:
mrT23
2024-11-14 08:26:04 +02:00
parent 2c3aa7b2dc
commit fe27f96bf1

View File

@ -175,7 +175,7 @@ async def handle_github_webhooks(background_tasks: BackgroundTasks, request: Req
username = actor["nickname"] username = actor["nickname"]
log_context["sender"] = username log_context["sender"] = username
sender_id = data["data"]["actor"]["account_id"] sender_id = data.get("data", {}).get("actor", {}).get("account_id", "")
log_context["sender_id"] = sender_id log_context["sender_id"] = sender_id
jwt_parts = input_jwt.split(".") jwt_parts = input_jwt.split(".")
claim_part = jwt_parts[1] claim_part = jwt_parts[1]