From f400dafe16b92d83fba562c4724ac382814414cd Mon Sep 17 00:00:00 2001 From: Nadeesha Cabral Date: Sun, 29 Dec 2024 19:28:54 +1100 Subject: [PATCH] fix: Expand CORS bypass with additional regex pattern --- control-plane/src/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/control-plane/src/index.ts b/control-plane/src/index.ts index 92a76586..5c7ed31e 100644 --- a/control-plane/src/index.ts +++ b/control-plane/src/index.ts @@ -35,7 +35,10 @@ app.register(initServer().plugin(router.router), parent => { const allowedOrigins = [env.APP_ORIGIN]; -const corsBypassRegex = new RegExp(/\/clusters\/.*\/runs/); +const corsBypassRegexes = [ + new RegExp(/\/clusters\/.*\/runs/), + new RegExp(/\/workflows\/.*\/calls/), +]; app.register(cors, { delegator: (req, callback) => { @@ -46,7 +49,7 @@ app.register(cors, { return; } - if (corsBypassRegex.test(req.url ?? "")) { + if (corsBypassRegexes.some(regex => regex.test(req.url ?? ""))) { callback(null, { origin: true, });