fix: add input validation, Zod schemas, rate limiting, and IP trust

- Add Zod schema for webhook response parsing (orchestrator.ts)
- Add Zod schemas for POST /respond and /react request bodies
- Add safe integer validation for batch count param
- Prefer cf-connecting-ip over spoofable x-forwarded-for
- Add ID format validation on URL params
- Add rate limiting on /auth/login (30/min) and /update (10/min)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-09 07:30:49 +00:00
co-authored by Claude Opus 4.6
parent 276cbd6e31
commit 5bfb63aa7f
6 changed files with 68 additions and 23 deletions
+8
View File
@@ -87,6 +87,9 @@ importers:
nostr-tools:
specifier: ^2.23.3
version: 2.23.3(typescript@5.9.3)
zod:
specifier: ^4.3.6
version: 4.3.6
devDependencies:
'@types/better-sqlite3':
specifier: ^7.6.13
@@ -3385,6 +3388,9 @@ packages:
resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==}
engines: {node: '>=12'}
zod@4.3.6:
resolution: {integrity: sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==}
snapshots:
'@apideck/better-ajv-errors@0.3.6(ajv@8.18.0)':
@@ -6708,3 +6714,5 @@ snapshots:
string-width: 4.2.3
y18n: 5.0.8
yargs-parser: 21.1.1
zod@4.3.6: {}