Skip to content

Commit

Permalink
Fix invalid referrer
Browse files Browse the repository at this point in the history
  • Loading branch information
zarulizham committed Feb 24, 2024
1 parent f74068f commit 08634a6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Http/Requests/AuthorizationConfirmation.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,17 @@ public function getHeader($key)

protected function verifyReferrer()
{
if (! in_array($this->headers->get('referer'), ["https://3dgatewaytest.ambankgroup.com/","https://3dgateway.ambankgroup.com/"])) {
$referrer = $this->headers->get('referer');

if (config('app.env') == 'production') {
$verified = str_starts_with($referrer, "https://3dgateway.ambankgroup.com/");
} else {
$verified = str_starts_with($referrer, "https://3dgatewaytest.ambankgroup.com/");
}

if (!$verified) {
throw new InvalidReferrer();
}
return true;
}
}

0 comments on commit 08634a6

Please sign in to comment.