fix: harden _cnd operators and add edge case tests

- Add try/catch for invalid regex patterns in regex operator
- Add structure validation for between operator (from/to fields)
- Add 5 new edge case tests for invalid inputs
- Bump version to 2.30.1
- Resolve merge conflict with main (n8n 2.0 update)

Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Romuald Członkowski
2025-12-17 16:52:04 +01:00
parent 68bc5744dc
commit fa89d2f18e
6 changed files with 77 additions and 6 deletions

View File

@@ -98,7 +98,11 @@ class ConfigValidator {
if ('lt' in cnd)
return configValue < cnd.lt;
if ('between' in cnd) {
return configValue >= cnd.between.from && configValue <= cnd.between.to;
const between = cnd.between;
if (!between || typeof between.from === 'undefined' || typeof between.to === 'undefined') {
return false;
}
return configValue >= between.from && configValue <= between.to;
}
if ('startsWith' in cnd) {
return typeof configValue === 'string' && configValue.startsWith(cnd.startsWith);
@@ -110,7 +114,14 @@ class ConfigValidator {
return typeof configValue === 'string' && configValue.includes(cnd.includes);
}
if ('regex' in cnd) {
return typeof configValue === 'string' && new RegExp(cnd.regex).test(configValue);
if (typeof configValue !== 'string')
return false;
try {
return new RegExp(cnd.regex).test(configValue);
}
catch {
return false;
}
}
if ('exists' in cnd) {
return configValue !== undefined && configValue !== null;