Skip to content

Commit

Permalink
fix webhook logging with numeric check
Browse files Browse the repository at this point in the history
  • Loading branch information
roncodes committed Oct 17, 2024
1 parent 320522a commit 18d94c7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Listeners/LogFailedWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Listeners/LogFinalWebhookAttempt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Listeners/LogSuccessfulWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 18d94c7

Please sign in to comment.