Skip to content

Commit b62af1f

Browse files
shleeableYour Name
andauthored
Improvement: Add URL scheme check for http to SanitizeService. (#481)
* fix * fix --------- Co-authored-by: Your Name <you@example.com>
1 parent 1e2edea commit b62af1f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

app/Services/SanitizeService.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,16 @@ public function isLocalObject($url): bool
219219
return false;
220220
}
221221

222+
$parsed = parse_url($url);
223+
if (! $parsed || ! isset($parsed['scheme']) || $parsed['scheme'] !== 'https') {
224+
return false;
225+
}
226+
222227
$app = parse_url(config('app.url'));
223228
$appHost = strtolower(data_get($app, 'host'));
224-
$urlHost = parse_url($url, PHP_URL_HOST);
229+
$urlHost = strtolower(data_get($parsed, 'host'));
225230

226-
return $appHost === strtolower($urlHost);
231+
return $appHost === $urlHost;
227232
}
228233

229234
/**

0 commit comments

Comments
 (0)