CH-J Server Managerquản lý máy chủ qua SSH
Menu
Mã nguồn đã công bố

CH-J Server Manager

Duyệt thư mục và tệp của một bản phát hành ứng dụng cụ thể.

Tải mã nguồn dạng ZIP
CH-J / Server Manager 196 tệp
core-20261013T133631Z-faa4ab45100e Ngày thêm: Chưa ghi nhận ngày · Ngày dựng:
urlPolicy.test.js Ngày thêm: Chưa ghi nhận ngày 1.2 KB · 34 dòng
Mã Tải tệp xuống
1"use strict";
3const test = require("node:test");
4const assert = require("node:assert/strict");
5const { assertAllowedUrl, normalizeBaseUrl } = require("../src/main/security/urlPolicy");
7const bases = [
8 "https://sm.ch-j.de/"
9];
11test("base URL normalization preserves the allowed root", () => {
12 assert.equal(normalizeBaseUrl("https://sm.ch-j.de").toString(), bases[0]);
13});
15test("allowed API and file URLs pass", () => {
16 assert.equal(
17 assertAllowedUrl(`${bases[0]}api/latest.php`, bases, { pathSegment: "api/" }).hostname,
18 "sm.ch-j.de"
19 );
20 assert.equal(
21 assertAllowedUrl(`${bases[0]}files/apps/win/app.exe`, bases, { pathSegment: "files/" }).hostname,
22 "sm.ch-j.de"
23 );
24});
26test("foreign hosts, credentials and paths are rejected", () => {
27 assert.throws(() => assertAllowedUrl("https://example.com/update.exe", bases), /allowlist/);
28 assert.throws(() => assertAllowedUrl("https://admin@sm.ch-j.de/files/a", bases), /credentials/);
29 assert.throws(() => assertAllowedUrl(`${bases[0]}admin.php`, bases, { pathSegment: "files/" }), /path/);
30});
32test("HTTP update origins are rejected", () => {
33 assert.throws(() => normalizeBaseUrl("http://sm.ch-j.de/"), /HTTPS/);
34});
SHA-256d76d344fc0a131fce6290b1ec7070dbd3c720cdd7b11a86e4330692f4056425b

CH-J Proprietary Software License 1.14 · Mã nguồn được cung cấp theo CH-J Proprietary Software License 1.14. Việc công khai mã nguồn không thay đổi các điều khoản giấy phép và không cấp thêm quyền nào.

SHA-256 của tệp nénde757268dbc4f0226549f8b4f41f9b7e585c856ee97fa0d43b17a0e95c281449
Tệp