From ce3e017fc48f50273a756b6b4b7185fa5f0305ee Mon Sep 17 00:00:00 2001 From: Ayush7614 Date: Sun, 6 Sep 2026 01:16:06 +0530 Subject: [PATCH] fix(worker): refuse a SERVER_INTERNAL_URL that is not a valid http(s) URL --- worker/src/env.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/worker/src/env.ts b/worker/src/env.ts index 4cce2f0b..8b091920 100644 --- a/worker/src/env.ts +++ b/worker/src/env.ts @@ -48,6 +48,16 @@ export function loadWorkerEnv( "SERVER_INTERNAL_URL is not set, so this worker does not know where to hand a routine run.", ); } + try { + const parsed = new URL(serverInternalUrl); + if (parsed.protocol !== "http:" && parsed.protocol !== "https:") { + throw new Error("not http(s)"); + } + } catch { + throw new Error( + "SERVER_INTERNAL_URL must be a valid http(s) URL, so this worker knows where to hand a routine run.", + ); + } const databaseUrl = environment.DATABASE_URL?.trim(); if (!databaseUrl) {