CH-J Server ManagerSerververwaltung über SSH
Menü
Veröffentlichte Quellen

CH-J Server Manager

Durchsuchen Sie Verzeichnisse und Dateien einer bestimmten Anwendungsausgabe.

Quellen als ZIP herunterladen
CH-J Proprietary Software License 1.14

Die Quellen werden unter der CH-J Proprietary Software License 1.14 bereitgestellt. Ihre Verfügbarkeit ändert die Lizenzbedingungen nicht und gewährt keine zusätzlichen Rechte.

2,2 KB · 52 ZeilenDatei herunterladen
1"use strict";
3const test = require("node:test");
4const assert = require("node:assert/strict");
5const fs = require("node:fs");
6const os = require("node:os");
7const path = require("node:path");
8const AdmZip = require("adm-zip");
9const { ALLOWED_EXTENSIONS, PluginInstaller, safeEntryName } = require("../src/main/plugins/pluginInstaller");
10const { PluginRegistry } = require("../src/main/plugins/pluginRegistry");
12function manifest() {
13 return {
14 schemaVersion: 1,
15 id: "chj.system-monitor",
16 name: "System Monitor",
17 version: "0.0.1",
18 publisher: "CH-J",
19 entry: "ui/index.html",
20 pluginApi: "^1.0.0",
21 minAppVersion: "0.0.1",
22 permissions: ["session.read", "system.metrics.read"]
23 };
26test("plugin installer validates and atomically installs a standalone package", (t) => {
27 const root = fs.mkdtempSync(path.join(os.tmpdir(), "chj-plugin-install-"));
28 t.after(() => fs.rmSync(root, { recursive: true, force: true }));
29 const archive = path.join(root, "system-monitor.chjplugin");
30 const zip = new AdmZip();
31 zip.addFile("manifest.json", Buffer.from(JSON.stringify(manifest())));
32 zip.addFile("ui/index.html", Buffer.from("<!doctype html><script src=\"index.js\"></script>"));
33 zip.addFile("ui/index.js", Buffer.from("'use strict';"));
34 zip.writeZip(archive);
35 const catalog = {
36 releaseId: "release-1", id: "chj.system-monitor", version: "0.0.1", pluginApi: "^1.0.0", minAppVersion: "0.0.1",
37 permissions: ["session.read", "system.metrics.read"], sha512: "a".repeat(128), publishedAt: "2026-08-07T16:00:00Z"
38 };
39 const installer = new PluginInstaller({ storageRoot: root, appVersion: "0.0.1" });
40 const result = installer.install(archive, catalog);
41 assert.equal(result.manifest.id, "chj.system-monitor");
42 assert.equal(new PluginRegistry(root).listInstalled()[0].version, "0.0.1");
43 assert.equal(installer.install(archive, catalog).reused, true);
44});
46test("plugin paths reject traversal, absolute paths and drive paths", () => {
47 assert.throws(() => safeEntryName("../escape.js"), /Unsafe/);
48 assert.throws(() => safeEntryName("/absolute.js"), /Unsafe/);
49 assert.throws(() => safeEntryName("C:/escape.js"), /Unsafe/);
50 assert.equal(safeEntryName("ui/index.js"), "ui/index.js");
51 assert.ok(ALLOWED_EXTENSIONS.has(".ttf"));
52});

SHA-256: 428bf529120358d3a7c5aa0d8543cabd74e888ea202e2c3e0ef9fe0ae3868a02

SHA-256 des Archivs: 5ac91caf4fa32a6fdb114f2430deed486fbe7489d5eea343d1f034169fafb5e0