From 8f23959a011ab5c1da098ae9331ff09bbfffac15 Mon Sep 17 00:00:00 2001 From: Forge Sandbox Date: Fri, 4 Dec 2026 01:51:27 +0000 Subject: [PATCH] Fix review findings validating OM-84 --- backend/test/routes/secrets.test.ts | 2 ++ shared/src/schemas/secrets.ts | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/backend/test/routes/secrets.test.ts b/backend/test/routes/secrets.test.ts index 08193291..dbbf706d 100644 --- a/backend/test/routes/secrets.test.ts +++ b/backend/test/routes/secrets.test.ts @@ -186,6 +186,8 @@ describe('secret routes', () => { const bodies = [ { value: 'v', agentHidden: true }, { value: 'v', agentHidden: true, allowedHosts: ['*'] }, + { value: 'v', agentHidden: true, allowedHosts: ['*.com'] }, + { value: 'v', agentHidden: true, allowedHosts: ['*.io'] }, { value: 'v', agentHidden: true, allowedHosts: ['https://example.com'] }, { value: 'v', agentHidden: true, allowedHosts: ['example.com:443'] }, { value: 'v', agentHidden: true, allowedHosts: ['example.com/path'] }, diff --git a/shared/src/schemas/secrets.ts b/shared/src/schemas/secrets.ts index c94c5f40..baaa7adb 100644 --- a/shared/src/schemas/secrets.ts +++ b/shared/src/schemas/secrets.ts @@ -83,6 +83,13 @@ export const SecretAllowedHostSchema = z code: 'custom', message: 'Host must be a hostname or a *.wildcard hostname without a scheme, port, path, or IP address', }) + return + } + if (host.startsWith('*.') && !host.slice(2).includes('.')) { + ctx.addIssue({ + code: 'custom', + message: 'Wildcard hosts must cover a domain with at least two labels, such as *.example.com', + }) } }) .transform((host) => host.toLowerCase())