Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: validate ports/database/brainDigest/telegram/provider route bodies with Zod (#2521)

Adam Eivy16d001f054ab
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index cafbaf7230..6c3ee5f7d1 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -12,3 +12,7 @@
- **[issue-2510] MidiPianoRoll: clear the stale hover overlay when the transcription data changes.** The piano-roll kept its hovered note/chord identity (objects from the previous parse) when the `data`/`chords` props swapped on a mounted instance, so a re-transcription or Retry while a hover was active and the pointer sat still would keep stroking the old note at coordinates mapped into the new file until the next pointer move or Escape. A `useEffect` now drops the hover identity whenever `data`/`chords` change.
- **[issue-2513] Block loopback/metadata hosts in Layered Intelligence custom `http` sources.** `fetchHttpSource` used a bare `fetch` with only an `http(s)` scheme check, so a hand-edited config could point a custom source at `127.0.0.1`, `169.254.169.254`, or `metadata.google.internal` and exfiltrate up to 8KB into the reasoner prompt. It now routes through the shared SSRF-guarded `fetchPublicText` (default posture): loopback, link-local, and cloud-metadata hosts are blocked and redirects are revalidated, while LAN/Tailscale hosts stay intentionally allowed for this single-user tool.
- **[issue-2516] Database sync: remove shell interpolation from the dump import.** The active→inactive backend sync built a `bash -c "sed … \"${dumpFile}\" | psql … -U ${pgUser} -d ${pgDb}"` string that interpolated the dump path, port, user, and database name into a shell command — any shell metacharacter in those values (env-derived or surfacing from the export pipeline) was injectable into `psql`. The import now streams the dump through `spawn('psql', argv)` with no shell: the dump is read and piped to psql's stdin, and the pg17-only directives (`\restrict`/`\unrestrict`/`SET transaction_timeout`) the old `sed` stage stripped are filtered in-process. No user- or env-derived value ever reaches a shell string.
+
+## Changed
+
+- **[issue-2521] Validate the remaining ad-hoc route bodies with Zod `validateRequest`.** The ports (`/check`, `/allocate`), database (`switch`/`start`/`stop`/`destroy`/`export`), brain digest/review run, telegram `forward-types`, and AI-toolkit provider (`POST`/`PUT`/`PUT active`) routes parsed `req.body` with hand-rolled `Array.isArray`/`includes` checks. Each now has a named Zod schema (PortOS schemas in `lib/validation.js`, provider schemas in `aiToolkit/validation.js`) wired through `validateRequest`, so invalid bodies return a consistent `400 VALIDATION_ERROR` with per-field `context.details` instead of ad-hoc messages. Port numbers are range-checked, backend/target values are enum-checked, and provider create/update reuse the canonical `providerSchema` (`.partial()` on update).
diff --git a/server/lib/aiToolkit/routes/providers.js b/server/lib/aiToolkit/routes/providers.js
index 88ec1dcb01..ba2a19e6eb 100644
--- a/server/lib/aiToolkit/routes/providers.js
+++ b/server/lib/aiToolkit/routes/providers.js
@@ -1,5 +1,6 @@
import { Router } from 'express';
import { ToolkitHttpError, defaultAsyncHandler } from '../internal/httpError.js';
+import { providerSchema, providerActiveSchema, validate } from '../validation.js';
export function createProvidersRoutes(providerService, options = {}) {
const router = Router();
@@ -20,10 +21,11 @@ export function createProvidersRoutes(providerService, options = {}) {
}));
router.put('/active', asyncHandler(async (req, res) => {
- const { id } = req.body;
- if (!id) {
- throw new ServerError('Provider ID required', { status: 400 });
+ const result = validate(providerActiveSchema, req.body);
+ if (!result.success) {
+ throw new ServerError('Provider ID required', { status: 400, code: 'VALIDATION_ERROR', context: { details: result.errors } });
}
+ const { id } = result.data;
const provider = await providerService.setActiveProvider(id);
@@ -50,22 +52,24 @@ export function createProvidersRoutes(providerService, options = {}) {
}));
router.post('/', asyncHandler(async (req, res) => {
- const { name, type } = req.body;
-
- if (!name) {
- throw new ServerError('Name is required', { status: 400 });
- }
-
- if (!type || !['cli', 'api', 'tui'].includes(type)) {
- throw new ServerError('Type must be "cli", "api", or "tui"', { status: 400 });
+ const result = validate(providerSchema, req.body);
+ if (!result.success) {
+ throw new ServerError('Invalid provider data', { status: 400, code: 'VALIDATION_ERROR', context: { details: result.errors } });
}
- const provider = await providerService.createProvider(req.body);
+ const provider = await providerService.createProvider(result.data);
res.status(201).json(provider);
}));
router.put('/:id', asyncHandler(async (req, res) => {
- const provider = await providerService.updateProvider(req.params.id, req.body);
+ // Partial: a PUT may touch a single field; unknown keys are stripped so only
+ // the canonical provider shape reaches updateProvider's spread.
+ const result = validate(providerSchema.partial(), req.body);
+ if (!result.success) {
+ throw new ServerError('Invalid provider data', { status: 400, code: 'VALIDATION_ERROR', context: { details: result.errors } });
+ }
+
+ const provider = await providerService.updateProvider(req.params.id, result.data);
if (!provider) {
throw new ServerError('Provider not found', { status: 404 });
diff --git a/server/lib/aiToolkit/validation.js b/server/lib/aiToolkit/validation.js
index adbabcdb9b..76c377b03f 100644
--- a/server/lib/aiToolkit/validation.js
+++ b/server/lib/aiToolkit/validation.js
@@ -98,6 +98,11 @@ export const providerSchema = z.object({
tuiMaxRuntimeMs: z.number().int().min(60000).max(43200000).optional()
});
+// PUT /api/providers/active — set the active provider by id.
+export const providerActiveSchema = z.object({
+ id: z.string().min(1)
+});
+
export const runSchema = z.object({
// `type` defaults to 'ai' so the common case (AI run via /api/runs from
// RunnerPage / AIProviders / etc.) doesn't have to send it explicitly.
diff --git a/server/lib/aiToolkit/validation.test.js b/server/lib/aiToolkit/validation.test.js
index e276a9c5f3..d2df094adf 100644
--- a/server/lib/aiToolkit/validation.test.js
+++ b/server/lib/aiToolkit/validation.test.js
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
-import { sanitizeScreenshotRefs, providerSchema, validate } from './validation.js';
+import { sanitizeScreenshotRefs, providerSchema, providerActiveSchema, validate } from './validation.js';
describe('sanitizeScreenshotRefs — POST /api/runs screenshot hardening (#1870)', () => {
it('keeps an in-dir image basename unchanged', () => {
@@ -180,3 +180,21 @@ describe('validate', () => {
expect(result.errors.some(e => e.path === 'models.0')).toBe(true);
});
});
+
+describe('providerActiveSchema — PUT /api/providers/active (#2521)', () => {
+ it('requires a non-empty id', () => {
+ expect(validate(providerActiveSchema, { id: 'codex' }).success).toBe(true);
+ expect(validate(providerActiveSchema, { id: '' }).success).toBe(false);
+ expect(validate(providerActiveSchema, {}).success).toBe(false);
+ expect(validate(providerActiveSchema, { id: 5 }).success).toBe(false);
+ });
+});
+
+describe('providerSchema.partial() — PUT /api/providers/:id (#2521)', () => {
+ it('accepts a single-field update and rejects a bad enum/type', () => {
+ expect(validate(providerSchema.partial(), { defaultModel: 'gpt-5' }).success).toBe(true);
+ expect(validate(providerSchema.partial(), {}).success).toBe(true);
+ expect(validate(providerSchema.partial(), { type: 'magic' }).success).toBe(false);
+ expect(validate(providerSchema.partial(), { timeout: 'soon' }).success).toBe(false);
+ });
+});
diff --git a/server/lib/telegramValidation.js b/server/lib/telegramValidation.js
index fc72f90e70..b2e6b8f010 100644
--- a/server/lib/telegramValidation.js
+++ b/server/lib/telegramValidation.js
@@ -12,3 +12,9 @@ export const telegramTestSchema = z.object({
export const telegramMethodSchema = z.object({
method: z.enum(['manual', 'mcp-bridge'])
});
+
+// PUT /api/telegram/forward-types — the set of notification types forwarded to
+// Telegram. An array of type-name strings (empty array clears all forwarding).
+export const telegramForwardTypesSchema = z.object({
+ forwardTypes: z.array(z.string())
+});
diff --git a/server/lib/validation.js b/server/lib/validation.js
index f0c0f0d502..21697cf150 100644
--- a/server/lib/validation.js
+++ b/server/lib/validation.js
@@ -662,6 +662,57 @@ export const usageMessagesSchema = z.object({
inputTokenCount: z.number().int().nonnegative().optional().default(0)
});
+// =============================================================================
+// PORTS
+// =============================================================================
+
+// POST /api/ports/check — probe a set of ports for availability.
+export const portsCheckSchema = z.object({
+ ports: z.array(z.number().int().min(1).max(65535)).min(1)
+});
+
+// POST /api/ports/allocate — reserve N free ports. `count` is coerced (the UI
+// may send a string) and defaults to 1 when absent, matching the prior
+// `parseInt(count) || 1` behavior — but non-numeric garbage now 400s instead of
+// silently collapsing to 1.
+export const portsAllocateSchema = z.object({
+ count: z.coerce.number().int().min(1).max(10).default(1)
+});
+
+// =============================================================================
+// DATABASE
+// =============================================================================
+
+const DB_BACKENDS = ['docker', 'native'];
+
+// POST /api/database/switch — switch active backend, optionally migrating data.
+export const databaseSwitchSchema = z.object({
+ target: z.enum(DB_BACKENDS),
+ migrate: z.boolean().optional()
+});
+
+// POST /api/database/{start,stop,destroy} — operate on a named backend.
+export const databaseBackendSchema = z.object({
+ backend: z.enum(DB_BACKENDS)
+});
+
+// POST /api/database/export — export from a specific backend, or (when omitted)
+// the active backend.
+export const databaseExportSchema = z.object({
+ backend: z.enum(DB_BACKENDS).optional()
+});
+
+// =============================================================================
+// BRAIN DIGEST / REVIEW
+// =============================================================================
+
+// POST /api/brain/{digest,review}/run — manual trigger with optional provider /
+// model overrides.
+export const brainDigestRunSchema = z.object({
+ providerOverride: z.string().optional(),
+ modelOverride: z.string().optional()
+});
+
/**
* Validate data against a Zod schema, throwing on failure.
* Returns parsed data on success, throws ServerError on failure.
diff --git a/server/lib/validation.test.js b/server/lib/validation.test.js
index 6bd9a69f83..201731e2e3 100644
--- a/server/lib/validation.test.js
+++ b/server/lib/validation.test.js
@@ -33,7 +33,16 @@ import {
isPaginationRequested,
paginateArray,
seriesAutopilotSettingsSchema,
+ portsCheckSchema,
+ portsAllocateSchema,
+ databaseSwitchSchema,
+ databaseBackendSchema,
+ databaseExportSchema,
+ brainDigestRunSchema,
} from './validation.js';
+import {
+ telegramForwardTypesSchema,
+} from './telegramValidation.js';
describe('validation.js', () => {
describe('isPaginationRequested', () => {
@@ -1356,3 +1365,73 @@ describe('seriesAutopilotSettingsSchema (#2174)', () => {
expect(parsed.schedules[0]).toEqual({ seriesId: 's1', cron: '0 3 * * *', enabled: false });
});
});
+
+describe('ad-hoc route schemas (#2521)', () => {
+ describe('portsCheckSchema', () => {
+ it('accepts a non-empty array of port numbers', () => {
+ expect(portsCheckSchema.safeParse({ ports: [3000, 8080] }).success).toBe(true);
+ });
+ it('rejects an empty array, non-array, and out-of-range/non-integer ports', () => {
+ expect(portsCheckSchema.safeParse({ ports: [] }).success).toBe(false);
+ expect(portsCheckSchema.safeParse({ ports: 'x' }).success).toBe(false);
+ expect(portsCheckSchema.safeParse({ ports: [0] }).success).toBe(false);
+ expect(portsCheckSchema.safeParse({ ports: [70000] }).success).toBe(false);
+ expect(portsCheckSchema.safeParse({ ports: [3000.5] }).success).toBe(false);
+ });
+ });
+
+ describe('portsAllocateSchema', () => {
+ it('defaults count to 1 when absent and coerces numeric strings', () => {
+ expect(portsAllocateSchema.parse({})).toEqual({ count: 1 });
+ expect(portsAllocateSchema.parse({ count: '5' })).toEqual({ count: 5 });
+ });
+ it('rejects out-of-range counts and non-numeric garbage', () => {
+ expect(portsAllocateSchema.safeParse({ count: 0 }).success).toBe(false);
+ expect(portsAllocateSchema.safeParse({ count: 11 }).success).toBe(false);
+ expect(portsAllocateSchema.safeParse({ count: 'abc' }).success).toBe(false);
+ });
+ });
+
+ describe('database schemas', () => {
+ it('databaseSwitchSchema accepts valid backends + optional migrate, rejects others', () => {
+ expect(databaseSwitchSchema.safeParse({ target: 'docker' }).success).toBe(true);
+ expect(databaseSwitchSchema.safeParse({ target: 'native', migrate: true }).success).toBe(true);
+ expect(databaseSwitchSchema.safeParse({ target: 'sqlite' }).success).toBe(false);
+ expect(databaseSwitchSchema.safeParse({}).success).toBe(false);
+ expect(databaseSwitchSchema.safeParse({ target: 'docker', migrate: 'yes' }).success).toBe(false);
+ });
+ it('databaseBackendSchema requires a valid backend enum', () => {
+ expect(databaseBackendSchema.safeParse({ backend: 'docker' }).success).toBe(true);
+ expect(databaseBackendSchema.safeParse({ backend: 'native' }).success).toBe(true);
+ expect(databaseBackendSchema.safeParse({ backend: 'mysql' }).success).toBe(false);
+ expect(databaseBackendSchema.safeParse({}).success).toBe(false);
+ });
+ it('databaseExportSchema allows an absent backend but rejects an invalid one', () => {
+ expect(databaseExportSchema.safeParse({}).success).toBe(true);
+ expect(databaseExportSchema.safeParse({ backend: 'native' }).success).toBe(true);
+ expect(databaseExportSchema.safeParse({ backend: 'oracle' }).success).toBe(false);
+ });
+ });
+
+ describe('brainDigestRunSchema', () => {
+ it('accepts empty body and optional string overrides', () => {
+ expect(brainDigestRunSchema.safeParse({}).success).toBe(true);
+ expect(brainDigestRunSchema.safeParse({ providerOverride: 'p', modelOverride: 'm' }).success).toBe(true);
+ });
+ it('rejects non-string overrides', () => {
+ expect(brainDigestRunSchema.safeParse({ providerOverride: 5 }).success).toBe(false);
+ });
+ });
+
+ describe('telegramForwardTypesSchema', () => {
+ it('accepts a string array (including empty to clear all)', () => {
+ expect(telegramForwardTypesSchema.safeParse({ forwardTypes: [] }).success).toBe(true);
+ expect(telegramForwardTypesSchema.safeParse({ forwardTypes: ['digest', 'inbox'] }).success).toBe(true);
+ });
+ it('rejects a non-array or non-string elements', () => {
+ expect(telegramForwardTypesSchema.safeParse({ forwardTypes: 'digest' }).success).toBe(false);
+ expect(telegramForwardTypesSchema.safeParse({ forwardTypes: [1, 2] }).success).toBe(false);
+ expect(telegramForwardTypesSchema.safeParse({}).success).toBe(false);
+ });
+ });
+});
diff --git a/server/routes/brainDigest.js b/server/routes/brainDigest.js
index 4ece4f273d..f6bb949865 100644
--- a/server/routes/brainDigest.js
+++ b/server/routes/brainDigest.js
@@ -7,6 +7,7 @@
import { Router } from 'express';
import * as brainService from '../services/brain.js';
import { asyncHandler } from '../lib/errorHandler.js';
+import { validateRequest, brainDigestRunSchema } from '../lib/validation.js';
const router = Router();
@@ -34,7 +35,7 @@ router.get('/digests', asyncHandler(async (req, res) => {
* Manually trigger daily digest generation
*/
router.post('/digest/run', asyncHandler(async (req, res) => {
- const { providerOverride, modelOverride } = req.body || {};
+ const { providerOverride, modelOverride } = validateRequest(brainDigestRunSchema, req.body || {});
const digest = await brainService.runDailyDigest(providerOverride, modelOverride);
res.json(digest);
}));
@@ -63,7 +64,7 @@ router.get('/reviews', asyncHandler(async (req, res) => {
* Manually trigger weekly review generation
*/
router.post('/review/run', asyncHandler(async (req, res) => {
- const { providerOverride, modelOverride } = req.body || {};
+ const { providerOverride, modelOverride } = validateRequest(brainDigestRunSchema, req.body || {});
const review = await brainService.runWeeklyReview(providerOverride, modelOverride);
res.json(review);
}));
diff --git a/server/routes/database.js b/server/routes/database.js
index 4592bef70b..03df2e3ae3 100644
--- a/server/routes/database.js
+++ b/server/routes/database.js
@@ -3,6 +3,7 @@ import { execFile, spawn } from 'child_process';
import { existsSync, mkdirSync, createReadStream } from 'fs';
import { join } from 'path';
import { asyncHandler, ServerError } from '../lib/errorHandler.js';
+import { validateRequest, databaseSwitchSchema, databaseBackendSchema, databaseExportSchema } from '../lib/validation.js';
import { checkHealth, query } from '../lib/db.js';
import { PATHS } from '../lib/fileUtils.js';
import { resolvePgDumpBinary } from '../lib/pgTools.js';
@@ -217,10 +218,7 @@ router.get('/status', asyncHandler(async (req, res) => {
// POST /api/database/switch — switch mode and optionally migrate
router.post('/switch', asyncHandler(async (req, res) => {
- const { target, migrate } = req.body;
- if (!target || !['docker', 'native'].includes(target)) {
- throw new ServerError('target must be "docker" or "native"', { status: 400 });
- }
+ const { target, migrate } = validateRequest(databaseSwitchSchema, req.body);
const io = req.app.get('io');
const emit = (event, data) => io?.emit('database:progress', { event, ...data });
@@ -505,10 +503,7 @@ router.post('/sync', asyncHandler(async (req, res) => {
// POST /api/database/start — start a specific backend
router.post('/start', asyncHandler(async (req, res) => {
- const { backend } = req.body;
- if (!backend || !['docker', 'native'].includes(backend)) {
- throw new ServerError('backend must be "docker" or "native"', { status: 400 });
- }
+ const { backend } = validateRequest(databaseBackendSchema, req.body);
if (backend === 'docker') {
const result = await runCmd('docker', ['compose', 'up', '-d', 'db'], 60_000);
@@ -522,10 +517,7 @@ router.post('/start', asyncHandler(async (req, res) => {
// POST /api/database/stop — stop the non-active backend
router.post('/stop', asyncHandler(async (req, res) => {
- const { backend } = req.body;
- if (!backend || !['docker', 'native'].includes(backend)) {
- throw new ServerError('backend must be "docker" or "native"', { status: 400 });
- }
+ const { backend } = validateRequest(databaseBackendSchema, req.body);
if (backend === 'docker') {
const result = await runCmd('docker', ['compose', 'stop', 'db'], 30_000);
@@ -539,10 +531,7 @@ router.post('/stop', asyncHandler(async (req, res) => {
// POST /api/database/destroy — destroy the non-active backend's data
router.post('/destroy', asyncHandler(async (req, res) => {
- const { backend } = req.body;
- if (!backend || !['docker', 'native'].includes(backend)) {
- throw new ServerError('backend must be "docker" or "native"', { status: 400 });
- }
+ const { backend } = validateRequest(databaseBackendSchema, req.body);
// Safety: don't destroy the active backend
const statusResult = await runDbScript(['status']);
@@ -593,10 +582,10 @@ router.post('/setup-native', asyncHandler(async (req, res) => {
// Optional body.backend: 'docker' | 'native' to export from a specific backend
// Default: exports from the active backend
router.post('/export', asyncHandler(async (req, res) => {
- const { backend } = req.body || {};
+ const { backend } = validateRequest(databaseExportSchema, req.body || {});
const label = `backup-${Date.now()}`;
- if (backend && ['docker', 'native'].includes(backend)) {
+ if (backend) {
// Export from a specific backend by connecting directly to its port
const port = backend === 'docker' ? DOCKER_PORT : NATIVE_PORT;
const env = pgEnv(port);
diff --git a/server/routes/database.test.js b/server/routes/database.test.js
index 97e60c5518..57df27d90f 100644
--- a/server/routes/database.test.js
+++ b/server/routes/database.test.js
@@ -222,7 +222,8 @@ describe('POST /api/database/destroy', () => {
const app = makeApp();
const res = await request(app).post('/api/database/destroy').send({});
expect(res.status).toBe(400);
- expect(res.body.error).toMatch(/backend/i);
+ expect(res.body.code).toBe('VALIDATION_ERROR');
+ expect(res.body.context.details.some((d) => d.path === 'backend')).toBe(true);
});
it('returns 400 when backend is an unknown value', async () => {
@@ -231,7 +232,8 @@ describe('POST /api/database/destroy', () => {
.post('/api/database/destroy')
.send({ backend: 'mysql' });
expect(res.status).toBe(400);
- expect(res.body.error).toMatch(/docker.*native|native.*docker/i);
+ expect(res.body.code).toBe('VALIDATION_ERROR');
+ expect(res.body.context.details.some((d) => d.path === 'backend')).toBe(true);
});
it('returns 400 when backend is null', async () => {
diff --git a/server/routes/ports.js b/server/routes/ports.js
index 872a561e2d..c5eca52cd3 100644
--- a/server/routes/ports.js
+++ b/server/routes/ports.js
@@ -1,6 +1,7 @@
import { Router } from 'express';
import * as portsService from '../services/ports.js';
-import { asyncHandler, ServerError } from '../lib/errorHandler.js';
+import { asyncHandler } from '../lib/errorHandler.js';
+import { validateRequest, portsCheckSchema, portsAllocateSchema } from '../lib/validation.js';
const router = Router();
@@ -12,30 +13,14 @@ router.get('/scan', asyncHandler(async (req, res) => {
// POST /api/ports/check - Check if specific ports are available
router.post('/check', asyncHandler(async (req, res) => {
- const { ports } = req.body;
-
- if (!Array.isArray(ports) || ports.length === 0) {
- throw new ServerError('ports must be a non-empty array of numbers', {
- status: 400,
- code: 'VALIDATION_ERROR'
- });
- }
-
+ const { ports } = validateRequest(portsCheckSchema, req.body);
const results = await portsService.checkPortsAvailable(ports);
res.json(results);
}));
// POST /api/ports/allocate - Allocate available ports
router.post('/allocate', asyncHandler(async (req, res) => {
- const count = parseInt(req.body.count, 10) || 1;
-
- if (count < 1 || count > 10) {
- throw new ServerError('count must be between 1 and 10', {
- status: 400,
- code: 'VALIDATION_ERROR'
- });
- }
-
+ const { count } = validateRequest(portsAllocateSchema, req.body);
const ports = await portsService.allocatePorts(count);
res.json({ allocated: ports });
}));
diff --git a/server/routes/telegram.js b/server/routes/telegram.js
index 27ec4ba42a..10496a92fc 100644
--- a/server/routes/telegram.js
+++ b/server/routes/telegram.js
@@ -1,6 +1,7 @@
import { Router } from 'express';
import { asyncHandler, ServerError } from '../lib/errorHandler.js';
-import { telegramConfigSchema, telegramTestSchema, telegramMethodSchema } from '../lib/telegramValidation.js';
+import { validateRequest } from '../lib/validation.js';
+import { telegramConfigSchema, telegramTestSchema, telegramMethodSchema, telegramForwardTypesSchema } from '../lib/telegramValidation.js';
import { getSettings, updateSettingsWith } from '../services/settings.js';
import * as telegram from '../services/telegram.js';
import * as telegramBridge from '../services/telegramBridge.js';
@@ -193,13 +194,7 @@ router.post('/test', asyncHandler(async (req, res) => {
// PUT /api/telegram/forward-types
router.put('/forward-types', asyncHandler(async (req, res) => {
- const { forwardTypes } = req.body;
- if (!Array.isArray(forwardTypes)) {
- throw new ServerError('forwardTypes must be an array', {
- status: 400,
- code: 'VALIDATION_ERROR'
- });
- }
+ const { forwardTypes } = validateRequest(telegramForwardTypesSchema, req.body);
await updateSettingsWith((current) => ({
...current,