From f50ff6be399a0b655b71df42ebc75b5b89267400 Mon Sep 17 00:00:00 2001 From: bgharbi Date: Thu, 26 Oct 2023 17:21:59 +0200 Subject: [PATCH] update whitelist config --- workspaces/netlify-cms-auth/src/callback.ts | 10 ++++------ workspaces/netlify-cms-auth/src/env.ts | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/workspaces/netlify-cms-auth/src/callback.ts b/workspaces/netlify-cms-auth/src/callback.ts index c2c2b51e87..8772812dbb 100644 --- a/workspaces/netlify-cms-auth/src/callback.ts +++ b/workspaces/netlify-cms-auth/src/callback.ts @@ -25,7 +25,6 @@ export async function callback( postMessageHTML({ status: "success", data: { token, provider }, - env, }), { headers: { @@ -38,7 +37,6 @@ export async function callback( postMessageHTML({ status: "error", data: e, - env, }), { headers: { @@ -52,10 +50,9 @@ export async function callback( interface PostMessageHTMLArgs { status: "success" | "error"; data: any; - env: Env; } -function postMessageHTML({ status, data, env }: PostMessageHTMLArgs) { +function postMessageHTML({ status, data }: PostMessageHTMLArgs) { return ` @@ -65,8 +62,9 @@ function postMessageHTML({ status, data, env }: PostMessageHTMLArgs) { const allowedOrigin = ( message.origin === 'http://localhost:1234' || message.origin === 'http://127.0.0.1:1234' || - /^https:\\/\\/[-_\\w]+\\.starknet-netlify-cms\\.pages\\.dev$/.test(message.origin) || - message.origin === '${env.CMS_URL}' + message.origin === 'https://starknet-netlify-cms-byd.pages.dev' || + /^https:\\/\\/[-_\\w]+\\.starknet-netlify-cms-byd\\.pages\\.dev$/.test(message.origin) || + /^https:\\/\\/[-_\\w]+\\.starknet-netlify-cms\\.pages\\.dev$/.test(message.origin) ); if (!allowedOrigin) return; diff --git a/workspaces/netlify-cms-auth/src/env.ts b/workspaces/netlify-cms-auth/src/env.ts index 1642beadb7..adf3325a1b 100644 --- a/workspaces/netlify-cms-auth/src/env.ts +++ b/workspaces/netlify-cms-auth/src/env.ts @@ -1,5 +1,4 @@ export interface Env { OAUTH_GITHUB_CLIENT_ID: string; OAUTH_GITHUB_CLIENT_SECRET: string; - CMS_URL: string; }