mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
7a47187e37
* feat(plugins): add isolated plugin host runtime * test(plugins): build runtime dependencies before tests * fix(plugins): harden runtime lifecycle and recovery * fix(plugins): harden runtime extension boundaries * fix(plugins): enforce runtime integrity boundaries * fix(plugins): await utility process exit * fix(plugins): harden utility process containment * fix(plugins): close runtime recovery gaps * fix(plugins): harden runtime lifecycle boundaries
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
"use strict";
|
|
|
|
const assert = require("node:assert/strict");
|
|
const path = require("node:path");
|
|
const test = require("node:test");
|
|
|
|
const {
|
|
assertPluginStorageSegment,
|
|
createPluginPaths,
|
|
isPathInside,
|
|
resolveInstalledVersionDirectory,
|
|
} = require("./paths.cjs");
|
|
|
|
test("plugin paths remain rooted under userData", () => {
|
|
const paths = createPluginPaths(path.resolve("/tmp/netcatty-user-data"));
|
|
assert.equal(paths.database, path.join(paths.root, "plugins.sqlite"));
|
|
assert.equal(
|
|
resolveInstalledVersionDirectory(paths, "com.example.test", "1.0.0"),
|
|
path.join(paths.packages, "com.example.test", "1.0.0"),
|
|
);
|
|
assert.equal(isPathInside(paths.packages, path.join(paths.packages, "child")), true);
|
|
assert.equal(isPathInside(paths.packages, path.join(paths.root, "escape")), false);
|
|
});
|
|
|
|
test("plugin storage segments reject path syntax", () => {
|
|
for (const value of ["", ".", "..", "a/b", "a\\b", "a\0b"]) {
|
|
assert.throws(() => assertPluginStorageSegment(value, "test"));
|
|
}
|
|
assert.equal(assertPluginStorageSegment("com.example.valid", "test"), "com.example.valid");
|
|
});
|