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.

1,5 KB · 40 ZeilenDatei herunterladen
1"use strict";
3function normalizeBaseUrl(value) {
4 const url = new URL(String(value || ""));
5 if (url.protocol !== "https:") throw new Error("Update URL must use HTTPS.");
6 if (url.username || url.password || url.hash || url.search) throw new Error("Invalid update base URL.");
7 url.pathname = `${url.pathname.replace(/\/+$/, "")}/`;
8 return url;
9}
11function assertAllowedUrl(candidate, allowedBaseUrls, options = {}) {
12 const raw = String(candidate || "").trim();
13 if (!raw) throw new Error("Missing URL.");
14 const bases = allowedBaseUrls.map(normalizeBaseUrl);
16 if (raw.startsWith("/")) {
17 if (!options.baseUrl) throw new Error("Relative URL requires a base URL.");
18 return assertAllowedUrl(new URL(raw.replace(/^\/+/, ""), normalizeBaseUrl(options.baseUrl)).toString(), allowedBaseUrls, options);
19 }
21 const url = new URL(raw);
22 if (url.username || url.password || url.hash) throw new Error("URL credentials and fragments are not allowed.");
23 const matchedBase = bases.find((base) => (
24 url.protocol === base.protocol
25 && url.hostname === base.hostname
26 && url.port === base.port
27 && url.pathname.startsWith(base.pathname)
28 ));
29 if (!matchedBase) throw new Error("URL is outside the update allowlist.");
31 if (options.pathSegment && !url.pathname.startsWith(`${matchedBase.pathname}${options.pathSegment}`)) {
32 throw new Error("URL path is outside the allowed update area.");
33 }
34 return url;
37module.exports = {
38 assertAllowedUrl,
39 normalizeBaseUrl
40};

SHA-256: db15c1e8b5a134391637a8de3efca895dcbf77095a5eaf58acba061b69775030

SHA-256 des Archivs: 5ac91caf4fa32a6fdb114f2430deed486fbe7489d5eea343d1f034169fafb5e0