From 13d1f83a85e0cfd35a899db92dfc7effd5bd86bc Mon Sep 17 00:00:00 2001 From: znetsixe Date: Wed, 1 Apr 2026 08:44:48 +0200 Subject: [PATCH] fix: prevent infinite recursion in validateSchema for non-object schema entries migrateConfig stamps a version string into config schemas. validateSchema then iterates the string's character indices, causing infinite recursion. Skip the 'version' key and guard against any non-object schema entries. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/helper/validationUtils.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/helper/validationUtils.js b/src/helper/validationUtils.js index 265e797..8e1111c 100644 --- a/src/helper/validationUtils.js +++ b/src/helper/validationUtils.js @@ -95,11 +95,19 @@ class ValidationUtils { // Validate each key in the schema and loop over wildcards if they are not in schema for ( const key in schema ) { - if (key === "rules" || key === "description" || key === "schema") { + if (key === "rules" || key === "description" || key === "schema" || key === "version") { continue; } const fieldSchema = schema[key]; + + // Skip non-object schema entries (e.g. primitive values injected by migration) + if (fieldSchema === null || typeof fieldSchema !== 'object') { + this.logger.debug(`${name}.${key} has a non-object schema entry (${typeof fieldSchema}). Skipping.`); + validatedConfig[key] = fieldSchema; + continue; + } + const { rules = {} } = fieldSchema; // Default to the schema's default value if the key is missing