mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-20 23:20:46 +00:00
fix(plugins): validate normalized package paths
This commit is contained in:
1 parent
5b5f6cc79d
commit
24e4a548b2
3 files changed
+41
-20
No files matched your search
@@ -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/);
|
||||
|
||||
Reference in new issue
Block a user