fix(console): allow redirects to the console host when _APP_CONSOLE_URL is set

The default OAuth2 success and failure URLs are built on the console URL,
and the callback validates them against the allowed hostnames. A console
served on its own host was missing from that list, so the default redirects
were rejected.
This commit is contained in:
harsh mahajan committed 2026-09-15 13:12:03 +05:30
1 parent 9800cc1ae8
commit 87e0f9c6a2
1 file changed
+6
+6
View File
@@ -251,6 +251,12 @@ return function (Container $context): void {
$context->set('allowedHostnames', function (array $platform, Document $project, Document $rule, Document $devKey, Request $request) {
$allowed = [...($platform['hostnames'] ?? [])];
/* Add the console host, the default OAuth2 redirects land on it even when _APP_CONSOLE_URL points elsewhere */
$consoleHostname = \parse_url($platform['consoleUrl'] ?? '', PHP_URL_HOST);
if (! empty($consoleHostname)) {
$allowed[] = $consoleHostname;
}
/* Add platform configured hostnames */
if (! $project->isEmpty() && $project->getId() !== 'console') {
$platforms = $project->getAttribute('platforms', []);