We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4571299 commit 322dc4eCopy full SHA for 322dc4e
apps/sim/app/api/knowledge/route.ts
@@ -55,10 +55,15 @@ const CreateKnowledgeBaseSchema = z.object({
55
if (hostname === '169.254.169.254' || hostname === 'metadata.google.internal') {
56
return false
57
}
58
+ // Block IPv6 addresses (except loopback) — prevents IPv6-mapped IPv4 bypass
59
+ // URL.hostname keeps brackets for IPv6, e.g. "[::ffff:169.254.169.254]"
60
+ if (hostname.startsWith('[') && hostname !== '[::1]') {
61
+ return false
62
+ }
63
// Allow localhost, loopback, and private network ranges
64
if (
65
hostname === 'localhost' ||
- hostname === '::1' ||
66
+ hostname === '[::1]' ||
67
hostname.startsWith('127.') ||
68
hostname.startsWith('10.') ||
69
hostname.startsWith('192.168.')
0 commit comments