fix(mcp): validate OAuth base origin
This commit is contained in:
1 parent
3ea74f12d2
commit
bb08a6d03b
3 files changed
+29
-2
No files matched your search
@@ -1,9 +1,14 @@
|
||||
import { createBooleanSchema, createEnv } from "@homarr/core/infrastructure/env";
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const baseUrlSchema = z.url({ protocol: /^https?$/ }).refine((value) => {
|
||||
const url = new URL(value);
|
||||
return !url.username && !url.password && url.pathname === "/" && !url.search && !url.hash;
|
||||
}, "BASE_URL must be an HTTP(S) origin without credentials, a path, query parameters, or a fragment");
|
||||
|
||||
export const env = createEnv({
|
||||
server: {
|
||||
BASE_URL: z.string().url().optional(),
|
||||
BASE_URL: baseUrlSchema.optional(),
|
||||
UNSAFE_ENABLE_MOCK_INTEGRATION: createBooleanSchema(false),
|
||||
DEMO_MODE: createBooleanSchema(false),
|
||||
DEMO_READ_ONLY: createBooleanSchema(true),
|
||||
|
||||
Reference in new issue
Block a user