mirror of
https://github.com/openai/codex.git
synced 2026-09-13 11:47:17 +00:00
Restrict login setup redirects to known platform origins (#44670)
## Why The login success pages use `platform_url` from the query string to build an organization setup redirect that includes the ID token. An arbitrary destination could receive that token. ## What changed Require `platform_url` to exactly match `https://platform.openai.com` or `https://platform.api.openai.org` before showing the setup prompt or starting the redirect countdown. Apply the check to both the current and legacy login success pages. GitOrigin-RevId: 37a08482c23b82483fd519f943a0b4eb6caaa161
This commit is contained in:
@@ -209,6 +209,13 @@
|
||||
}
|
||||
|
||||
if (needsSetup) {
|
||||
// The login server selects one of these platform origins from the OAuth issuer.
|
||||
if (
|
||||
platformUrl !== "https://platform.openai.com" &&
|
||||
platformUrl !== "https://platform.api.openai.org"
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const setupBox = document.getElementById("setup-box");
|
||||
const countdownNode = document.getElementById("countdown");
|
||||
setupBox.style.display = "block";
|
||||
|
||||
@@ -166,6 +166,13 @@
|
||||
const idToken = params.get('id_token');
|
||||
// Show different message and optional redirect when setup is required
|
||||
if (needsSetup) {
|
||||
// The login server selects one of these platform origins from the OAuth issuer.
|
||||
if (
|
||||
platformUrl !== 'https://platform.openai.com' &&
|
||||
platformUrl !== 'https://platform.api.openai.org'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const setupBox = document.querySelector('.setup-box');
|
||||
setupBox.style.display = 'flex';
|
||||
const redirectUrlObj = new URL('/org-setup', platformUrl);
|
||||
|
||||
Reference in New Issue
Block a user