Harden tenant admin auth and photo moderation
This commit is contained in:
@@ -100,13 +100,30 @@ class TenantAdminFacebookController extends Controller
|
||||
return null;
|
||||
}
|
||||
|
||||
if (str_starts_with($decoded, '//')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (str_starts_with($decoded, '/')) {
|
||||
return $decoded;
|
||||
}
|
||||
|
||||
$targetHost = parse_url($decoded, PHP_URL_HOST);
|
||||
$appHost = parse_url($request->getSchemeAndHttpHost(), PHP_URL_HOST);
|
||||
|
||||
if ($targetHost && $appHost && ! Str::endsWith($targetHost, $appHost)) {
|
||||
if (! $targetHost || ! $appHost || ! $this->isAllowedReturnHost($targetHost, $appHost)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $decoded;
|
||||
}
|
||||
|
||||
private function isAllowedReturnHost(string $targetHost, string $appHost): bool
|
||||
{
|
||||
if ($targetHost === $appHost) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return Str::endsWith($targetHost, '.'.$appHost);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user