@wxn0brp/falcon-frame 0.8.0 → 0.8.1

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.
Files changed (2) hide show
  1. package/dist/helpers.js +6 -1
  2. package/package.json +2 -2
package/dist/helpers.js CHANGED
@@ -72,7 +72,12 @@ export function handleStaticFiles(dirPath, opts) {
72
72
  if (req.method.toLowerCase() !== "get")
73
73
  return next();
74
74
  const apiPath = req.middleware.path;
75
- const filePath = path.join(dirPath, req.path.replace(apiPath, ""));
75
+ const unsafePath = req.path.replace(apiPath, "");
76
+ const filePath = path.join(dirPath, path.normalize(unsafePath));
77
+ const resolvedPath = path.resolve(filePath);
78
+ const resolvedDir = path.resolve(dirPath);
79
+ if (!resolvedPath.startsWith(resolvedDir))
80
+ return next();
76
81
  try {
77
82
  const stats = fs.statSync(filePath);
78
83
  if (stats.isFile()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/falcon-frame",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "wxn0brP",
@@ -26,7 +26,7 @@
26
26
  "devDependencies": {
27
27
  "@types/node": "*",
28
28
  "tsc-alias": "*",
29
- "typescript": "*"
29
+ "typescript": "^6"
30
30
  },
31
31
  "dependencies": {
32
32
  "@wxn0brp/lucerna-log": "^0.2.2"