Skip to content

Commit

Permalink
update whitelist config
Browse files Browse the repository at this point in the history
  • Loading branch information
CreatedByBdr committed Oct 26, 2023
1 parent 1488739 commit f50ff6b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
10 changes: 4 additions & 6 deletions workspaces/netlify-cms-auth/src/callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export async function callback(
postMessageHTML({
status: "success",
data: { token, provider },
env,
}),
{
headers: {
Expand All @@ -38,7 +37,6 @@ export async function callback(
postMessageHTML({
status: "error",
data: e,
env,
}),
{
headers: {
Expand All @@ -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 `
<!DOCTYPE html>
<html>
Expand All @@ -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;
Expand Down
1 change: 0 additions & 1 deletion workspaces/netlify-cms-auth/src/env.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export interface Env {
OAUTH_GITHUB_CLIENT_ID: string;
OAUTH_GITHUB_CLIENT_SECRET: string;
CMS_URL: string;
}

0 comments on commit f50ff6b

Please sign in to comment.