fix(plugins): validate normalized package paths

This commit is contained in:
ryan-wong-coder committed 2026-07-17 23:49:22 +08:00
1 parent 5b5f6cc79d
commit 24e4a548b2
3 files changed
+41 -20

No files matched your search

+8
View File
@@ -140,11 +140,19 @@ test("path validation rejects traversal, platform aliases, and duplicates", () =
"folder/file ",
"folder/file?.js",
"a//b",
"a/b",
"a\b",
"../x",
"..",
"C:/x",
"assets/CON.txt",
"file.",
"😀".repeat(129),
]) {
assert.throws(() => assertSafePackagePath(unsafe));
}
assert.equal(assertSafePackagePath("😀".repeat(128)), "😀".repeat(128));
assert.equal(assertSafePackagePath("assets/fullwidth-S.txt"), "assets/fullwidth-S.txt");
const registry = new PackagePathRegistry();
registry.add("dist/Plugin.js");
assert.throws(() => registry.add("dist/plugin.js"), /case-colliding/);