mastercontroller 1.3.20 → 1.3.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -650,6 +650,8 @@ function handleRoutingError(requestPath, routes = [], errorContext = null) {
650
650
  */
651
651
  function findSimilarRoutes(requestPath, routes) {
652
652
  if (!routes || routes.length === 0) return [];
653
+ // Skip similarity search for long/malicious paths — they won't match any route
654
+ if (!requestPath || requestPath.length > 200) return [];
653
655
 
654
656
  const { levenshteinDistance } = require('./MasterErrorHandler');
655
657
 
@@ -75,6 +75,9 @@ const ERROR_CODES = {
75
75
  * Levenshtein distance for "Did you mean?" suggestions
76
76
  */
77
77
  function levenshteinDistance(str1, str2) {
78
+ // Guard against non-strings (objects, regex, undefined) and extremely long paths
79
+ if (typeof str1 !== 'string' || typeof str2 !== 'string') return Infinity;
80
+ if (str1.length > 200 || str2.length > 200) return Infinity;
78
81
  const len1 = str1.length;
79
82
  const len2 = str2.length;
80
83
  const matrix = Array(len1 + 1).fill(null).map(() => Array(len2 + 1).fill(0));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mastercontroller",
3
- "version": "1.3.20",
3
+ "version": "1.3.22",
4
4
  "description": "Fortune 500 ready Node.js MVC framework with enterprise security, monitoring, and horizontal scaling",
5
5
  "main": "MasterControl.js",
6
6
  "license": "MIT",