mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-11 17:32:35 +03:00
Compare commits
1 Commits
fix/12251-
...
fix/12569-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6cc3e57c6 |
212
@omniroute/opencode-plugin-v2/package-lock.json
generated
212
@omniroute/opencode-plugin-v2/package-lock.json
generated
@@ -22,7 +22,7 @@
|
||||
"node": ">=22.22.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opencode-ai/plugin": ">=1.18.29 <2"
|
||||
"@opencode-ai/plugin": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@ai-sdk/provider": {
|
||||
@@ -39,9 +39,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/aix-ppc64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz",
|
||||
"integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz",
|
||||
"integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
@@ -56,9 +56,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz",
|
||||
"integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz",
|
||||
"integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@@ -73,9 +73,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz",
|
||||
"integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -90,9 +90,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-x64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz",
|
||||
"integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz",
|
||||
"integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -107,9 +107,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-arm64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz",
|
||||
"integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -124,9 +124,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-x64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz",
|
||||
"integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz",
|
||||
"integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -141,9 +141,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-arm64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz",
|
||||
"integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -158,9 +158,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-x64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz",
|
||||
"integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz",
|
||||
"integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -175,9 +175,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz",
|
||||
"integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz",
|
||||
"integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@@ -192,9 +192,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz",
|
||||
"integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -209,9 +209,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ia32": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz",
|
||||
"integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz",
|
||||
"integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
@@ -226,9 +226,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-loong64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz",
|
||||
"integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz",
|
||||
"integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==",
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
@@ -243,9 +243,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-mips64el": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz",
|
||||
"integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz",
|
||||
"integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==",
|
||||
"cpu": [
|
||||
"mips64el"
|
||||
],
|
||||
@@ -260,9 +260,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ppc64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz",
|
||||
"integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz",
|
||||
"integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
@@ -277,9 +277,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-riscv64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz",
|
||||
"integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz",
|
||||
"integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
@@ -294,9 +294,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-s390x": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz",
|
||||
"integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz",
|
||||
"integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
@@ -311,9 +311,7 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-x64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz",
|
||||
"integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==",
|
||||
"version": "0.28.1",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -328,9 +326,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-arm64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz",
|
||||
"integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -345,9 +343,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-x64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz",
|
||||
"integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz",
|
||||
"integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -362,9 +360,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-arm64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz",
|
||||
"integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -379,9 +377,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-x64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz",
|
||||
"integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz",
|
||||
"integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -396,9 +394,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openharmony-arm64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz",
|
||||
"integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -413,9 +411,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/sunos-x64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz",
|
||||
"integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz",
|
||||
"integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -430,9 +428,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-arm64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz",
|
||||
"integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz",
|
||||
"integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -447,9 +445,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-ia32": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz",
|
||||
"integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz",
|
||||
"integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
@@ -464,9 +462,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-x64": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz",
|
||||
"integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==",
|
||||
"version": "0.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz",
|
||||
"integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1182,9 +1180,7 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.28.2",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz",
|
||||
"integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==",
|
||||
"version": "0.28.1",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
@@ -1195,32 +1191,32 @@
|
||||
"node": ">=18"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/aix-ppc64": "0.28.2",
|
||||
"@esbuild/android-arm": "0.28.2",
|
||||
"@esbuild/android-arm64": "0.28.2",
|
||||
"@esbuild/android-x64": "0.28.2",
|
||||
"@esbuild/darwin-arm64": "0.28.2",
|
||||
"@esbuild/darwin-x64": "0.28.2",
|
||||
"@esbuild/freebsd-arm64": "0.28.2",
|
||||
"@esbuild/freebsd-x64": "0.28.2",
|
||||
"@esbuild/linux-arm": "0.28.2",
|
||||
"@esbuild/linux-arm64": "0.28.2",
|
||||
"@esbuild/linux-ia32": "0.28.2",
|
||||
"@esbuild/linux-loong64": "0.28.2",
|
||||
"@esbuild/linux-mips64el": "0.28.2",
|
||||
"@esbuild/linux-ppc64": "0.28.2",
|
||||
"@esbuild/linux-riscv64": "0.28.2",
|
||||
"@esbuild/linux-s390x": "0.28.2",
|
||||
"@esbuild/linux-x64": "0.28.2",
|
||||
"@esbuild/netbsd-arm64": "0.28.2",
|
||||
"@esbuild/netbsd-x64": "0.28.2",
|
||||
"@esbuild/openbsd-arm64": "0.28.2",
|
||||
"@esbuild/openbsd-x64": "0.28.2",
|
||||
"@esbuild/openharmony-arm64": "0.28.2",
|
||||
"@esbuild/sunos-x64": "0.28.2",
|
||||
"@esbuild/win32-arm64": "0.28.2",
|
||||
"@esbuild/win32-ia32": "0.28.2",
|
||||
"@esbuild/win32-x64": "0.28.2"
|
||||
"@esbuild/aix-ppc64": "0.28.1",
|
||||
"@esbuild/android-arm": "0.28.1",
|
||||
"@esbuild/android-arm64": "0.28.1",
|
||||
"@esbuild/android-x64": "0.28.1",
|
||||
"@esbuild/darwin-arm64": "0.28.1",
|
||||
"@esbuild/darwin-x64": "0.28.1",
|
||||
"@esbuild/freebsd-arm64": "0.28.1",
|
||||
"@esbuild/freebsd-x64": "0.28.1",
|
||||
"@esbuild/linux-arm": "0.28.1",
|
||||
"@esbuild/linux-arm64": "0.28.1",
|
||||
"@esbuild/linux-ia32": "0.28.1",
|
||||
"@esbuild/linux-loong64": "0.28.1",
|
||||
"@esbuild/linux-mips64el": "0.28.1",
|
||||
"@esbuild/linux-ppc64": "0.28.1",
|
||||
"@esbuild/linux-riscv64": "0.28.1",
|
||||
"@esbuild/linux-s390x": "0.28.1",
|
||||
"@esbuild/linux-x64": "0.28.1",
|
||||
"@esbuild/netbsd-arm64": "0.28.1",
|
||||
"@esbuild/netbsd-x64": "0.28.1",
|
||||
"@esbuild/openbsd-arm64": "0.28.1",
|
||||
"@esbuild/openbsd-x64": "0.28.1",
|
||||
"@esbuild/openharmony-arm64": "0.28.1",
|
||||
"@esbuild/sunos-x64": "0.28.1",
|
||||
"@esbuild/win32-arm64": "0.28.1",
|
||||
"@esbuild/win32-ia32": "0.28.1",
|
||||
"@esbuild/win32-x64": "0.28.1"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-check": {
|
||||
|
||||
6
@omniroute/opencode-plugin/package-lock.json
generated
6
@omniroute/opencode-plugin/package-lock.json
generated
@@ -1745,9 +1745,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/toml": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/toml/-/toml-4.3.0.tgz",
|
||||
"integrity": "sha512-lVb8X9BsPVuH0M4BKeS91tXAmJvCjQ5UIyAbQFaxkKGyUFK2RPkhwaFSQH8vbpl1d23eu/IBH+dwVMHWaq9A5A==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/toml/-/toml-4.1.1.tgz",
|
||||
"integrity": "sha512-EBJnVBr3dTXdA89WVFoAIPUqkBjxPMwRqsfuo1r240tKFHXv3zgca4+NJib/h6TyvGF7vOawz0jGuryJCdNHrw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
- fix(dashboard): allow deleting the last extra-upstream-header row even when invalid (#12251)
|
||||
1
changelog.d/fixes/12569-webhook-dns-rebinding-ssrf.md
Normal file
1
changelog.d/fixes/12569-webhook-dns-rebinding-ssrf.md
Normal file
@@ -0,0 +1 @@
|
||||
- fix(api): close DNS-rebinding SSRF gap in webhook outbound-URL guard (#12569)
|
||||
6
electron/package-lock.json
generated
6
electron/package-lock.json
generated
@@ -2113,9 +2113,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",
|
||||
"integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz",
|
||||
"integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
|
||||
50
package-lock.json
generated
50
package-lock.json
generated
@@ -8687,6 +8687,20 @@
|
||||
"license": "ISC",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/@openai/codex-security/node_modules/smol-toml": {
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.6.1.tgz",
|
||||
"integrity": "sha512-dWUG8F5sIIARXih1DTaQAX4SsiTXhInKf1buxdY9DIg4ZYPZK5nGM1VRIYmEbDbsHt7USo99xSLFu5Q1IqTmsg==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/cyyynthia"
|
||||
}
|
||||
},
|
||||
"node_modules/@openai/codex-security/node_modules/type-fest": {
|
||||
"version": "5.9.0",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-5.9.0.tgz",
|
||||
@@ -15203,9 +15217,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@yarnpkg/parsers/node_modules/js-yaml": {
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",
|
||||
"integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz",
|
||||
"integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
@@ -18521,9 +18535,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/csv-parse": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-7.0.2.tgz",
|
||||
"integrity": "sha512-uKZghv9UmPkMVLYy//KZ9HFAIJsl7wkhoEdIL0+rhuSY9pZQlhaeGEDPIe+/w7eh81MOql8Q/9+inAGWG6ZHYA==",
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-7.0.1.tgz",
|
||||
"integrity": "sha512-+2z7Ar0APQ7Uu6fX4cn+pitRmxjZ1WPBcGmZFKmA74FCyi7Et/XZx8cjNQ5CjbZ4HCOxXCOpRBYvYH08Qa003A==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
@@ -23589,9 +23603,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/hono": {
|
||||
"version": "4.13.7",
|
||||
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.7.tgz",
|
||||
"integrity": "sha512-c8/gF9ac8Y78/agExVocyLevgR+JlpNB444Py0FSX8pJoPdYUfUzRcXtYEYGwt6l19qIlVZPN5Mfsw9jFShmQQ==",
|
||||
"version": "4.13.0",
|
||||
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.0.tgz",
|
||||
"integrity": "sha512-jhunvfHWxd7J5EFfSgH4xsYJzSe/lfqbUCxiyyeaQasUsXeEHXtzVid+7EOGByc5JnFa23SSFL3Y2RV/z1T+eQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=16.9.0"
|
||||
@@ -26102,9 +26116,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/joi": {
|
||||
"version": "18.2.8",
|
||||
"resolved": "https://registry.npmjs.org/joi/-/joi-18.2.8.tgz",
|
||||
"integrity": "sha512-G2TX62h58ZHuwqetJgP2F4ualakqAmZtBYe3jWen7gxQRw5xApX6crnFtuB91WC0c3ESBnva+kGSnb3+6pIQDQ==",
|
||||
"version": "18.2.3",
|
||||
"resolved": "https://registry.npmjs.org/joi/-/joi-18.2.3.tgz",
|
||||
"integrity": "sha512-N5A3KTWQpPWT4ExxxPlUx7WmykGXRzhNidWhV41d6Abu9YfI2NyWCJuxdPnslJCPWtbRpSVOWSnSS6GakLM/Rg==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
@@ -27932,9 +27946,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/lockfile-lint/node_modules/js-yaml": {
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",
|
||||
"integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz",
|
||||
"integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
@@ -39606,9 +39620,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/xmlbuilder2/node_modules/js-yaml": {
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",
|
||||
"integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz",
|
||||
"integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
|
||||
@@ -486,10 +486,7 @@
|
||||
"fast-uri": "^3.1.7",
|
||||
"body-parser": "^2.3.0",
|
||||
"@yarnpkg/parsers": {
|
||||
"js-yaml": "^4.3.2"
|
||||
},
|
||||
"@openai/codex-security": {
|
||||
"smol-toml": "^1.8.0"
|
||||
"js-yaml": "^4.3.1"
|
||||
},
|
||||
"jsdom": {
|
||||
"undici": "^7.29.0"
|
||||
|
||||
@@ -707,10 +707,7 @@ export default function ModelCompatPopover({
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
disabled={
|
||||
disabled ||
|
||||
(headerRows.length <= 1 && !row.name.trim() && !row.value.trim())
|
||||
}
|
||||
disabled={disabled || headerRows.length <= 1}
|
||||
onClick={() => removeHeaderRow(row.id)}
|
||||
title={t("compatUpstreamRemoveRow")}
|
||||
className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border/80 text-text-muted hover:bg-red-500/10 hover:text-red-600 dark:hover:text-red-400 disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:text-text-muted transition-colors"
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
// @vitest-environment jsdom
|
||||
// Repro for #12251
|
||||
import React, { act } from "react";
|
||||
import { createRoot, type Root } from "react-dom/client";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import ModelCompatPopover from "../ModelCompatPopover";
|
||||
|
||||
vi.mock("next-intl", () => ({
|
||||
useTranslations: () => (key: string) => key,
|
||||
}));
|
||||
|
||||
let container: HTMLDivElement;
|
||||
let root: Root;
|
||||
|
||||
async function flushEffects() {
|
||||
await act(async () => {
|
||||
await Promise.resolve();
|
||||
});
|
||||
}
|
||||
|
||||
async function openPopover() {
|
||||
const trigger = container.querySelector("button") as HTMLButtonElement;
|
||||
await act(async () => trigger.click());
|
||||
await flushEffects();
|
||||
}
|
||||
|
||||
describe("ModelCompatPopover upstream headers — invalid single row cannot be deleted (#12251)", () => {
|
||||
beforeEach(() => {
|
||||
(
|
||||
globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT?: boolean }
|
||||
).IS_REACT_ACT_ENVIRONMENT = true;
|
||||
container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
root = createRoot(container);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
act(() => root.unmount());
|
||||
document.body.innerHTML = "";
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
|
||||
it("lets the user delete the invalid header via the delete icon when it is the ONLY row present", async () => {
|
||||
const onCompatPatch = vi.fn();
|
||||
|
||||
act(() => {
|
||||
root.render(
|
||||
<ModelCompatPopover
|
||||
t={(key) => key}
|
||||
providerId="openai"
|
||||
modelId="gpt-test"
|
||||
effectiveModelNormalize={() => false}
|
||||
effectiveModelPreserveDeveloper={() => true}
|
||||
getUpstreamHeadersRecord={() => ({
|
||||
"https://evil.example.com/callback": "some-secret-value",
|
||||
})}
|
||||
onCompatPatch={onCompatPatch}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
await openPopover();
|
||||
|
||||
const nameInput = document.querySelector(
|
||||
'input[placeholder="compatUpstreamHeaderNamePlaceholder"]'
|
||||
) as HTMLInputElement;
|
||||
expect(nameInput).toBeTruthy();
|
||||
expect(nameInput.value).toBe("https://evil.example.com/callback");
|
||||
|
||||
const rowButtons = document.querySelectorAll('button[title="compatUpstreamRemoveRow"]');
|
||||
expect(rowButtons.length).toBe(1);
|
||||
|
||||
const removeButton = rowButtons[0] as HTMLButtonElement;
|
||||
|
||||
// EXPECTED (fixed) behavior: a populated row should always be removable via
|
||||
// its own delete icon, even when it is the only row.
|
||||
expect(removeButton.disabled).toBe(false);
|
||||
|
||||
await act(async () => removeButton.click());
|
||||
await flushEffects();
|
||||
|
||||
expect(onCompatPatch).toHaveBeenCalledWith("openai", { upstreamHeaders: {} });
|
||||
});
|
||||
|
||||
it("keeps the delete button disabled when the sole row is genuinely blank", async () => {
|
||||
const onCompatPatch = vi.fn();
|
||||
|
||||
act(() => {
|
||||
root.render(
|
||||
<ModelCompatPopover
|
||||
t={(key) => key}
|
||||
providerId="openai"
|
||||
modelId="gpt-test"
|
||||
effectiveModelNormalize={() => false}
|
||||
effectiveModelPreserveDeveloper={() => true}
|
||||
getUpstreamHeadersRecord={() => ({})}
|
||||
onCompatPatch={onCompatPatch}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
await openPopover();
|
||||
|
||||
const rowButtons = document.querySelectorAll('button[title="compatUpstreamRemoveRow"]');
|
||||
expect(rowButtons.length).toBe(1);
|
||||
|
||||
const removeButton = rowButtons[0] as HTMLButtonElement;
|
||||
|
||||
// A blank sole row must stay non-deletable so the form always shows an
|
||||
// editable add-affordance.
|
||||
expect(removeButton.disabled).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -19,10 +19,7 @@ export async function DELETE(request: Request) {
|
||||
);
|
||||
}
|
||||
|
||||
// Scope the sweep to the caller. Only the operator's own dashboard (session
|
||||
// auth) may clear the whole instance; an API key clears only its own
|
||||
// completed batches (GHSA-wvxc-jp3v-5mg5).
|
||||
const result = deleteCompletedBatches(scope.isSessionAuth ? undefined : scope.apiKeyId);
|
||||
const result = deleteCompletedBatches();
|
||||
|
||||
return NextResponse.json(
|
||||
{ deleted: true, deletedBatches: result.deletedBatches, deletedFiles: result.deletedFiles },
|
||||
|
||||
@@ -12,8 +12,7 @@ import { buildTelegramUrl, buildTelegramPayload } from "@/lib/webhooks/integrati
|
||||
import { buildDiscordPayload } from "@/lib/webhooks/integrations/discord";
|
||||
import { requireManagementAuth } from "@/lib/api/requireManagementAuth";
|
||||
import { insertDelivery } from "@/lib/db/webhookDeliveries";
|
||||
import { isPrivateHost, OutboundUrlGuardError } from "@/shared/network/outboundUrlGuard";
|
||||
import { parseAndValidateWebhookUrl } from "@/shared/network/outboundUrlGuardPolicy";
|
||||
import { fetchWebhookUrl } from "@/shared/network/webhookFetch";
|
||||
import crypto from "crypto";
|
||||
|
||||
const MAX_RESPONSE_BODY = 2048;
|
||||
@@ -31,35 +30,43 @@ async function testFetch(
|
||||
}> {
|
||||
const start = Date.now();
|
||||
try {
|
||||
const parsed = parseAndValidateWebhookUrl(url);
|
||||
// For private (opted-in) targets, return connectivity diagnostics only — never the
|
||||
// upstream response body, so this endpoint can't be used to exfiltrate content from
|
||||
// internal services reachable from the server. (#3269 hardening)
|
||||
const redactBody = isPrivateHost(parsed.hostname);
|
||||
const controller = new AbortController();
|
||||
const timeoutId = setTimeout(() => controller.abort(), 10_000);
|
||||
const res = await fetch(url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": "OmniRoute-Webhook/1.0",
|
||||
...headers,
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
signal: controller.signal,
|
||||
});
|
||||
clearTimeout(timeoutId);
|
||||
let response: Response;
|
||||
let redactBody: boolean;
|
||||
try {
|
||||
({ response, redactBody } = await fetchWebhookUrl(
|
||||
url,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": "OmniRoute-Webhook/1.0",
|
||||
...headers,
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
},
|
||||
{ signal: controller.signal }
|
||||
));
|
||||
} finally {
|
||||
clearTimeout(timeoutId);
|
||||
}
|
||||
const latencyMs = Date.now() - start;
|
||||
// For private (opted-in) targets, return connectivity diagnostics only — never the
|
||||
// upstream response body, so this endpoint can't be used to exfiltrate content from
|
||||
// internal services reachable from the server. (#3269 hardening) The verdict is derived
|
||||
// from the DNS-resolved address, not the raw hostname string, so a public-looking hostname
|
||||
// rebound to a private IP is redacted too.
|
||||
let rawBody = "";
|
||||
try {
|
||||
rawBody = await res.text();
|
||||
rawBody = await response.text();
|
||||
if (rawBody.length > MAX_RESPONSE_BODY) rawBody = rawBody.slice(0, MAX_RESPONSE_BODY) + "…";
|
||||
} catch {
|
||||
rawBody = "";
|
||||
}
|
||||
return {
|
||||
success: res.ok,
|
||||
status: res.status,
|
||||
success: response.ok,
|
||||
status: response.status,
|
||||
latencyMs,
|
||||
responseBody: redactBody ? "<redacted: private target>" : rawBody,
|
||||
};
|
||||
|
||||
@@ -411,37 +411,15 @@ export function deleteBatch(id: string): boolean {
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bulk-delete completed batches and the files they reference.
|
||||
*
|
||||
* `apiKeyId` scopes EVERY statement to that owner. Omitting it keeps the
|
||||
* instance-wide sweep, which is legitimate for the operator's own dashboard
|
||||
* (session auth) and for nothing else: without the predicate, an ordinary
|
||||
* inference key could wipe every tenant's completed batches and null out their
|
||||
* file contents (GHSA-wvxc-jp3v-5mg5). Same ownership shape as `listBatches`
|
||||
* and `countBatches` above.
|
||||
*/
|
||||
export function deleteCompletedBatches(apiKeyId?: string | null): {
|
||||
deletedBatches: number;
|
||||
deletedFiles: number;
|
||||
} {
|
||||
export function deleteCompletedBatches(): { deletedBatches: number; deletedFiles: number } {
|
||||
const db = getDbInstance();
|
||||
const scoped = typeof apiKeyId === "string" && apiKeyId.length > 0;
|
||||
|
||||
// Collect unique file IDs from the completed batches in scope
|
||||
const rows = (
|
||||
scoped
|
||||
? db
|
||||
.prepare(
|
||||
"SELECT input_file_id, output_file_id, error_file_id FROM batches WHERE status = 'completed' AND api_key_id = ?"
|
||||
)
|
||||
.all(apiKeyId)
|
||||
: db
|
||||
.prepare(
|
||||
"SELECT input_file_id, output_file_id, error_file_id FROM batches WHERE status = 'completed'"
|
||||
)
|
||||
.all()
|
||||
) as Array<{
|
||||
// Collect unique file IDs from all completed batches
|
||||
const rows = db
|
||||
.prepare(
|
||||
"SELECT input_file_id, output_file_id, error_file_id FROM batches WHERE status = 'completed'"
|
||||
)
|
||||
.all() as Array<{
|
||||
input_file_id: string | null;
|
||||
output_file_id: string | null;
|
||||
error_file_id: string | null;
|
||||
@@ -463,16 +441,6 @@ export function deleteCompletedBatches(apiKeyId?: string | null): {
|
||||
}
|
||||
}
|
||||
|
||||
if (scoped) {
|
||||
db.prepare(
|
||||
"DELETE FROM batch_item_checkpoints WHERE batch_id IN (SELECT id FROM batches WHERE status = 'completed' AND api_key_id = ?)"
|
||||
).run(apiKeyId);
|
||||
const result = db
|
||||
.prepare("DELETE FROM batches WHERE status = 'completed' AND api_key_id = ?")
|
||||
.run(apiKeyId);
|
||||
return { deletedBatches: result.changes, deletedFiles };
|
||||
}
|
||||
|
||||
db.prepare(
|
||||
"DELETE FROM batch_item_checkpoints WHERE batch_id IN (SELECT id FROM batches WHERE status = 'completed')"
|
||||
).run();
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
import crypto from "crypto";
|
||||
import { encrypt, decrypt } from "./db/encryption";
|
||||
import { parseAndValidateWebhookUrl } from "@/shared/network/outboundUrlGuardPolicy";
|
||||
import { OutboundUrlGuardError } from "@/shared/network/outboundUrlGuard";
|
||||
import { fetchWebhookUrl, type WebhookFetchOptions } from "@/shared/network/webhookFetch";
|
||||
import type { WebhookEvent } from "./webhooks/eventDescriptions";
|
||||
|
||||
export type { WebhookEvent };
|
||||
@@ -17,6 +18,10 @@ export interface WebhookPayload {
|
||||
data: Record<string, any>;
|
||||
}
|
||||
|
||||
/** DNS-resolve/fetch overrides — production callers never pass these; tests inject a fake
|
||||
* resolver and/or fetch to avoid real network access (#12569). */
|
||||
export type WebhookDeliveryOptions = Pick<WebhookFetchOptions, "lookup" | "fetchImpl">;
|
||||
|
||||
function signPayload(payload: string, secret: string): string {
|
||||
return `sha256=${crypto.createHmac("sha256", secret).update(payload).digest("hex")}`;
|
||||
}
|
||||
@@ -38,21 +43,24 @@ export function decryptMetadata(encrypted: string | null): Record<string, string
|
||||
|
||||
async function deliverRaw(
|
||||
url: string,
|
||||
body: Record<string, unknown>
|
||||
body: Record<string, unknown>,
|
||||
options?: WebhookDeliveryOptions
|
||||
): Promise<{ success: boolean; status: number; latencyMs: number; error?: string }> {
|
||||
const start = Date.now();
|
||||
try {
|
||||
parseAndValidateWebhookUrl(url);
|
||||
const controller = new AbortController();
|
||||
const timeoutId = setTimeout(() => controller.abort(), 10_000);
|
||||
try {
|
||||
const res = await fetch(url, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", "User-Agent": "OmniRoute-Webhook/1.0" },
|
||||
body: JSON.stringify(body),
|
||||
signal: controller.signal,
|
||||
});
|
||||
return { success: res.ok, status: res.status, latencyMs: Date.now() - start };
|
||||
const { response } = await fetchWebhookUrl(
|
||||
url,
|
||||
{
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", "User-Agent": "OmniRoute-Webhook/1.0" },
|
||||
body: JSON.stringify(body),
|
||||
},
|
||||
{ ...options, signal: controller.signal }
|
||||
);
|
||||
return { success: response.ok, status: response.status, latencyMs: Date.now() - start };
|
||||
} finally {
|
||||
// Always clear the abort timer — on a non-timeout fetch error the previous code skipped
|
||||
// clearTimeout, leaving a dangling 10s timer (and AbortController) per failed call.
|
||||
@@ -72,13 +80,9 @@ export async function deliverWebhook(
|
||||
url: string,
|
||||
payload: WebhookPayload,
|
||||
secret?: string | null,
|
||||
maxRetries = 3
|
||||
maxRetries = 3,
|
||||
options?: WebhookDeliveryOptions
|
||||
): Promise<{ success: boolean; status: number; error?: string }> {
|
||||
try {
|
||||
parseAndValidateWebhookUrl(url);
|
||||
} catch (error: any) {
|
||||
return { success: false, status: 0, error: error.message || "Blocked outbound URL" };
|
||||
}
|
||||
const body = JSON.stringify(payload);
|
||||
const headers: Record<string, string> = {
|
||||
"Content-Type": "application/json",
|
||||
@@ -96,29 +100,31 @@ export async function deliverWebhook(
|
||||
const controller = new AbortController();
|
||||
const timeoutId = setTimeout(() => controller.abort(), 10_000);
|
||||
|
||||
let res: Response;
|
||||
let response: Response;
|
||||
try {
|
||||
res = await fetch(url, {
|
||||
method: "POST",
|
||||
headers,
|
||||
body,
|
||||
signal: controller.signal,
|
||||
});
|
||||
({ response } = await fetchWebhookUrl(
|
||||
url,
|
||||
{ method: "POST", headers, body },
|
||||
{ ...options, signal: controller.signal }
|
||||
));
|
||||
} finally {
|
||||
// Clear the abort timer on every path — a non-timeout fetch error previously skipped
|
||||
// clearTimeout, leaking a dangling 10s timer + AbortController per failed attempt.
|
||||
clearTimeout(timeoutId);
|
||||
}
|
||||
|
||||
if (res.ok || res.status < 500) {
|
||||
return { success: res.ok, status: res.status };
|
||||
if (response.ok || response.status < 500) {
|
||||
return { success: response.ok, status: response.status };
|
||||
}
|
||||
|
||||
if (attempt < maxRetries) {
|
||||
await new Promise((r) => setTimeout(r, Math.pow(2, attempt) * 1000));
|
||||
}
|
||||
} catch (error: any) {
|
||||
if (attempt === maxRetries) {
|
||||
// A blocked outbound URL (private/metadata resolved address, or a redirect hop that
|
||||
// resolved to one) is never transient — fail closed immediately instead of burning
|
||||
// retries/backoff on something that will keep resolving the same way.
|
||||
if (attempt === maxRetries || error instanceof OutboundUrlGuardError) {
|
||||
return { success: false, status: 0, error: error.message || "Network error" };
|
||||
}
|
||||
await new Promise((r) => setTimeout(r, Math.pow(2, attempt) * 1000));
|
||||
|
||||
94
src/shared/network/dnsPinnedFetch.ts
Normal file
94
src/shared/network/dnsPinnedFetch.ts
Normal file
@@ -0,0 +1,94 @@
|
||||
import { isIP } from "node:net";
|
||||
import dns from "node:dns";
|
||||
import { Agent, fetch as undiciFetch } from "undici";
|
||||
|
||||
/**
|
||||
* Shared DNS-resolve-then-pin primitives (#12569). Originally written only for
|
||||
* `remoteImageFetch.ts` (GHSA-cmhj-wh2f-9cgx); extracted here so the webhook outbound-URL
|
||||
* guard (`webhookFetch.ts`) can reuse the exact same connection-pinning mechanism instead of
|
||||
* duplicating it. `remoteImageFetch.ts` re-exports `createPinnedFetch` from here for backward
|
||||
* compatibility with its existing import path.
|
||||
*/
|
||||
|
||||
export interface DnsLookupResult {
|
||||
address: string;
|
||||
family: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal DNS lookup contract — matches the shape returned by
|
||||
* `node:dns/promises`.lookup(host, { all: true }). Exposed as an option so
|
||||
* tests can inject a fake resolver without touching real DNS.
|
||||
*/
|
||||
export type DnsLookup = (hostname: string) => Promise<DnsLookupResult[]>;
|
||||
|
||||
export const defaultDnsLookup: DnsLookup = (hostname) =>
|
||||
dns.promises.lookup(hostname, { all: true });
|
||||
|
||||
/** Strip literal IPv6 brackets: "[::1]" -> "::1". */
|
||||
export function bareHostname(hostname: string): string {
|
||||
return hostname.startsWith("[") && hostname.endsWith("]") ? hostname.slice(1, -1) : hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve every DNS answer for a hostname, short-circuiting for an IP literal (which needs no
|
||||
* lookup — it already IS the connect-time address). Fails closed: a lookup error or an empty
|
||||
* answer set throws rather than being treated as "no restriction applies".
|
||||
*/
|
||||
export async function resolveHostnameAddresses(
|
||||
hostname: string,
|
||||
lookup: DnsLookup = defaultDnsLookup
|
||||
): Promise<DnsLookupResult[]> {
|
||||
const bare = bareHostname(hostname);
|
||||
if (!bare) return [];
|
||||
const literalFamily = isIP(bare);
|
||||
if (literalFamily) return [{ address: bare, family: literalFamily }];
|
||||
const resolved = await lookup(bare);
|
||||
if (!resolved.length) {
|
||||
throw new Error(`Host "${bare}" could not be resolved`);
|
||||
}
|
||||
return resolved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a `fetch` bound to a single already-DNS-validated address, ignoring
|
||||
* whatever the hostname resolves to at connect time. Exported for direct
|
||||
* testing: this is the mechanism that closes the DNS-rebinding TOCTOU gap
|
||||
* (GHSA-cmhj-wh2f-9cgx) — a second, real DNS lookup at connect time could
|
||||
* otherwise return a different (possibly private) address than the one
|
||||
* validated up-front.
|
||||
*/
|
||||
export function createPinnedFetch(address: string, family: number): typeof fetch {
|
||||
const dispatcher = new Agent({
|
||||
connect: {
|
||||
// Node's `net.connect`/`tls.connect` invoke a custom `lookup` in one of
|
||||
// two incompatible shapes depending on `options.all`: modern Node
|
||||
// (autoSelectFamily / Happy Eyeballs, on by default since Node 18)
|
||||
// calls `lookup(hostname, { all: true, ... }, callback)` and requires
|
||||
// `callback(err, addresses[])` — an array of `{ address, family }`.
|
||||
// Only when `all` is falsy does it accept the single-address form
|
||||
// `callback(err, address, family)`. Handling only the single-address
|
||||
// form here (as an earlier draft did) throws `ERR_INVALID_IP_ADDRESS`
|
||||
// for every real request once autoSelectFamily kicks in, silently
|
||||
// breaking every pinned fetch — verified by
|
||||
// `tests/unit/remote-image-fetch-pin-dns-connection.test.ts`.
|
||||
lookup: (_hostname, options, callback) => {
|
||||
if (options && typeof options === "object" && "all" in options && options.all) {
|
||||
callback(null, [{ address, family }]);
|
||||
return;
|
||||
}
|
||||
callback(null, address, family);
|
||||
},
|
||||
},
|
||||
});
|
||||
return (async (input, init) => {
|
||||
try {
|
||||
return (await undiciFetch(input as string | URL, {
|
||||
...(init as Parameters<typeof undiciFetch>[1]),
|
||||
dispatcher,
|
||||
})) as unknown as Response;
|
||||
} finally {
|
||||
await dispatcher.close();
|
||||
}
|
||||
}) as typeof fetch;
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import { isIP } from "node:net";
|
||||
import dns from "node:dns";
|
||||
import { Agent, fetch as undiciFetch } from "undici";
|
||||
import {
|
||||
type OutboundUrlGuardMode,
|
||||
isPrivateHost,
|
||||
@@ -9,6 +8,13 @@ import {
|
||||
parseOutboundUrl,
|
||||
} from "@/shared/network/outboundUrlGuard";
|
||||
import { getProviderOutboundGuard } from "@/shared/network/outboundUrlGuardPolicy";
|
||||
// #12569: `createPinnedFetch` now lives in the shared `dnsPinnedFetch.ts` module so the
|
||||
// webhook outbound-URL guard can reuse the exact same connection-pinning mechanism instead of
|
||||
// duplicating it. Re-exported here for backward compatibility with existing importers of
|
||||
// `@/shared/network/remoteImageFetch`.
|
||||
import { createPinnedFetch } from "@/shared/network/dnsPinnedFetch";
|
||||
|
||||
export { createPinnedFetch };
|
||||
|
||||
const DEFAULT_MAX_REMOTE_IMAGE_BYTES = 20 * 1024 * 1024;
|
||||
const DEFAULT_MAX_REDIRECTS = 3;
|
||||
@@ -95,48 +101,6 @@ async function assertHostnameResolvesPublic(
|
||||
}
|
||||
return resolved;
|
||||
}
|
||||
/**
|
||||
* Build a `fetch` bound to a single already-DNS-validated address, ignoring
|
||||
* whatever the hostname resolves to at connect time. Exported for direct
|
||||
* testing: this is the mechanism that closes the DNS-rebinding TOCTOU gap
|
||||
* (GHSA-cmhj-wh2f-9cgx) — a second, real DNS lookup at connect time could
|
||||
* otherwise return a different (possibly private) address than the one
|
||||
* `assertHostnameResolvesPublic` validated.
|
||||
*/
|
||||
export function createPinnedFetch(address: string, family: number): typeof fetch {
|
||||
const dispatcher = new Agent({
|
||||
connect: {
|
||||
// Node's `net.connect`/`tls.connect` invoke a custom `lookup` in one of
|
||||
// two incompatible shapes depending on `options.all`: modern Node
|
||||
// (autoSelectFamily / Happy Eyeballs, on by default since Node 18)
|
||||
// calls `lookup(hostname, { all: true, ... }, callback)` and requires
|
||||
// `callback(err, addresses[])` — an array of `{ address, family }`.
|
||||
// Only when `all` is falsy does it accept the single-address form
|
||||
// `callback(err, address, family)`. Handling only the single-address
|
||||
// form here (as an earlier draft did) throws `ERR_INVALID_IP_ADDRESS`
|
||||
// for every real request once autoSelectFamily kicks in, silently
|
||||
// breaking every pinned fetch — verified by
|
||||
// `tests/unit/remote-image-fetch-pin-dns-connection.test.ts`.
|
||||
lookup: (_hostname, options, callback) => {
|
||||
if (options && typeof options === "object" && "all" in options && options.all) {
|
||||
callback(null, [{ address, family }]);
|
||||
return;
|
||||
}
|
||||
callback(null, address, family);
|
||||
},
|
||||
},
|
||||
});
|
||||
return (async (input, init) => {
|
||||
try {
|
||||
return (await undiciFetch(input as string | URL, {
|
||||
...(init as Parameters<typeof undiciFetch>[1]),
|
||||
dispatcher,
|
||||
})) as unknown as Response;
|
||||
} finally {
|
||||
await dispatcher.close();
|
||||
}
|
||||
}) as typeof fetch;
|
||||
}
|
||||
function combineSignals(signal: AbortSignal | undefined, timeoutMs: number) {
|
||||
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
||||
if (!signal) return timeoutSignal;
|
||||
|
||||
167
src/shared/network/webhookFetch.ts
Normal file
167
src/shared/network/webhookFetch.ts
Normal file
@@ -0,0 +1,167 @@
|
||||
import {
|
||||
createPinnedFetch,
|
||||
defaultDnsLookup,
|
||||
resolveHostnameAddresses,
|
||||
type DnsLookup,
|
||||
type DnsLookupResult,
|
||||
} from "@/shared/network/dnsPinnedFetch";
|
||||
import {
|
||||
isCloudMetadataHost,
|
||||
isPrivateHost,
|
||||
OutboundUrlGuardError,
|
||||
parseOutboundUrl,
|
||||
PROVIDER_URL_BLOCKED_MESSAGE,
|
||||
} from "@/shared/network/outboundUrlGuard";
|
||||
import { arePrivateProviderUrlsAllowed } from "@/shared/network/outboundUrlGuardPolicy";
|
||||
|
||||
/**
|
||||
* #12569 — DNS-resolve-then-pin fetch for webhook outbound calls (custom webhook delivery +
|
||||
* the webhook test-diagnostics endpoint). `parseAndValidateWebhookUrl` in
|
||||
* `outboundUrlGuardPolicy.ts` only classifies the literal hostname STRING, so a hostname an
|
||||
* attacker controls (DNS pointed at 169.254.169.254 / an RFC1918 address) passed that guard
|
||||
* and reached the real `fetch()` unmodified. This module resolves DNS up front, rejects any
|
||||
* resolved answer that is cloud-metadata (always) or private (unless the private-provider-URL
|
||||
* opt-in is on), pins the connection to a validated address, and revalidates every redirect
|
||||
* hop the same way — a public host answering 302 to an internal address no longer escapes
|
||||
* the guard.
|
||||
*/
|
||||
|
||||
const DEFAULT_MAX_REDIRECTS = 3;
|
||||
|
||||
export interface WebhookFetchOptions {
|
||||
/** DNS resolver override. Tests inject a fake resolver to avoid real network lookups. */
|
||||
lookup?: DnsLookup;
|
||||
/** Fetch override. Takes priority over connection pinning — the mockable escape hatch used
|
||||
* by existing tests that stub `globalThis.fetch`. */
|
||||
fetchImpl?: typeof fetch;
|
||||
/** Pin the connection to the validated DNS answer. Default true — this is the mechanism
|
||||
* that closes the DNS-rebinding TOCTOU gap. */
|
||||
pinDns?: boolean;
|
||||
maxRedirects?: number;
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
|
||||
export interface WebhookFetchResult {
|
||||
response: Response;
|
||||
finalUrl: string;
|
||||
/** True when a resolved hop is a private address explicitly allowed via opt-in — the
|
||||
* caller must not surface the upstream response body for such a target (#3269). */
|
||||
redactBody: boolean;
|
||||
}
|
||||
|
||||
/** Reject a resolved address set that includes a metadata or (non-opted-in) private IP. */
|
||||
function assertAddressesAllowed(addresses: DnsLookupResult[], url: URL): boolean {
|
||||
const allowPrivate = arePrivateProviderUrlsAllowed();
|
||||
let sawPrivate = false;
|
||||
for (const { address } of addresses) {
|
||||
if (isCloudMetadataHost(address)) {
|
||||
throw new OutboundUrlGuardError(PROVIDER_URL_BLOCKED_MESSAGE, {
|
||||
code: "OUTBOUND_URL_GUARD_BLOCKED",
|
||||
url: url.toString(),
|
||||
hostname: address,
|
||||
});
|
||||
}
|
||||
if (isPrivateHost(address)) {
|
||||
if (!allowPrivate) {
|
||||
throw new OutboundUrlGuardError(PROVIDER_URL_BLOCKED_MESSAGE, {
|
||||
code: "OUTBOUND_URL_GUARD_BLOCKED",
|
||||
url: url.toString(),
|
||||
hostname: address,
|
||||
});
|
||||
}
|
||||
sawPrivate = true;
|
||||
}
|
||||
}
|
||||
return sawPrivate;
|
||||
}
|
||||
|
||||
async function resolveHop(
|
||||
currentUrl: string | URL,
|
||||
lookup: DnsLookup
|
||||
): Promise<{ url: URL; addresses: DnsLookupResult[]; redactBody: boolean }> {
|
||||
const url = parseOutboundUrl(currentUrl);
|
||||
let addresses: DnsLookupResult[];
|
||||
try {
|
||||
addresses = await resolveHostnameAddresses(url.hostname, lookup);
|
||||
} catch {
|
||||
throw new OutboundUrlGuardError("Webhook host could not be resolved (blocked)", {
|
||||
code: "OUTBOUND_URL_GUARD_BLOCKED",
|
||||
url: url.toString(),
|
||||
hostname: url.hostname || null,
|
||||
});
|
||||
}
|
||||
const redactBody = assertAddressesAllowed(addresses, url);
|
||||
return { url, addresses, redactBody };
|
||||
}
|
||||
|
||||
function pickFetchImpl(
|
||||
fetchImpl: typeof fetch | undefined,
|
||||
pinDns: boolean,
|
||||
addresses: DnsLookupResult[]
|
||||
): typeof fetch {
|
||||
if (fetchImpl) return fetchImpl;
|
||||
if (pinDns && addresses.length) return createPinnedFetch(addresses[0].address, addresses[0].family);
|
||||
return fetch;
|
||||
}
|
||||
|
||||
function nextRedirectUrl(
|
||||
response: Response,
|
||||
currentUrl: URL,
|
||||
redirectCount: number,
|
||||
maxRedirects: number
|
||||
): URL {
|
||||
const location = response.headers.get("location");
|
||||
if (!location) {
|
||||
throw new OutboundUrlGuardError("Webhook redirect missing Location header", {
|
||||
code: "OUTBOUND_URL_INVALID",
|
||||
url: currentUrl.toString(),
|
||||
});
|
||||
}
|
||||
if (redirectCount >= maxRedirects) {
|
||||
throw new OutboundUrlGuardError(`Webhook exceeded ${maxRedirects} redirect limit`, {
|
||||
code: "OUTBOUND_URL_GUARD_BLOCKED",
|
||||
url: currentUrl.toString(),
|
||||
});
|
||||
}
|
||||
return new URL(location, currentUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* DNS-resolve-then-pin POST/GET for a webhook URL, following redirects manually and
|
||||
* revalidating DNS at every hop. Throws `OutboundUrlGuardError` when the target (or a
|
||||
* redirect target) resolves to a blocked address.
|
||||
*/
|
||||
export async function fetchWebhookUrl(
|
||||
input: string,
|
||||
init: RequestInit,
|
||||
options: WebhookFetchOptions = {}
|
||||
): Promise<WebhookFetchResult> {
|
||||
const lookup = options.lookup ?? defaultDnsLookup;
|
||||
const maxRedirects = options.maxRedirects ?? DEFAULT_MAX_REDIRECTS;
|
||||
const pinDns = options.pinDns !== false;
|
||||
let currentUrl: string | URL = input;
|
||||
let redactBody = false;
|
||||
|
||||
for (let redirectCount = 0; redirectCount <= maxRedirects; redirectCount++) {
|
||||
const hop = await resolveHop(currentUrl, lookup);
|
||||
redactBody = redactBody || hop.redactBody;
|
||||
const fetchImpl = pickFetchImpl(options.fetchImpl, pinDns, hop.addresses);
|
||||
const response = await fetchImpl(hop.url.toString(), {
|
||||
...init,
|
||||
redirect: "manual",
|
||||
signal: options.signal,
|
||||
});
|
||||
|
||||
if (response.status >= 300 && response.status < 400) {
|
||||
currentUrl = nextRedirectUrl(response, hop.url, redirectCount, maxRedirects);
|
||||
continue;
|
||||
}
|
||||
|
||||
return { response, finalUrl: hop.url.toString(), redactBody };
|
||||
}
|
||||
|
||||
throw new OutboundUrlGuardError(`Webhook exceeded ${maxRedirects} redirect limit`, {
|
||||
code: "OUTBOUND_URL_GUARD_BLOCKED",
|
||||
url: String(input),
|
||||
});
|
||||
}
|
||||
@@ -58,8 +58,6 @@
|
||||
"tests/unit/account-fallback-retry-after-json.test.ts",
|
||||
"tests/unit/account-fallback-route-restriction-403.test.ts",
|
||||
"tests/unit/account-fallback-service.test.ts",
|
||||
"tests/unit/combo-pin-implicit-allowlist.test.ts",
|
||||
"tests/unit/combo/execute-target-gates.test.ts",
|
||||
"tests/unit/moonshot-quota-writeback.test.ts",
|
||||
"tests/unit/accountfallback-ratelimit-400-4976.test.ts",
|
||||
"tests/unit/adaptive-admission-route-matrix.test.ts",
|
||||
@@ -77,8 +75,6 @@
|
||||
"tests/unit/api-key-policy-noauth-allowed-connections.test.ts",
|
||||
"tests/unit/api-key-rotator-health.test.ts",
|
||||
"tests/unit/chat-routing-synced-inventory-11089.test.ts",
|
||||
"tests/unit/openai-compatible-per-upstream-402-health.test.ts",
|
||||
"tests/unit/quota-window-label.test.ts",
|
||||
"tests/unit/repro-combo-persisted-cooldown-preskip.test.ts",
|
||||
"tests/unit/repro-glm-iso-reset-24h-cap.test.ts",
|
||||
"tests/unit/security-route-guard-tiers.test.ts",
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
/**
|
||||
* GHSA-wvxc-jp3v-5mg5 — `DELETE /api/v1/batches/delete-completed` deleted the
|
||||
* completed batches of EVERY api key on the instance, and nulled the contents of
|
||||
* every file those batches referenced.
|
||||
*
|
||||
* Two defects in one endpoint:
|
||||
* 1. `deleteCompletedBatches()` carried no `api_key_id` predicate — the file
|
||||
* SELECT, the checkpoint DELETE and the batch DELETE were all instance-wide.
|
||||
* 2. The route only checked that SOME key was present (`!scope.apiKeyId` →
|
||||
* 401), never that the caller owned anything. A key with `scopes: []` —
|
||||
* an ordinary inference key — could wipe another tenant's batches.
|
||||
*
|
||||
* The ownership pattern this restores is not new: `listBatches(apiKeyId?)` and
|
||||
* `countBatches(apiKeyId?)` in the same module already scope by `api_key_id`,
|
||||
* and `batches/[id]/route.ts` already gates per-record access with `scopeCheck`
|
||||
* (session auth sees everything, a key sees only its own). This helper was the
|
||||
* one that never got it.
|
||||
*
|
||||
* Run with:
|
||||
* node --import tsx/esm --test tests/unit/batch-delete-completed-ownership-wvxc.test.ts
|
||||
*/
|
||||
|
||||
import { describe, it } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { createFile, getFile } from "@/lib/db/files";
|
||||
import { createBatch, getBatch, deleteCompletedBatches } from "@/lib/db/batches";
|
||||
|
||||
const KEY_A = "key-wvxc-aaaa";
|
||||
const KEY_B = "key-wvxc-bbbb";
|
||||
|
||||
function seedCompletedBatch(apiKeyId: string | null, tag: string) {
|
||||
const file = createFile({
|
||||
bytes: 10,
|
||||
filename: `wvxc-${tag}.jsonl`,
|
||||
purpose: "batch",
|
||||
content: Buffer.from("{}"),
|
||||
});
|
||||
const batch = createBatch({
|
||||
endpoint: "/v1/chat/completions",
|
||||
completionWindow: "24h",
|
||||
inputFileId: file.id,
|
||||
status: "completed",
|
||||
apiKeyId,
|
||||
});
|
||||
return { file, batch };
|
||||
}
|
||||
|
||||
describe("deleteCompletedBatches — ownership scoping (GHSA-wvxc-jp3v-5mg5)", () => {
|
||||
it("scoped to one key deletes ONLY that key's completed batches", () => {
|
||||
const a = seedCompletedBatch(KEY_A, "a1");
|
||||
const b = seedCompletedBatch(KEY_B, "b1");
|
||||
|
||||
const result = deleteCompletedBatches(KEY_A);
|
||||
|
||||
assert.equal(getBatch(a.batch.id), null, "the caller's own batch should be gone");
|
||||
assert.ok(getBatch(b.batch.id), "another key's batch must survive");
|
||||
assert.equal(result.deletedBatches, 1, "must report only what it actually deleted");
|
||||
});
|
||||
|
||||
it("scoped deletion does not touch another key's file contents", () => {
|
||||
const a = seedCompletedBatch(KEY_A, "a2");
|
||||
const b = seedCompletedBatch(KEY_B, "b2");
|
||||
|
||||
deleteCompletedBatches(KEY_A);
|
||||
|
||||
assert.equal(getFile(a.file.id), null, "the caller's own file should be gone");
|
||||
assert.ok(getFile(b.file.id), "another key's file must survive with its content intact");
|
||||
});
|
||||
|
||||
it("a key with no completed batches deletes nothing at all", () => {
|
||||
const b = seedCompletedBatch(KEY_B, "b3");
|
||||
|
||||
const result = deleteCompletedBatches("key-wvxc-with-nothing");
|
||||
|
||||
assert.equal(result.deletedBatches, 0);
|
||||
assert.equal(result.deletedFiles, 0);
|
||||
assert.ok(getBatch(b.batch.id), "an unrelated key's batch must survive");
|
||||
});
|
||||
|
||||
it("unscoped (dashboard session) still clears the whole instance", () => {
|
||||
// The operator's own dashboard legitimately cleans up everything; that is
|
||||
// the ONLY caller allowed to omit the key. Preserved deliberately.
|
||||
seedCompletedBatch(KEY_A, "a4");
|
||||
seedCompletedBatch(KEY_B, "b4");
|
||||
|
||||
const result = deleteCompletedBatches();
|
||||
|
||||
assert.ok(
|
||||
result.deletedBatches >= 2,
|
||||
`expected an instance-wide sweep, got ${result.deletedBatches}`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("the route passes the caller's key through", () => {
|
||||
it("delete-completed scopes by api key instead of calling the helper bare", async () => {
|
||||
const { readFileSync } = await import("node:fs");
|
||||
const { fileURLToPath } = await import("node:url");
|
||||
const src = readFileSync(
|
||||
fileURLToPath(
|
||||
new URL("../../src/app/api/v1/batches/delete-completed/route.ts", import.meta.url)
|
||||
),
|
||||
"utf8"
|
||||
);
|
||||
assert.ok(
|
||||
!/deleteCompletedBatches\(\s*\)/.test(src),
|
||||
"the route still calls deleteCompletedBatches() with no owner — every tenant's batches go"
|
||||
);
|
||||
assert.ok(
|
||||
/deleteCompletedBatches\(\s*scope\./.test(src),
|
||||
"the route must pass the caller's scope into the helper"
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -13,11 +13,6 @@ type Check = {
|
||||
validate?: (content: string, claim?: string) => { ok: boolean; detail: string };
|
||||
};
|
||||
|
||||
/** Escape a value that is interpolated into a RegExp source. */
|
||||
function escapeRegExp(value: string): string {
|
||||
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
}
|
||||
|
||||
describe("ToS caution heading count", () => {
|
||||
it("the Caution heading carries the count the gate checks", () => {
|
||||
const txt = readFileSync(join(process.cwd(), "docs/reference/FREE_TIERS.md"), "utf8");
|
||||
@@ -26,24 +21,7 @@ describe("ToS caution heading count", () => {
|
||||
const tos = (buildChecks() as Check[]).find((c) =>
|
||||
String(c.docKey ?? "").includes("ToS caution")
|
||||
);
|
||||
// The backslashes must survive the TEMPLATE LITERAL to reach the regex.
|
||||
// Written as `\(\s*…` they did not: JS resolves `\(` to "(" and `\s` to the
|
||||
// LETTER "s" before RegExp ever sees them, so the pattern compiled to
|
||||
// `(s*16s*)` — a capture group around optional "s" characters. That matched
|
||||
// any heading merely containing the number, with no literal parentheses
|
||||
// required at all, so this guard passed on headings it was written to reject
|
||||
// (CodeQL js/useless-regexp-character-escape #994-#997).
|
||||
const count = escapeRegExp(String(tos?.actual));
|
||||
assert.match(heading, new RegExp(`\\(\\s*${count}\\s*\\)`));
|
||||
});
|
||||
|
||||
it("the heading guard actually requires the parentheses", () => {
|
||||
// Pins the defect above: the pattern this test builds must REJECT a heading
|
||||
// that carries the count without parentheses. Before the fix it accepted it.
|
||||
const pattern = new RegExp(`\\(\\s*${escapeRegExp("16")}\\s*\\)`);
|
||||
assert.equal(pattern.test("### Caution — clauses worth checking 16"), false);
|
||||
assert.equal(pattern.test("### Caution — clauses worth checking (16)"), true);
|
||||
assert.equal(pattern.test("### Caution — clauses worth checking ( 16 )"), true);
|
||||
assert.match(heading, new RegExp(`\(\s*${String(tos?.actual)}\s*\)`));
|
||||
});
|
||||
it("buildChecks exposes a soft ToS entry on FREE_TIERS.md with requireClaim", () => {
|
||||
const checks = buildChecks() as Check[];
|
||||
|
||||
@@ -8,10 +8,15 @@ const { deliverWebhook } = await import("../../src/lib/webhookDispatcher.ts");
|
||||
// called clearTimeout on the success path, so a non-timeout fetch rejection
|
||||
// (ECONNREFUSED, DNS failure, etc.) skipped clearTimeout, leaking a live 10s timer
|
||||
// + AbortController per failed delivery. The fix clears the timer in a `finally`.
|
||||
//
|
||||
// #12569: deliverWebhook now DNS-resolves and pins the connection before dispatch, so a
|
||||
// `globalThis.fetch` stub alone no longer intercepts the outbound call (the pinned fetch talks
|
||||
// to undici directly). Inject a fake `lookup` (no real DNS) and `fetchImpl` (the documented
|
||||
// escape hatch — see `WebhookDeliveryOptions`) instead, so this test stays deterministic and
|
||||
// network-free while still exercising the exact "fetch rejects" path it targets.
|
||||
test("deliverWebhook clears the abort timer even when fetch rejects", async () => {
|
||||
const realSetTimeout = globalThis.setTimeout;
|
||||
const realClearTimeout = globalThis.clearTimeout;
|
||||
const realFetch = globalThis.fetch;
|
||||
|
||||
const abortTimerIds = new Set<unknown>();
|
||||
const clearedIds = new Set<unknown>();
|
||||
@@ -26,17 +31,20 @@ test("deliverWebhook clears the abort timer even when fetch rejects", async () =
|
||||
clearedIds.add(id);
|
||||
return realClearTimeout(id);
|
||||
}) as typeof clearTimeout;
|
||||
// Non-timeout network failure — the exact path that previously skipped clearTimeout.
|
||||
globalThis.fetch = (async () => {
|
||||
throw new Error("ECONNREFUSED");
|
||||
}) as typeof fetch;
|
||||
|
||||
try {
|
||||
const res = await deliverWebhook(
|
||||
"https://example.com/webhook",
|
||||
{ event: "test.event" as any, timestamp: new Date().toISOString(), data: {} },
|
||||
null,
|
||||
0 // maxRetries=0 → single attempt, no exponential-backoff timers
|
||||
0, // maxRetries=0 → single attempt, no exponential-backoff timers
|
||||
{
|
||||
lookup: async () => [{ address: "203.0.113.5", family: 4 }],
|
||||
// Non-timeout network failure — the exact path that previously skipped clearTimeout.
|
||||
fetchImpl: async () => {
|
||||
throw new Error("ECONNREFUSED");
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
assert.equal(res.success, false, "delivery should fail when fetch rejects");
|
||||
@@ -52,6 +60,5 @@ test("deliverWebhook clears the abort timer even when fetch rejects", async () =
|
||||
} finally {
|
||||
globalThis.setTimeout = realSetTimeout;
|
||||
globalThis.clearTimeout = realClearTimeout;
|
||||
globalThis.fetch = realFetch;
|
||||
}
|
||||
});
|
||||
|
||||
135
tests/unit/webhook-dns-rebinding-ssrf-12569.test.ts
Normal file
135
tests/unit/webhook-dns-rebinding-ssrf-12569.test.ts
Normal file
@@ -0,0 +1,135 @@
|
||||
/**
|
||||
* Regression for issue #12569: the webhook outbound-URL guard
|
||||
* (`parseAndValidateWebhookUrl`, `isPrivateHost`, `isCloudMetadataHost`) classified only the
|
||||
* literal hostname STRING in the configured webhook URL. It never resolved DNS before
|
||||
* deciding a target was public, so a domain an attacker controls (DNS A record pointed at
|
||||
* 169.254.169.254 / an RFC1918 address) passed the guard, and the real `fetch()` that
|
||||
* followed resolved DNS itself and reached the internal target (DNS rebinding).
|
||||
*
|
||||
* Fixed by `fetchWebhookUrl` (`src/shared/network/webhookFetch.ts`), which resolves DNS
|
||||
* up-front, rejects any resolved answer that is cloud-metadata/private, and pins the
|
||||
* connection to the validated address (so a *second*, real DNS lookup at connect time cannot
|
||||
* rebind to a different address either).
|
||||
*
|
||||
* Run with:
|
||||
* node --import tsx/esm --test tests/unit/webhook-dns-rebinding-ssrf-12569.test.ts
|
||||
*/
|
||||
|
||||
import { describe, it, mock, after } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import dns from "node:dns";
|
||||
|
||||
import { deliverWebhook } from "../../src/lib/webhookDispatcher.ts";
|
||||
|
||||
const REBOUND_HOSTNAME = "evil.example.com";
|
||||
const IMDS_ADDRESS = "169.254.169.254";
|
||||
|
||||
const originalLookup = dns.promises.lookup;
|
||||
mock.method(
|
||||
dns.promises,
|
||||
"lookup",
|
||||
async (hostname: string): Promise<dns.LookupAddress[]> => {
|
||||
if (hostname === REBOUND_HOSTNAME) {
|
||||
return [{ address: IMDS_ADDRESS, family: 4 }];
|
||||
}
|
||||
return originalLookup(hostname, { all: true });
|
||||
}
|
||||
);
|
||||
|
||||
after(() => {
|
||||
mock.restoreAll();
|
||||
});
|
||||
|
||||
describe("#12569 — webhook outbound guard is hostname-string-only (DNS rebinding)", () => {
|
||||
it("does NOT let a hostname that resolves to the cloud-metadata IP reach fetch()", async () => {
|
||||
const fetchCalls: string[] = [];
|
||||
const originalFetch = globalThis.fetch;
|
||||
// @ts-expect-error - stubbing global fetch for the probe
|
||||
globalThis.fetch = async (input: string) => {
|
||||
fetchCalls.push(String(input));
|
||||
return new Response("ok", { status: 200 });
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await deliverWebhook(
|
||||
`http://${REBOUND_HOSTNAME}/hook`,
|
||||
{ event: "test.ping", timestamp: new Date().toISOString(), data: {} },
|
||||
"secret"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
fetchCalls.length,
|
||||
0,
|
||||
`guard should have blocked dispatch to a hostname resolving to ${IMDS_ADDRESS}, ` +
|
||||
`but fetch() was called with: ${JSON.stringify(fetchCalls)}`
|
||||
);
|
||||
assert.equal(res.success, false);
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
}
|
||||
});
|
||||
|
||||
it("blocks a hostname that resolves to an RFC1918 address, without retrying", async () => {
|
||||
const start = Date.now();
|
||||
const res = await deliverWebhook(
|
||||
"http://rebind-to-lan.example.com/hook",
|
||||
{ event: "test.ping", timestamp: new Date().toISOString(), data: {} },
|
||||
null,
|
||||
3,
|
||||
{ lookup: async () => [{ address: "10.1.2.3", family: 4 }] }
|
||||
);
|
||||
const elapsedMs = Date.now() - start;
|
||||
|
||||
assert.equal(res.success, false);
|
||||
assert.ok(
|
||||
typeof res.error === "string" && /private|blocked|local/i.test(res.error),
|
||||
`expected guard error, got: ${res.error}`
|
||||
);
|
||||
// A guard-blocked verdict must fail fast — no exponential-backoff retries (1s+2s+4s) for
|
||||
// something that will keep resolving the same way.
|
||||
assert.ok(elapsedMs < 900, `blocked delivery must not retry with backoff (took ${elapsedMs}ms)`);
|
||||
});
|
||||
|
||||
it("blocks when any of several resolved addresses is private (multi-A trick)", async () => {
|
||||
const fetchCalls: string[] = [];
|
||||
const res = await deliverWebhook(
|
||||
"http://multi-answer.example.com/hook",
|
||||
{ event: "test.ping", timestamp: new Date().toISOString(), data: {} },
|
||||
null,
|
||||
0,
|
||||
{
|
||||
lookup: async () => [
|
||||
{ address: "203.0.113.5", family: 4 },
|
||||
{ address: "169.254.169.254", family: 4 },
|
||||
],
|
||||
fetchImpl: async (input: string | URL) => {
|
||||
fetchCalls.push(String(input));
|
||||
return new Response("ok", { status: 200 });
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
assert.equal(res.success, false);
|
||||
assert.equal(fetchCalls.length, 0, "fetch must never fire when any resolved IP is blocked");
|
||||
});
|
||||
|
||||
it("allows a hostname that resolves only to public addresses", async () => {
|
||||
const fetchCalls: string[] = [];
|
||||
const res = await deliverWebhook(
|
||||
"http://public-looking.example.com/hook",
|
||||
{ event: "test.ping", timestamp: new Date().toISOString(), data: {} },
|
||||
null,
|
||||
0,
|
||||
{
|
||||
lookup: async () => [{ address: "203.0.113.5", family: 4 }],
|
||||
fetchImpl: async (input: string | URL) => {
|
||||
fetchCalls.push(String(input));
|
||||
return new Response("ok", { status: 200 });
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
assert.equal(res.success, true);
|
||||
assert.equal(fetchCalls.length, 1);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user