mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-02-06 13:33:11 +00:00
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:
15
dist/services/config-validator.js
vendored
15
dist/services/config-validator.js
vendored
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user