mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
Fix review findings validating OM-84
This commit is contained in:
1 parent
d6e5ef0b1f
commit
8f23959a01
2 files changed
+9
No files matched your search
@@ -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'] },
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in new issue
Block a user