From 18d94c7564fd7562118d51cd0cd8dc831ef4e8f5 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Thu, 17 Oct 2024 19:33:49 +0800 Subject: [PATCH] fix webhook logging with numeric check --- src/Listeners/LogFailedWebhook.php | 4 ++-- src/Listeners/LogFinalWebhookAttempt.php | 4 ++-- src/Listeners/LogSuccessfulWebhook.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Listeners/LogFailedWebhook.php b/src/Listeners/LogFailedWebhook.php index b165826..c8cb5a0 100644 --- a/src/Listeners/LogFailedWebhook.php +++ b/src/Listeners/LogFailedWebhook.php @@ -57,8 +57,8 @@ public function handle(WebhookCallFailedEvent $event) } // Check if it was a personal access token which made the request - if ($accessTokenId && PersonalAccessToken::where('id', $accessTokenId)->exists()) { - $data['access_token_id'] = $accessTokenId; + if ($accessTokenId && is_numeric($accessTokenId) && PersonalAccessToken::where('id', $accessTokenId)->exists()) { + $data['access_token_id'] = (int) $accessTokenId; } // Log webhook callback event diff --git a/src/Listeners/LogFinalWebhookAttempt.php b/src/Listeners/LogFinalWebhookAttempt.php index 3ac6965..643c7b1 100644 --- a/src/Listeners/LogFinalWebhookAttempt.php +++ b/src/Listeners/LogFinalWebhookAttempt.php @@ -59,8 +59,8 @@ public function handle(FinalWebhookCallFailedEvent $event) } // Check if it was a personal access token which made the request - if ($accessTokenId && PersonalAccessToken::where('id', $accessTokenId)->exists()) { - $data['access_token_id'] = $accessTokenId; + if ($accessTokenId && is_numeric($accessTokenId) && PersonalAccessToken::where('id', $accessTokenId)->exists()) { + $data['access_token_id'] = (int) $accessTokenId; } // log webhook event diff --git a/src/Listeners/LogSuccessfulWebhook.php b/src/Listeners/LogSuccessfulWebhook.php index 67406d7..fc57d66 100644 --- a/src/Listeners/LogSuccessfulWebhook.php +++ b/src/Listeners/LogSuccessfulWebhook.php @@ -57,8 +57,8 @@ public function handle(WebhookCallSucceededEvent $event) } // Check if it was a personal access token which made the request - if ($accessTokenId && PersonalAccessToken::where('id', $accessTokenId)->exists()) { - $data['access_token_id'] = $accessTokenId; + if ($accessTokenId && is_numeric($accessTokenId) && PersonalAccessToken::where('id', $accessTokenId)->exists()) { + $data['access_token_id'] = (int) $accessTokenId; } // Log webhook callback event