qumra-engine 2.0.159 → 2.0.161

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.
@@ -69,14 +69,14 @@ const prepareDataMiddleware = (req, res, next) => {
69
69
  if (parsedUrl.host !== expectedHost &&
70
70
  !currentUrl.includes("localhost")) {
71
71
  // redirect to expected host
72
- return res.redirect(301, `${backendUrl}${parsedUrl.pathname}`);
72
+ return res.redirect(307, `${backendUrl}${parsedUrl.pathname}`);
73
73
  }
74
74
  }
75
75
  res.locals.render = engineResponse.data?.data;
76
76
  next();
77
77
  })
78
78
  .catch((err) => {
79
- console.log("❌ prepareDataMiddleware error:", err);
79
+ console.log("❌ prepareDataMiddleware error:", err.message);
80
80
  next(err);
81
81
  });
82
82
  };
@@ -2,7 +2,38 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isPathAllowedToRender = void 0;
4
4
  const isPathAllowedToRender = (filePath) => {
5
- // نتاكد إنه مفيهوش امتداد
6
- return !/\.[a-z0-9]+$/i.test(filePath);
5
+ const lower = filePath.toLowerCase();
6
+ // ❌ ممنوع أي امتداد (html/js/php/…)
7
+ if (/\.[a-z0-9]+$/i.test(lower))
8
+ return false;
9
+ // ❌ امتدادات خطيرة للبوتات والهكر
10
+ if (/\.(php|php5|php7|phtml|phar)$/i.test(lower))
11
+ return false;
12
+ // ❌ مسارات مشهورة للهجمات
13
+ const blockedPaths = [
14
+ "wp-admin",
15
+ "wp-login",
16
+ "xmlrpc",
17
+ ".env",
18
+ "config",
19
+ "config.php",
20
+ "adminer",
21
+ "vendor",
22
+ "composer.json",
23
+ "composer.lock",
24
+ "shell",
25
+ "id_rsa",
26
+ "login",
27
+ "phpinfo",
28
+ "server-status",
29
+ "cgi-bin",
30
+ "backup",
31
+ "backups",
32
+ "dump",
33
+ "database",
34
+ ];
35
+ if (blockedPaths.some(p => lower.includes(p)))
36
+ return false;
37
+ return true;
7
38
  };
8
39
  exports.isPathAllowedToRender = isPathAllowedToRender;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qumra-engine",
3
- "version": "2.0.159",
3
+ "version": "2.0.161",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {