@jeffusion/bungee 4.5.0 → 5.1.0
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.
- package/dist/index.js +27 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2628,6 +2628,25 @@ function contained(parent, child, platform) {
|
|
|
2628
2628
|
const target = comparePath(child, platform);
|
|
2629
2629
|
return target !== root && target.startsWith(`${root}/`);
|
|
2630
2630
|
}
|
|
2631
|
+
function withoutWindowsNamespacePrefix(value) {
|
|
2632
|
+
return value.replace(/^\\\\\?\\UNC\\/i, "\\\\").replace(/^\\\\\?\\/i, "");
|
|
2633
|
+
}
|
|
2634
|
+
async function windowsContainmentDiagnostic(root, target, canonical, initial) {
|
|
2635
|
+
let lstatState = "error";
|
|
2636
|
+
let identityState = "unavailable";
|
|
2637
|
+
let linkState = "unavailable";
|
|
2638
|
+
try {
|
|
2639
|
+
const current = await lstat(target);
|
|
2640
|
+
lstatState = current.isSymbolicLink() ? "symlink" : current.isFile() ? "regular" : "non_regular";
|
|
2641
|
+
identityState = sameIdentity(identity(initial), identity(current)) ? "same" : "changed";
|
|
2642
|
+
linkState = current.nlink === 0 ? "zero" : current.nlink === 1 ? "single" : "multiple";
|
|
2643
|
+
} catch (error) {
|
|
2644
|
+
if (error.code === "ENOENT")
|
|
2645
|
+
lstatState = "missing";
|
|
2646
|
+
}
|
|
2647
|
+
const namespaceState = comparePath(withoutWindowsNamespacePrefix(canonical), "win32") === comparePath(withoutWindowsNamespacePrefix(join(root, METADATA_FILENAME)), "win32") ? "equivalent" : "different";
|
|
2648
|
+
return `metadata file escaped the runtime root; windows_realpath_containment=escaped lstat=${lstatState} identity=${identityState} nlink=${linkState} namespace_prefix=${namespaceState}`;
|
|
2649
|
+
}
|
|
2631
2650
|
function sameIdentity(left, right) {
|
|
2632
2651
|
return left.dev === right.dev && left.ino === right.ino;
|
|
2633
2652
|
}
|
|
@@ -2758,8 +2777,14 @@ async function secureTarget(targetPath, options, mustExist) {
|
|
|
2758
2777
|
await ensureWindowsAcl(target, options.windowsAcl ?? defaultWindowsAclAdapter(), "file", options);
|
|
2759
2778
|
testStage(options, "target_realpath");
|
|
2760
2779
|
const canonical = await realpath(target);
|
|
2761
|
-
if (!contained(canonicalRoot, canonical, platform))
|
|
2780
|
+
if (!contained(canonicalRoot, canonical, platform)) {
|
|
2781
|
+
if (platform === "win32") {
|
|
2782
|
+
const error = new DaemonFileError("containment", "metadata file escaped the runtime root");
|
|
2783
|
+
error.message = await windowsContainmentDiagnostic(canonicalRoot, target, canonical, item);
|
|
2784
|
+
throw error;
|
|
2785
|
+
}
|
|
2762
2786
|
fail2("containment", "metadata file escaped the runtime root");
|
|
2787
|
+
}
|
|
2763
2788
|
return { root: canonicalRoot, target, initial: identity(item) };
|
|
2764
2789
|
} catch (error) {
|
|
2765
2790
|
if (error.code !== "ENOENT" || mustExist)
|
|
@@ -3343,7 +3368,7 @@ import { createInterface } from "node:readline";
|
|
|
3343
3368
|
// package.json
|
|
3344
3369
|
var package_default = {
|
|
3345
3370
|
name: "@jeffusion/bungee",
|
|
3346
|
-
version: "
|
|
3371
|
+
version: "5.1.0",
|
|
3347
3372
|
description: "High-performance reverse proxy server CLI",
|
|
3348
3373
|
type: "module",
|
|
3349
3374
|
bin: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeffusion/bungee",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "High-performance reverse proxy server CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"test": "bun test"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@jeffusion/bungee-core": "^
|
|
17
|
-
"@jeffusion/bungee-types": "^
|
|
16
|
+
"@jeffusion/bungee-core": "^5.1.0",
|
|
17
|
+
"@jeffusion/bungee-types": "^5.1.0",
|
|
18
18
|
"cli-progress": "^3.12.0",
|
|
19
19
|
"commander": "^14.0.1"
|
|
20
20
|
},
|