@synopackageland/cli 0.52.1 → 0.52.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +3 -2
- package/dist/cli.js +20 -3
- package/dist/error-registry.js +1 -1
- package/dist/native-http-schema/source.json +1 -1
- package/dist/runtime/sdk-source.d.ts +1 -1
- package/dist/runtime/sdk-source.js +1 -1
- package/dist/skill.js +1 -1
- package/dist/spk/check-payload.d.ts +6 -1
- package/dist/spk/check-payload.js +18 -3
- package/dist/spk/inspect.js +3 -2
- package/dist/spk/rules.d.ts +10 -0
- package/dist/spk/rules.js +2 -0
- package/dist/spk/validate-spk.d.ts +5 -1
- package/dist/spk/validate-spk.js +23 -3
- package/dist/standalone/inspect-spk.d.ts +3 -1
- package/dist/standalone/inspect-spk.js +3 -1
- package/dist/standalone/manifest.d.ts +1 -0
- package/dist/standalone/manifest.js +10 -0
- package/dist/standalone/mobile.js +3 -3
- package/dist/standalone/native-layout.d.ts +2 -0
- package/dist/standalone/native-layout.js +14 -6
- package/dist/standalone/public-ui.d.ts +33 -0
- package/dist/standalone/public-ui.js +164 -0
- package/dist/standalone/spk.js +20 -1
- package/dist/standalone/tcp-listeners.d.ts +1 -1
- package/dist/standalone/tcp-listeners.js +4 -4
- package/dist/validate.js +29 -0
- package/package.json +1 -1
- package/schema/dsm-package.schema.json +14 -1
- package/skills/SKILL.md +4 -2
- package/skills/reference/mobile.md +2 -0
- package/skills/reference/raw-tcp.md +5 -4
- package/skills/reference/ui-vue.md +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.52.3
|
|
4
|
+
|
|
5
|
+
- Minify all packaged public UI JS/CSS deterministically, preserving classic globals, module exports and LICENSES files
|
|
6
|
+
- Strip source maps before UI content hashing; reject remaining maps and secret-looking public UI content
|
|
7
|
+
- Add exact `ui_secret_ignores` exceptions with required reasons, recorded in SPK metadata
|
|
8
|
+
- Report UI minification and source-map status in inspect, including informational results for older SPKs
|
|
9
|
+
- Document public static UI files and backend EntryGate access control
|
|
10
|
+
|
|
11
|
+
## 0.52.2
|
|
12
|
+
|
|
13
|
+
- Restore `tcp_listeners` scope `all` for IPv4 `0.0.0.0`; `loopback` remains the default
|
|
14
|
+
- Accept both scopes in manifest validation, the JSON schema, compiled policies and SPK inspection
|
|
15
|
+
- Pin CLI-owned SDK defaults to 0.53.2 and align raw TCP documentation with both scopes
|
|
16
|
+
|
|
3
17
|
## 0.52.1
|
|
4
18
|
|
|
5
19
|
- Pin CLI-owned SDK defaults and the packaged native HTTP contract to SDK 0.53.1
|
package/README.md
CHANGED
|
@@ -720,8 +720,9 @@ sections and keys per DSM language. See `synopkgland skill show dsm-texts` and
|
|
|
720
720
|
|
|
721
721
|
### Raw TCP protocols
|
|
722
722
|
|
|
723
|
-
Declare `tcp_listeners` for a native Go
|
|
723
|
+
Declare `tcp_listeners` for a native Go protocol listener, then call
|
|
724
724
|
`ipc.ListenTCP(ctx, "declared_id", port)` directly. Omit `scope` or set it to
|
|
725
|
-
`loopback` to bind IPv4 `127.0.0.1
|
|
725
|
+
`loopback` to bind IPv4 `127.0.0.1`; use `scope: all` to bind IPv4 `0.0.0.0`,
|
|
726
|
+
exposed on all IPv4 interfaces. `check` validates bind scope,
|
|
726
727
|
port bounds and SDK policy support; audit rejects undeclared/dynamic IDs and
|
|
727
728
|
constructor aliases. See `synopkgland skill show raw-tcp`.
|
package/dist/cli.js
CHANGED
|
@@ -41,6 +41,7 @@ import { checkJobs, commitOutputs, forEachArch, } from "./standalone/arch-jobs.j
|
|
|
41
41
|
import { checkReproducible } from "./reproducible.js";
|
|
42
42
|
import { spkApprovalDiff, formatApprovalDiff } from "./runtime/approval-diff.js";
|
|
43
43
|
import { inspectAnySpk } from "./spk/inspect.js";
|
|
44
|
+
import { validateSpk } from "./spk/validate-spk.js";
|
|
44
45
|
import { backupRecord } from "./standalone/hyper-backup.js";
|
|
45
46
|
import { terminalSafe } from "./terminal-text.js";
|
|
46
47
|
import { auditGoRoutes } from "./standalone/route-audit.js";
|
|
@@ -136,6 +137,11 @@ function formatSpkReport(spk, report) {
|
|
|
136
137
|
const hasEntryExceptions = Boolean(report.gateway || report.integrations?.length);
|
|
137
138
|
return [
|
|
138
139
|
`SPK: ${spk}`,
|
|
140
|
+
...(report.publicUi ? [
|
|
141
|
+
`Public UI: ${report.publicUi.bundles} JS/CSS bundles; ${report.publicUi.minified ? "minified" : "readable formatting detected"} (formatting heuristic); ${report.publicUi.sourceMapFree ? "source-map free" : "source maps present"}.`,
|
|
142
|
+
...report.publicUi.unminified.map(file => ` Informational: readable UI bundle ${file}`),
|
|
143
|
+
...report.publicUi.sourceMaps.map(file => ` Informational: source map ${file}`),
|
|
144
|
+
] : []),
|
|
139
145
|
...formatInstallSettings(report.installSettings),
|
|
140
146
|
...(report.synopkgland ? formatHyperBackup(report.hyperBackup) : []),
|
|
141
147
|
...(report.identityGateway ? [report.identityGateway.notice, `OIDC issuer access: ${report.identityGateway.issuerAccess}`] : []),
|
|
@@ -389,10 +395,21 @@ async function runCliWithin(argv) {
|
|
|
389
395
|
process.exitCode = 1;
|
|
390
396
|
});
|
|
391
397
|
program
|
|
392
|
-
.command("check")
|
|
393
|
-
.description("Validate the
|
|
398
|
+
.command("check [spk]")
|
|
399
|
+
.description("Validate the project, or check a built SPK including its final public UI payload")
|
|
394
400
|
.option("--json", "Print a single JSON object")
|
|
395
|
-
.action(async (_options, command) => {
|
|
401
|
+
.action(async (input, _options, command) => {
|
|
402
|
+
if (input) {
|
|
403
|
+
const spk = resolve(input);
|
|
404
|
+
const report = await validateSpk(spk);
|
|
405
|
+
if (!report.ok)
|
|
406
|
+
throw Object.assign(failure("SPK_CHECK_FAILED", formatFindings(report.errors).join("\n"), "Remove public UI credentials and source maps, correct the package and rebuild."), { report: { spk, ...report } });
|
|
407
|
+
emit("check", { spk, ...report }, [
|
|
408
|
+
`SPK check passed: ${spk}`,
|
|
409
|
+
...formatFindings(report.warnings),
|
|
410
|
+
].join("\n"));
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
396
413
|
const validation = validateProject(requireProject(rootOf(command)), {
|
|
397
414
|
profile: "personal",
|
|
398
415
|
});
|
package/dist/error-registry.js
CHANGED
|
@@ -716,7 +716,7 @@ export const ERROR_REGISTRY = {
|
|
|
716
716
|
STANDALONE_TCP_LISTENERS_INVALID: {
|
|
717
717
|
code: "STANDALONE_TCP_LISTENERS_INVALID",
|
|
718
718
|
description: "A raw TCP listener declaration has invalid names, fields, scopes or port bounds.",
|
|
719
|
-
suggestion: "Declare tcp_listeners.<id> with port 1024..65535, scope loopback (default
|
|
719
|
+
suggestion: "Declare tcp_listeners.<id> with port 1024..65535, scope loopback (default) or all, and optional port_range: [min,max] including port.",
|
|
720
720
|
},
|
|
721
721
|
STANDALONE_TCP_LISTENERS_UNSUPPORTED: {
|
|
722
722
|
code: "STANDALONE_TCP_LISTENERS_UNSUPPORTED",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"module":"github.com/synopackageland/syno-pkg-land-sdk","version":"0.53.
|
|
1
|
+
{"module":"github.com/synopackageland/syno-pkg-land-sdk","version":"0.53.2","local":false}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { goPrivateCovers } from './go-env.js';
|
|
2
2
|
import { type ExecutorManifest } from './sdk-executor-manifest.js';
|
|
3
3
|
/** Pinned SDK for CLI-owned controllers and Compose planning; App pins take precedence. */
|
|
4
|
-
export declare const DEFAULT_SDK_VERSION = "0.53.
|
|
4
|
+
export declare const DEFAULT_SDK_VERSION = "0.53.2";
|
|
5
5
|
export declare const SDK_PACKAGE = "@synopackageland/sdk";
|
|
6
6
|
export declare const SDK_MODULE = "github.com/synopackageland/syno-pkg-land-sdk";
|
|
7
7
|
export declare const EXECUTOR_MODULE = "github.com/synopackageland/syno-pkg-land-sdk/executor";
|
|
@@ -5,7 +5,7 @@ import { tmpdir } from 'node:os';
|
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { readExecutorManifest, predatesExecutorManifest } from './sdk-executor-manifest.js';
|
|
7
7
|
/** Pinned SDK for CLI-owned controllers and Compose planning; App pins take precedence. */
|
|
8
|
-
export const DEFAULT_SDK_VERSION = '0.53.
|
|
8
|
+
export const DEFAULT_SDK_VERSION = '0.53.2';
|
|
9
9
|
export const SDK_PACKAGE = '@synopackageland/sdk';
|
|
10
10
|
export const SDK_MODULE = 'github.com/synopackageland/syno-pkg-land-sdk';
|
|
11
11
|
export const EXECUTOR_MODULE = `${SDK_MODULE}/executor`;
|
package/dist/skill.js
CHANGED
|
@@ -33,7 +33,7 @@ const SKILL_CATALOG = [
|
|
|
33
33
|
when: "Needs a DSM sign-in",
|
|
34
34
|
},
|
|
35
35
|
{ id: "dsm-texts", file: "reference/dsm-texts.md", when: "Ship native DSM sections and fixed desktop notification strings" },
|
|
36
|
-
{ id: "raw-tcp", file: "reference/raw-tcp.md", when: "Declare loopback-
|
|
36
|
+
{ id: "raw-tcp", file: "reference/raw-tcp.md", when: "Declare loopback or all-interface raw TCP protocol listeners and their port boundary" },
|
|
37
37
|
{ id: "mobile", file: "reference/mobile.md", when: "Register an App for the mobile shell and generate its SDK entry page" },
|
|
38
38
|
{ id: "files", file: "reference/files.md", when: "Needs NAS files" },
|
|
39
39
|
{
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { Findings } from "./findings.js";
|
|
2
|
-
|
|
2
|
+
import { type PublicUiReport, type UiSecretIgnore } from "../standalone/public-ui.js";
|
|
3
|
+
export declare function checkPayload(payloadPath: string, info: Record<string, string>, findings: Findings, policy?: {
|
|
4
|
+
ignores?: UiSecretIgnore[];
|
|
5
|
+
moduleVersion?: string;
|
|
6
|
+
sourceMaps?: boolean;
|
|
7
|
+
}): Promise<PublicUiReport | undefined>;
|
|
@@ -3,6 +3,7 @@ import { posix } from "node:path";
|
|
|
3
3
|
import * as tar from "tar";
|
|
4
4
|
import { ARCH_ELF_MACHINE } from "./dsm-spec.js";
|
|
5
5
|
import { archiveInventory, formatArchiveIssue } from './archive-inventory.js';
|
|
6
|
+
import { applyUiIgnores, publicUiReport, uiFileProblems } from "../standalone/public-ui.js";
|
|
6
7
|
const XZ_MAGIC = Buffer.from([0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00]);
|
|
7
8
|
const ELF_MAGIC = Buffer.from("\x7fELF", "latin1");
|
|
8
9
|
const MAX_TEXT = 1024 * 1024;
|
|
@@ -39,7 +40,7 @@ async function scanPayload(payloadPath, wanted, findings) {
|
|
|
39
40
|
if (entry.type !== "File")
|
|
40
41
|
return;
|
|
41
42
|
const file = { path, head: Buffer.alloc(0) };
|
|
42
|
-
const keep = wanted(path) && (entry.size ?? 0) <= MAX_TEXT;
|
|
43
|
+
const keep = wanted(path) && (entry.size ?? 0) <= (path.startsWith("ui/") ? 64 * MAX_TEXT : MAX_TEXT);
|
|
43
44
|
const chunks = [];
|
|
44
45
|
entry.on("data", (chunk) => {
|
|
45
46
|
if (file.head.length < HEAD_BYTES)
|
|
@@ -140,7 +141,7 @@ function checkElf(files, arch, findings) {
|
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
|
-
export async function checkPayload(payloadPath, info, findings) {
|
|
144
|
+
export async function checkPayload(payloadPath, info, findings, policy = {}) {
|
|
144
145
|
if (startsWith(payloadPath, XZ_MAGIC)) {
|
|
145
146
|
findings.add("SPK_PAYLOAD_XZ", "package.tgz is xz-compressed (the Synology toolkit format); inspect cannot read xz and did not check the payload contents.", "package.tgz");
|
|
146
147
|
return;
|
|
@@ -155,11 +156,25 @@ export async function checkPayload(payloadPath, info, findings) {
|
|
|
155
156
|
}
|
|
156
157
|
catch { /* scanPayload reports unreadable archives */ }
|
|
157
158
|
const configs = new Set(dirs.map((dir) => posix.join(dir, "config")));
|
|
158
|
-
const files = await scanPayload(payloadPath, (path) => configs.has(path) || (/\/texts\/[^/]+\/strings$/.test(path) && dirs.some((dir) => path.startsWith(`${dir}/`))), findings);
|
|
159
|
+
const files = await scanPayload(payloadPath, (path) => path.startsWith("ui/") || configs.has(path) || (/\/texts\/[^/]+\/strings$/.test(path) && dirs.some((dir) => path.startsWith(`${dir}/`))), findings);
|
|
159
160
|
if (!files)
|
|
160
161
|
return;
|
|
161
162
|
const sections = ownSections(files);
|
|
162
163
|
for (const file of files.filter((f) => configs.has(f.path)))
|
|
163
164
|
checkUiConfig(file, sections, findings);
|
|
164
165
|
checkElf(files, info.arch, findings);
|
|
166
|
+
const ui = files.filter(file => file.path.startsWith("ui/"));
|
|
167
|
+
for (const file of ui) {
|
|
168
|
+
if (file.text === undefined) {
|
|
169
|
+
findings.add("SPK_UI_UNSAFE", "Public UI file exceeds the 64 MiB scan limit.", at(file.path));
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
const problems = applyUiIgnores(uiFileProblems(file.path.slice(3), file.text), policy.ignores ?? [], policy.moduleVersion);
|
|
173
|
+
for (const problem of problems) {
|
|
174
|
+
if (policy.sourceMaps === false && ["source-map-file", "sourceMappingURL"].includes(problem.pattern))
|
|
175
|
+
continue;
|
|
176
|
+
findings.add(problem.ignored ? "SPK_UI_SECRET_IGNORED" : "SPK_UI_UNSAFE", `Public UI pattern: ${problem.pattern}${problem.ignored ? `; reason: ${problem.ignored}` : "; remove it before packaging"}.`, at(file.path));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return publicUiReport(ui.filter(file => file.text !== undefined).map(file => ({ file: file.path, content: file.text })));
|
|
165
180
|
}
|
package/dist/spk/inspect.js
CHANGED
|
@@ -15,13 +15,14 @@ const CONTAINER_MARKER = "synology-app.yaml";
|
|
|
15
15
|
* others are never held to it.
|
|
16
16
|
*/
|
|
17
17
|
export async function inspectAnySpk(spkPath) {
|
|
18
|
-
const validation = await validateSpk(spkPath);
|
|
18
|
+
const validation = await validateSpk(spkPath, { sourceMaps: false });
|
|
19
19
|
const dsm = { ok: validation.ok, errors: validation.errors, warnings: validation.warnings };
|
|
20
20
|
const facts = await readFacts(spkPath);
|
|
21
21
|
if (BUILD_MARKERS.some((name) => facts.top.has(name)) || facts.payload.some((entry) => entry.path === CONTAINER_MARKER)) {
|
|
22
|
-
return { ...(await inspectSpk(spkPath)), synopkgland: true, info: validation.info, dsm };
|
|
22
|
+
return { ...(await inspectSpk(spkPath)), publicUi: validation.publicUi, synopkgland: true, info: validation.info, dsm };
|
|
23
23
|
}
|
|
24
24
|
return {
|
|
25
|
+
publicUi: validation.publicUi,
|
|
25
26
|
...(validation.package ? { package: validation.package } : {}),
|
|
26
27
|
...(validation.version ? { version: validation.version } : {}),
|
|
27
28
|
...(validation.arch ? { arch: validation.arch } : {}),
|
package/dist/spk/rules.d.ts
CHANGED
|
@@ -11,6 +11,16 @@ export interface SpkRule {
|
|
|
11
11
|
source: string;
|
|
12
12
|
}
|
|
13
13
|
export declare const SPK_RULES: {
|
|
14
|
+
readonly SPK_UI_UNSAFE: {
|
|
15
|
+
readonly severity: "error";
|
|
16
|
+
readonly description: "Public UI contains source maps or secret-looking content.";
|
|
17
|
+
readonly source: "Public UI policy";
|
|
18
|
+
};
|
|
19
|
+
readonly SPK_UI_SECRET_IGNORED: {
|
|
20
|
+
readonly severity: "warning";
|
|
21
|
+
readonly description: "An exact public UI file has a secret-scan exception with a reason.";
|
|
22
|
+
readonly source: "Public UI policy";
|
|
23
|
+
};
|
|
14
24
|
readonly SPK_ARCHIVE_INVALID: {
|
|
15
25
|
readonly severity: "error";
|
|
16
26
|
readonly description: "An archive has noncanonical or colliding names, repeated entries, or unsupported entry types.";
|
package/dist/spk/rules.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const GUIDE = "DSM 7 Developer Guide";
|
|
2
2
|
export const SPK_RULES = {
|
|
3
|
+
SPK_UI_UNSAFE: { severity: "error", description: "Public UI contains source maps or secret-looking content.", source: "Public UI policy" },
|
|
4
|
+
SPK_UI_SECRET_IGNORED: { severity: "warning", description: "An exact public UI file has a secret-scan exception with a reason.", source: "Public UI policy" },
|
|
3
5
|
SPK_ARCHIVE_INVALID: { severity: "error", description: "An archive has noncanonical or colliding names, repeated entries, or unsupported entry types.", source: "Archive inventory" },
|
|
4
6
|
SPK_NOT_TAR: { severity: "error", description: "The file is not a readable tar archive; an SPK is an uncompressed tar.", source: `${GUIDE}: Package Structure` },
|
|
5
7
|
SPK_ENTRY_UNSAFE: { severity: "error", description: "A path inside the SPK escapes the archive root (an absolute path or ..), or is a link.", source: `${GUIDE}: Package Structure` },
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type SpkFinding } from "./findings.js";
|
|
2
|
+
import { type PublicUiReport } from "../standalone/public-ui.js";
|
|
2
3
|
export type { SpkFinding } from "./findings.js";
|
|
3
4
|
export interface SpkValidation {
|
|
5
|
+
publicUi?: PublicUiReport;
|
|
4
6
|
/** No errors; warnings do not fail validation. */
|
|
5
7
|
ok: boolean;
|
|
6
8
|
info?: Record<string, string>;
|
|
@@ -11,4 +13,6 @@ export interface SpkValidation {
|
|
|
11
13
|
warnings: SpkFinding[];
|
|
12
14
|
}
|
|
13
15
|
/** Checks an SPK against the DSM 7 package format without installing or running anything. */
|
|
14
|
-
export declare function validateSpk(spkPath: string
|
|
16
|
+
export declare function validateSpk(spkPath: string, options?: {
|
|
17
|
+
sourceMaps?: boolean;
|
|
18
|
+
}): Promise<SpkValidation>;
|
package/dist/spk/validate-spk.js
CHANGED
|
@@ -9,14 +9,16 @@ import { checkPayload } from "./check-payload.js";
|
|
|
9
9
|
import { KNOWN_TOP_LEVEL } from "./dsm-spec.js";
|
|
10
10
|
import { Findings } from "./findings.js";
|
|
11
11
|
import { archiveInventory, formatArchiveIssue } from './archive-inventory.js';
|
|
12
|
+
import { readUiSecretIgnores } from "../standalone/public-ui.js";
|
|
12
13
|
/** Outer files other than package.tgz are metadata; anything larger is not read. */
|
|
13
14
|
const MAX_OUTER_FILE = 16 * 1024 * 1024;
|
|
14
15
|
const TOP_LEVEL = new Set(KNOWN_TOP_LEVEL);
|
|
15
16
|
/** Checks an SPK against the DSM 7 package format without installing or running anything. */
|
|
16
|
-
export async function validateSpk(spkPath) {
|
|
17
|
+
export async function validateSpk(spkPath, options = {}) {
|
|
17
18
|
const findings = new Findings();
|
|
18
19
|
const dir = mkdtempSync(join(tmpdir(), "syno-validate-spk-"));
|
|
19
20
|
let info = {};
|
|
21
|
+
let publicUi;
|
|
20
22
|
try {
|
|
21
23
|
try {
|
|
22
24
|
for (const issue of await archiveInventory(spkPath, true)) {
|
|
@@ -35,8 +37,25 @@ export async function validateSpk(spkPath) {
|
|
|
35
37
|
info = checkInfo(outer, findings);
|
|
36
38
|
if (!outer.payloadPath)
|
|
37
39
|
findings.add("SPK_PAYLOAD_MISSING", "package.tgz is missing.", "package.tgz");
|
|
38
|
-
else
|
|
39
|
-
|
|
40
|
+
else {
|
|
41
|
+
let ignores = [];
|
|
42
|
+
let moduleVersion;
|
|
43
|
+
for (const name of ["sdk-package.json", "native-layout.json"]) {
|
|
44
|
+
const bytes = outer.files.get(name);
|
|
45
|
+
if (!bytes)
|
|
46
|
+
continue;
|
|
47
|
+
try {
|
|
48
|
+
const metadata = JSON.parse(bytes.toString("utf8"));
|
|
49
|
+
ignores = readUiSecretIgnores(metadata.ui_secret_ignores);
|
|
50
|
+
if (typeof metadata.ui_module === "string" && /^[a-f0-9]{64}$/.test(metadata.ui_module))
|
|
51
|
+
moduleVersion = metadata.ui_module;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
findings.add("SPK_UI_UNSAFE", "Invalid public UI secret-scan exceptions in build metadata.", name);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
publicUi = await checkPayload(outer.payloadPath, info, findings, { ignores, moduleVersion, sourceMaps: options.sourceMaps });
|
|
58
|
+
}
|
|
40
59
|
checkMetadata({ files: outer.files, modes: new Map(outer.entries.map((entry) => [normalize(entry.path), entry.mode])) }, findings);
|
|
41
60
|
}
|
|
42
61
|
}
|
|
@@ -45,6 +64,7 @@ export async function validateSpk(spkPath) {
|
|
|
45
64
|
}
|
|
46
65
|
const errors = findings.list.filter((finding) => finding.severity === "error");
|
|
47
66
|
return {
|
|
67
|
+
...(publicUi ? { publicUi } : {}),
|
|
48
68
|
ok: errors.length === 0,
|
|
49
69
|
info,
|
|
50
70
|
...(info.package ? { package: info.package } : {}),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type TCPListeners } from "./tcp-listeners.js";
|
|
2
2
|
import { type PackageDependencies } from "./package-dependencies.js";
|
|
3
3
|
import { type InstallSettings } from './install-settings.js';
|
|
4
|
+
import { type PublicUiReport } from "./public-ui.js";
|
|
4
5
|
import { type WebLaunchMode } from "../contract/web-launch.js";
|
|
5
6
|
import { type ComposeApp } from "./compose.js";
|
|
6
7
|
import { type GatewayReviewReport } from "./gateway-review.js";
|
|
@@ -12,9 +13,10 @@ import type { EntryMode } from "./manifest.js";
|
|
|
12
13
|
import { type UninstallCleanupItem } from "../runtime/uninstall-cleanup.js";
|
|
13
14
|
export type SpkKind = "native-go" | "native-python" | "native-node" | "native-rust" | "binary" | "container" | "native-layout";
|
|
14
15
|
export interface SpkInspection {
|
|
16
|
+
publicUi?: PublicUiReport;
|
|
15
17
|
/** Archived DSM language -> native section -> sorted keys (no text values). */
|
|
16
18
|
nativeTexts?: Record<string, Record<string, string[]>>;
|
|
17
|
-
/**
|
|
19
|
+
/** Manifest policy recorded at build time; not proof of runtime listener health. */
|
|
18
20
|
tcpListeners?: TCPListeners;
|
|
19
21
|
dependencies?: PackageDependencies;
|
|
20
22
|
installSettings?: InstallSettings;
|
|
@@ -8,6 +8,7 @@ import { portDefaults, portInstallSteps } from "./install-ports.js";
|
|
|
8
8
|
import { inspectPackageDependencies, dependencyInfo } from "./package-dependencies.js";
|
|
9
9
|
import { readInstallSettings, settingsInstallSteps, settingsConfig, renderSettingsHook } from './install-settings.js';
|
|
10
10
|
import { MODULE_UI_ENTRY, uiTreeDigest } from "./ui-assets.js";
|
|
11
|
+
import { minifyUi, isUiBundle } from "./public-ui.js";
|
|
11
12
|
import { nativePortal } from "./portal.js";
|
|
12
13
|
import { nativeGatewaySupported, renderNativeGatewayConfig, renderNativeGatewayDiagnostic, renderNativeGatewayPrepare, NATIVE_GATEWAY_CONFIG, gatewayEntryPath } from './native-gateway.js';
|
|
13
14
|
import { inspectPortalInfo } from "../portal/info.js";
|
|
@@ -1604,7 +1605,8 @@ async function inspectInstallSettings(dir, payload, metadata, findings) {
|
|
|
1604
1605
|
let text = String(source);
|
|
1605
1606
|
for (const [key, p] of Object.entries(ports))
|
|
1606
1607
|
text = text.replaceAll('@@PORT_' + key + '@@', String(p.default));
|
|
1607
|
-
|
|
1608
|
+
const actual = readOptional(join(root, path));
|
|
1609
|
+
if (text.includes('@@PORT_') || actual === undefined || (path.startsWith('ui/') && isUiBundle(path) ? minifyUi(actual, path) !== minifyUi(text, path) : actual !== text))
|
|
1608
1610
|
throw new Error('port template differs from generated default artifact');
|
|
1609
1611
|
}
|
|
1610
1612
|
}
|
|
@@ -50,6 +50,7 @@ export interface StandaloneI18n {
|
|
|
50
50
|
info: InfoTranslations;
|
|
51
51
|
}
|
|
52
52
|
export interface StandaloneManifest {
|
|
53
|
+
uiSecretIgnores?: import("./public-ui.js").UiSecretIgnore[];
|
|
53
54
|
tcpListeners?: TCPListeners;
|
|
54
55
|
/** Exact payload paths exempted from the SPK secret guard, never repository checks. */
|
|
55
56
|
allowSecretFiles?: string[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { loadNativeTexts } from "./dsm-texts.js";
|
|
2
|
+
import { readUiSecretIgnores } from "./public-ui.js";
|
|
2
3
|
import { readTCPListeners, tcpSDKProblem } from "./tcp-listeners.js";
|
|
3
4
|
import { validateNativeManifest } from './native-http.js';
|
|
4
5
|
import { readMobile, mobileIconPath } from './mobile.js';
|
|
@@ -53,6 +54,7 @@ export const STANDALONE_MANIFEST = "dsm-package.yaml";
|
|
|
53
54
|
export const KNOWN_FIELDS = new Set([
|
|
54
55
|
"tcp_listeners",
|
|
55
56
|
"allow_secret_files",
|
|
57
|
+
"ui_secret_ignores",
|
|
56
58
|
"ctl",
|
|
57
59
|
"schema",
|
|
58
60
|
"package",
|
|
@@ -162,6 +164,13 @@ export function loadStandaloneManifest(root) {
|
|
|
162
164
|
: { ok: false, errors: c.errors };
|
|
163
165
|
}
|
|
164
166
|
function readManifest(raw, c) {
|
|
167
|
+
let uiSecretIgnores = [];
|
|
168
|
+
try {
|
|
169
|
+
uiSecretIgnores = readUiSecretIgnores(raw.ui_secret_ignores);
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
c.fail("UI_SECRET_IGNORES_INVALID", error.message);
|
|
173
|
+
}
|
|
165
174
|
let allowSecretFiles;
|
|
166
175
|
try {
|
|
167
176
|
allowSecretFiles = readAllowedSecretFiles(raw.allow_secret_files);
|
|
@@ -636,6 +645,7 @@ function readManifest(raw, c) {
|
|
|
636
645
|
const manifest = {
|
|
637
646
|
...(raw.ctl ? { ctl: raw.ctl } : {}),
|
|
638
647
|
...(allowSecretFiles ? { allowSecretFiles } : {}),
|
|
648
|
+
...(uiSecretIgnores.length ? { uiSecretIgnores } : {}),
|
|
639
649
|
root: c.root,
|
|
640
650
|
package: packageId,
|
|
641
651
|
version,
|
|
@@ -79,7 +79,7 @@ export async function renderMobileAssets(manifest, uiDigest, moduleVersion) {
|
|
|
79
79
|
let runtime = '';
|
|
80
80
|
const requestTimeout = requestTimeoutSeconds(manifest.backend) * 1000 + appSdkTimeouts(manifest.backend).browserMarginMs;
|
|
81
81
|
if (mobile.entry === 'app') {
|
|
82
|
-
const result = await build({ entryPoints: [entryModule(manifest)], bundle: true, write: false, format: 'esm', platform: 'browser', target: 'es2022', minify: true, legalComments: '
|
|
82
|
+
const result = await build({ entryPoints: [entryModule(manifest)], bundle: true, write: false, format: 'esm', platform: 'browser', target: 'es2022', minify: true, keepNames: true, legalComments: 'none' });
|
|
83
83
|
runtime = result.outputFiles[0].text;
|
|
84
84
|
}
|
|
85
85
|
// Hash both runtime and declaration, as well as the original UI and all icons.
|
|
@@ -103,9 +103,9 @@ export async function renderMobileAssets(manifest, uiDigest, moduleVersion) {
|
|
|
103
103
|
? `import(${json(appBundle)})`
|
|
104
104
|
: `new Promise((resolve,reject)=>{const script=document.createElement('script');script.src=new URL(${json(appBundle)},import.meta.url).href;script.dataset.package=${json(manifest.package)};script.onload=()=>resolve(window.DsmPackageApps?.[${json(manifest.package)}]);script.onerror=reject;document.head.appendChild(script)})`;
|
|
105
105
|
const source = `import {bootEntryPage} from ${json(entryModule(manifest))};\nbootEntryPage({...${json(options)},root:document.querySelector('.dsmapp-root'),mount:async(root,ctx)=>{const app=await ${loadApp};if(typeof app?.mount!=='function')throw new Error('The UI must export mount(root, ctx)');return app.mount(root,ctx)}});`;
|
|
106
|
-
const bundled = await build({ stdin: { contents: source, resolveDir: manifest.root, sourcefile: 'synopkgland-entry.generated.js' }, bundle: true, write: false, format: 'esm', platform: 'browser', target: 'es2022', minify: true, plugins: [{ name: 'app-import', setup(api) { api.onResolve({ filter: /[?]v=/ }, args => ({ path: args.path, external: true })); } }], legalComments: '
|
|
106
|
+
const bundled = await build({ stdin: { contents: source, resolveDir: manifest.root, sourcefile: 'synopkgland-entry.generated.js' }, bundle: true, write: false, format: 'esm', platform: 'browser', target: 'es2022', minify: true, keepNames: true, plugins: [{ name: 'app-import', setup(api) { api.onResolve({ filter: /[?]v=/ }, args => ({ path: args.path, external: true })); } }], legalComments: 'none' });
|
|
107
107
|
files.set('entry.js', Buffer.from(bundled.outputFiles[0].text));
|
|
108
|
-
const context = await build({ stdin: { contents: `export {createAppContext} from ${json(entryModule(manifest))}`, resolveDir: manifest.root, sourcefile: 'synopkgland-context.generated.js' }, bundle: true, write: false, format: 'esm', platform: 'browser', target: 'es2022', minify: true, legalComments: '
|
|
108
|
+
const context = await build({ stdin: { contents: `export {createAppContext} from ${json(entryModule(manifest))}`, resolveDir: manifest.root, sourcefile: 'synopkgland-context.generated.js' }, bundle: true, write: false, format: 'esm', platform: 'browser', target: 'es2022', minify: true, keepNames: true, legalComments: 'none' });
|
|
109
109
|
files.set('entry-context.js', Buffer.from(context.outputFiles[0].text));
|
|
110
110
|
const css = moduleVersion ? `./${moduleVersion}/app.css` : './app.css';
|
|
111
111
|
files.set('entry.html', Buffer.from(`<!doctype html>\n<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"><meta name="synopkgland-build" content="${version}"><title>${html(name.en)}</title><link rel="icon" href="./icons/mobile-192.png?v=${version}"><link rel="stylesheet" href="${css}?v=${version}"><style>html,body,.dsmapp-root{margin:0;height:100%;min-height:100%}</style></head><body><div class="dsmapp-root"></div><script type="module" src="./entry.js?v=${version}"></script></body></html>\n`));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PackageDependencies } from "./package-dependencies.js";
|
|
2
2
|
import { type PackageMetadata } from "../package-metadata.js";
|
|
3
|
+
import { type UiSecretIgnore } from './public-ui.js';
|
|
3
4
|
import type { CommandRunner } from './build.js';
|
|
4
5
|
import { type Toolkit } from './toolkit.js';
|
|
5
6
|
import { type PortalDeclaration } from '../portal/alias.js';
|
|
@@ -21,6 +22,7 @@ type Binary = {
|
|
|
21
22
|
arches?: LayoutArch[];
|
|
22
23
|
};
|
|
23
24
|
export interface NativeLayout {
|
|
25
|
+
uiSecretIgnores?: UiSecretIgnore[];
|
|
24
26
|
/** Exact payload paths exempted from the SPK secret guard, never repository checks. */
|
|
25
27
|
allowSecretFiles?: string[];
|
|
26
28
|
metadata?: PackageMetadata;
|
|
@@ -5,6 +5,7 @@ import { validateMetadata, metadataInfoFields } from "../package-metadata.js";
|
|
|
5
5
|
import { createHash } from 'node:crypto';
|
|
6
6
|
import { chmodSync, copyFileSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
|
|
7
7
|
import { enforceRepositorySecrets, readAllowedSecretFiles } from '../secret-files.js';
|
|
8
|
+
import { enforcePublicUi, minifyUiTree, readUiSecretIgnores, uiFiles } from './public-ui.js';
|
|
8
9
|
import { tmpdir } from 'node:os';
|
|
9
10
|
import { dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
10
11
|
import { parse } from 'yaml';
|
|
@@ -108,9 +109,11 @@ export function isNativeLayout(root) {
|
|
|
108
109
|
}
|
|
109
110
|
export function loadNativeLayout(root) {
|
|
110
111
|
try {
|
|
111
|
-
const m = object(parse(readFileSync(join(root, 'dsm-package.yaml'), 'utf8')), ['schema', 'backend', 'package', 'version', 'build', 'displayname', 'description', 'maintainer', 'metadata', 'os_min_ver', 'privilege', 'arches', 'layout', 'native', 'icon', 'reproducible', 'portal', 'dependencies', 'allow_secret_files']);
|
|
112
|
+
const m = object(parse(readFileSync(join(root, 'dsm-package.yaml'), 'utf8')), ['schema', 'backend', 'package', 'version', 'build', 'displayname', 'description', 'maintainer', 'metadata', 'os_min_ver', 'privilege', 'arches', 'layout', 'native', 'icon', 'reproducible', 'portal', 'dependencies', 'allow_secret_files', 'ui_secret_ignores']);
|
|
112
113
|
const allowSecretFiles = readAllowedSecretFiles(m.allow_secret_files);
|
|
114
|
+
const uiSecretIgnores = readUiSecretIgnores(m.ui_secret_ignores);
|
|
113
115
|
delete m.allow_secret_files;
|
|
116
|
+
delete m.ui_secret_ignores;
|
|
114
117
|
if (m.schema !== 2)
|
|
115
118
|
fail('schema 2 required; migrate schema: 1 to schema: 2 and add backend: {kind: native}');
|
|
116
119
|
const backend = object(m.backend, ['kind']);
|
|
@@ -166,7 +169,7 @@ export function loadNativeLayout(root) {
|
|
|
166
169
|
fail('toolkits require HTTPS and SHA-256');
|
|
167
170
|
}
|
|
168
171
|
}
|
|
169
|
-
return { ok: true, manifest: { ...m, ...(allowSecretFiles ? { allowSecretFiles } : {}), root: resolve(root), native: { hook: hook(native.hook), ...(native.prepare ? { prepare: hook(native.prepare) } : {}), toolkits } } };
|
|
172
|
+
return { ok: true, manifest: { ...m, ...(allowSecretFiles ? { allowSecretFiles } : {}), ...(uiSecretIgnores.length ? { uiSecretIgnores } : {}), root: resolve(root), native: { hook: hook(native.hook), ...(native.prepare ? { prepare: hook(native.prepare) } : {}), toolkits } } };
|
|
170
173
|
}
|
|
171
174
|
catch (error) {
|
|
172
175
|
return { ok: false, errors: [{ code: 'NATIVE_LAYOUT_INVALID', message: String(error) }] };
|
|
@@ -350,8 +353,12 @@ export async function buildNativeLayout(options) {
|
|
|
350
353
|
}
|
|
351
354
|
const target = join(stage, 'payload');
|
|
352
355
|
mkdirSync(target);
|
|
353
|
-
|
|
354
|
-
|
|
356
|
+
copyTree(payload, target);
|
|
357
|
+
minifyUiTree(join(target, 'ui'));
|
|
358
|
+
enforcePublicUi(join(target, 'ui'), m.uiSecretIgnores);
|
|
359
|
+
const files = layoutFiles(target);
|
|
360
|
+
const ignoredUi = uiFiles(join(target, 'ui')).filter(file => m.uiSecretIgnores?.some(ignore => ignore.file === file)).map(file => `ui/${file}`);
|
|
361
|
+
await createReproducibleTar(target, join(stage, 'package.tgz'), { gzip: true, rejectSecrets: true, allowSecretFiles: [...new Set([...(m.allowSecretFiles ?? []), ...ignoredUi])] });
|
|
355
362
|
rmSync(target, { recursive: true });
|
|
356
363
|
const fields = { package: m.package, version, arch: layoutInfoArch(arch), os_min_ver: m.os_min_ver, displayname: m.displayname, description: m.description, maintainer: m.maintainer, dsmuidir: 'ui', dsmappname: `SYNO.SDS.${m.package}.Instance`, startable: 'yes', thirdparty: 'yes', checksum: createHash('md5').update(readFileSync(join(stage, 'package.tgz'))).digest('hex') };
|
|
357
364
|
const deps = dependencyInfo(m.dependencies ?? { packages: [] });
|
|
@@ -359,7 +366,7 @@ export async function buildNativeLayout(options) {
|
|
|
359
366
|
if (new Set(info.map(([k]) => k)).size !== info.length)
|
|
360
367
|
fail('INFO anchor collides with an INFO field');
|
|
361
368
|
writeFileSync(join(stage, 'INFO'), info.map(([k, v]) => `${k}="${v.replace(/([\\"$`])/g, '\\$1')}"\n`).join(''));
|
|
362
|
-
writeFileSync(join(stage, 'native-layout.json'), JSON.stringify({ format: 1, arch, dependencies: m.dependencies ?? { packages: [] }, binaries: binaries.map(({ path, linkage }) => ({ path, linkage })), files, ...(m.layout.anchors ? { anchors: m.layout.anchors } : {}), ...(m.portal ? { portal: m.portal } : {}) }));
|
|
369
|
+
writeFileSync(join(stage, 'native-layout.json'), JSON.stringify({ format: 1, arch, dependencies: m.dependencies ?? { packages: [] }, ...(m.uiSecretIgnores?.length ? { ui_secret_ignores: m.uiSecretIgnores } : {}), binaries: binaries.map(({ path, linkage }) => ({ path, linkage })), files, ...(m.layout.anchors ? { anchors: m.layout.anchors } : {}), ...(m.portal ? { portal: m.portal } : {}) }));
|
|
363
370
|
for (const name of ['INFO', 'native-layout.json'])
|
|
364
371
|
chmodSync(join(stage, name), 0o644);
|
|
365
372
|
const output = join(outDir, `${m.package}-${version}-${arch}.spk`);
|
|
@@ -378,7 +385,8 @@ export function inspectNativeLayout(dir, payload, info) {
|
|
|
378
385
|
try {
|
|
379
386
|
if (!/^[A-Za-z][A-Za-z0-9]{1,63}$/.test(info.package ?? '') || !/^\d+(\.\d+){0,3}-\d+$/.test(info.version ?? '') || !/^7\.\d+(\.\d+)?-\d+$/.test(info.os_min_ver ?? ''))
|
|
380
387
|
fail('invalid native INFO identity/version/DSM');
|
|
381
|
-
const inv = object(JSON.parse(readFileSync(join(dir, 'native-layout.json'), 'utf8')), ['format', 'arch', 'binaries', 'files', 'anchors', 'portal', 'dependencies']);
|
|
388
|
+
const inv = object(JSON.parse(readFileSync(join(dir, 'native-layout.json'), 'utf8')), ['format', 'arch', 'binaries', 'files', 'anchors', 'portal', 'dependencies', 'ui_secret_ignores']);
|
|
389
|
+
readUiSecretIgnores(inv.ui_secret_ignores);
|
|
382
390
|
if (inv.format !== 1 || !Object.hasOwn(LAYOUT_ARCHES, inv.arch) || layoutInfoArch(inv.arch) !== info.arch)
|
|
383
391
|
fail('invalid native layout inventory');
|
|
384
392
|
const errors = [];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface UiSecretIgnore {
|
|
2
|
+
file: string;
|
|
3
|
+
reason: string;
|
|
4
|
+
}
|
|
5
|
+
export interface UiProblem {
|
|
6
|
+
file: string;
|
|
7
|
+
pattern: string;
|
|
8
|
+
ignored?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface PublicUiReport {
|
|
11
|
+
/** A whitespace heuristic, not a claim that source code is confidential. */
|
|
12
|
+
minified: boolean;
|
|
13
|
+
sourceMapFree: boolean;
|
|
14
|
+
bundles: number;
|
|
15
|
+
unminified: string[];
|
|
16
|
+
sourceMaps: string[];
|
|
17
|
+
}
|
|
18
|
+
export declare function readUiSecretIgnores(value: unknown): UiSecretIgnore[];
|
|
19
|
+
export declare function isUiBundle(file: string): boolean;
|
|
20
|
+
/** No format conversion or property mangling: classic globals and ESM exports stay public. */
|
|
21
|
+
export declare function minifyUi(content: string, file: string): string;
|
|
22
|
+
export declare function uiFiles(root: string): string[];
|
|
23
|
+
/** Run before computing content addresses or mobile asset inventories. */
|
|
24
|
+
export declare function minifyUiTree(root: string, skip?: string[]): void;
|
|
25
|
+
export declare function uiFileProblems(file: string, content: string): UiProblem[];
|
|
26
|
+
export declare function logicalUiFile(file: string, moduleVersion?: string): string;
|
|
27
|
+
export declare function applyUiIgnores(problems: UiProblem[], ignores: UiSecretIgnore[], moduleVersion?: string): UiProblem[];
|
|
28
|
+
export declare function scanUiTree(root: string, ignores?: UiSecretIgnore[], moduleVersion?: string): UiProblem[];
|
|
29
|
+
export declare function enforcePublicUi(root: string, ignores?: UiSecretIgnore[], moduleVersion?: string): void;
|
|
30
|
+
export declare function publicUiReport(files: Array<{
|
|
31
|
+
file: string;
|
|
32
|
+
content: string;
|
|
33
|
+
}>): PublicUiReport;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { existsSync, lstatSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { basename, extname, join } from "node:path";
|
|
3
|
+
import { transformSync } from "esbuild";
|
|
4
|
+
import { readAllowedSecretFiles } from "../secret-files.js";
|
|
5
|
+
export function readUiSecretIgnores(value) {
|
|
6
|
+
if (value === undefined)
|
|
7
|
+
return [];
|
|
8
|
+
const invalid = () => Object.assign(new Error("ui_secret_ignores must be an array of {file, reason}; file is an exact path relative to ui/ and reason must be nonempty. Module snapshot hashes are omitted (app/file.js)."), { code: "UI_SECRET_IGNORES_INVALID" });
|
|
9
|
+
if (!Array.isArray(value) || value.some(item => !item || typeof item !== "object" ||
|
|
10
|
+
Array.isArray(item) || Object.keys(item).some(key => !["file", "reason"].includes(key)) ||
|
|
11
|
+
typeof item.reason !== "string" || !item.reason.trim() || /[\x00-\x1f\x7f]/.test(item.reason)))
|
|
12
|
+
throw invalid();
|
|
13
|
+
try {
|
|
14
|
+
readAllowedSecretFiles(value.map(item => item.file));
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
throw invalid();
|
|
18
|
+
}
|
|
19
|
+
return value.map(item => ({ file: item.file, reason: item.reason.trim() }));
|
|
20
|
+
}
|
|
21
|
+
export function isUiBundle(file) {
|
|
22
|
+
return [".js", ".mjs", ".cjs", ".css"].includes(extname(file).toLowerCase());
|
|
23
|
+
}
|
|
24
|
+
/** No format conversion or property mangling: classic globals and ESM exports stay public. */
|
|
25
|
+
export function minifyUi(content, file) {
|
|
26
|
+
try {
|
|
27
|
+
return transformSync(content, {
|
|
28
|
+
loader: extname(file).toLowerCase() === ".css" ? "css" : "js",
|
|
29
|
+
minifyWhitespace: true, minifySyntax: true, minifyIdentifiers: true,
|
|
30
|
+
keepNames: true, legalComments: "none", sourcemap: false,
|
|
31
|
+
logLevel: "silent",
|
|
32
|
+
}).code;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Parser errors can contain source excerpts; never echo possible credentials.
|
|
36
|
+
throw Object.assign(new Error(`Cannot minify public UI file ${JSON.stringify(file)}; fix its JS/CSS syntax.`), { code: "UI_MINIFY_FAILED" });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export function uiFiles(root) {
|
|
40
|
+
if (!existsSync(root))
|
|
41
|
+
return [];
|
|
42
|
+
const files = [];
|
|
43
|
+
const walk = (prefix) => {
|
|
44
|
+
const dir = join(root, prefix);
|
|
45
|
+
if (!lstatSync(dir).isDirectory() || lstatSync(dir).isSymbolicLink())
|
|
46
|
+
throw new Error("Public UI must contain only regular files and directories.");
|
|
47
|
+
for (const name of readdirSync(dir).sort()) {
|
|
48
|
+
const file = prefix ? `${prefix}/${name}` : name;
|
|
49
|
+
const stat = lstatSync(join(root, file));
|
|
50
|
+
if (stat.isDirectory() && !stat.isSymbolicLink())
|
|
51
|
+
walk(file);
|
|
52
|
+
else if (stat.isFile())
|
|
53
|
+
files.push(file);
|
|
54
|
+
else
|
|
55
|
+
throw new Error("Public UI must contain only regular files and directories.");
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
walk("");
|
|
59
|
+
return files;
|
|
60
|
+
}
|
|
61
|
+
/** Run before computing content addresses or mobile asset inventories. */
|
|
62
|
+
export function minifyUiTree(root, skip = []) {
|
|
63
|
+
for (const file of uiFiles(root)) {
|
|
64
|
+
if (skip.some(prefix => file === prefix || file.startsWith(`${prefix}/`)))
|
|
65
|
+
continue;
|
|
66
|
+
if (file.toLowerCase().endsWith(".map"))
|
|
67
|
+
rmSync(join(root, file));
|
|
68
|
+
else if (isUiBundle(file))
|
|
69
|
+
writeFileSync(join(root, file), minifyUi(readFileSync(join(root, file), "utf8"), file));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const SOURCE_MAP_COMMENT = /(?:\/\/[#@]\s*sourceMappingURL\s*=|\/\*[#@]\s*sourceMappingURL\s*=|<!--[#@]\s*sourceMappingURL\s*=)/;
|
|
73
|
+
const SECRET_PATTERNS = [
|
|
74
|
+
["private-key", /-----BEGIN (?:[A-Z0-9]+ )*PRIVATE KEY(?: BLOCK)?-----/],
|
|
75
|
+
["github-token", /\b(?:ghp_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/],
|
|
76
|
+
["npm-token", /\bnpm_[A-Za-z0-9]{20,}\b/],
|
|
77
|
+
["npm-auth-token", /_authToken\s*=\s*[^\s"'`]+/],
|
|
78
|
+
["aws-access-key", /\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/],
|
|
79
|
+
["aws-secret-key", /(?:["']?aws_secret_access_key["']?)\s*[:=]\s*["']?[A-Za-z0-9/+=]{40}(?![A-Za-z0-9/+=])/i],
|
|
80
|
+
];
|
|
81
|
+
// Common field captions are public text, not embedded credential defaults.
|
|
82
|
+
// Only object captions are recognized; password="Password" still fails.
|
|
83
|
+
const PASSWORD_CAPTIONS = new Set([
|
|
84
|
+
"password", "user password", "密碼", "使用者密碼", "密码", "用户密码",
|
|
85
|
+
"パスワード", "ユーザーパスワード", "암호", "비밀번호", "사용자 비밀번호",
|
|
86
|
+
"passwort", "benutzerpasswort", "mot de passe", "mot de passe utilisateur",
|
|
87
|
+
"contraseña", "contraseña de usuario", "password utente",
|
|
88
|
+
]);
|
|
89
|
+
function credentialLiteral(content) {
|
|
90
|
+
const literals = /(?:^|[,{])\s*(?:"(password|secret)"|'(password|secret)'|(password|secret))\s*:\s*(?:"([^"\r\n]+)"|'([^'\r\n]+)'|`([^`$\r\n]+)`|(\d+(?:\.\d+)?)\b)/gi;
|
|
91
|
+
for (const match of content.matchAll(literals)) {
|
|
92
|
+
const key = match[1] ?? match[2] ?? match[3];
|
|
93
|
+
const value = match[4] ?? match[5] ?? match[6] ?? match[7];
|
|
94
|
+
const caption = value.replace(/\\(?:u([0-9a-f]{4})|x([0-9a-f]{2}))/gi, (_escape, unicode, hex) => String.fromCharCode(parseInt(unicode ?? hex, 16))).toLowerCase();
|
|
95
|
+
if (key.toLowerCase() === "password" && PASSWORD_CAPTIONS.has(caption))
|
|
96
|
+
continue;
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
return /(?:^|[^\w$"'`])(?:password|secret)\s*=\s*(?:"[^"\r\n]+"|'[^'\r\n]+'|`[^`$\r\n]+`|\d+(?:\.\d+)?\b)|["'`](?:password|secret)=[^"'`\s]+/i.test(content);
|
|
100
|
+
}
|
|
101
|
+
export function uiFileProblems(file, content) {
|
|
102
|
+
const found = [];
|
|
103
|
+
const name = basename(file).toLowerCase();
|
|
104
|
+
if (name === ".env" || name.startsWith(".env."))
|
|
105
|
+
found.push({ file, pattern: "environment-file" });
|
|
106
|
+
if (file.toLowerCase().endsWith(".map"))
|
|
107
|
+
found.push({ file, pattern: "source-map-file" });
|
|
108
|
+
if (SOURCE_MAP_COMMENT.test(content))
|
|
109
|
+
found.push({ file, pattern: "sourceMappingURL" });
|
|
110
|
+
for (const [pattern, match] of SECRET_PATTERNS)
|
|
111
|
+
if (match.test(content))
|
|
112
|
+
found.push({ file, pattern });
|
|
113
|
+
if (credentialLiteral(content))
|
|
114
|
+
found.push({ file, pattern: "credential-literal" });
|
|
115
|
+
// Unquoted values in environment/config/HTML text; JS variable assignments are not literals.
|
|
116
|
+
if (!isUiBundle(file) && /(?:^|[^\w$])(?:password|secret)\s*=\s*[^\s"'`<>{};,]+/i.test(content))
|
|
117
|
+
if (!found.some(item => item.pattern === "credential-literal"))
|
|
118
|
+
found.push({ file, pattern: "credential-literal" });
|
|
119
|
+
return found;
|
|
120
|
+
}
|
|
121
|
+
export function logicalUiFile(file, moduleVersion) {
|
|
122
|
+
const prefix = moduleVersion ? `app/${moduleVersion}/` : "";
|
|
123
|
+
return prefix && file.startsWith(prefix) ? `app/${file.slice(prefix.length)}` : file;
|
|
124
|
+
}
|
|
125
|
+
export function applyUiIgnores(problems, ignores, moduleVersion) {
|
|
126
|
+
return problems.map(problem => {
|
|
127
|
+
// Source maps are never exempted by a secret-scan exception.
|
|
128
|
+
const ignore = !["source-map-file", "sourceMappingURL"].includes(problem.pattern) &&
|
|
129
|
+
ignores.find(item => item.file === logicalUiFile(problem.file, moduleVersion));
|
|
130
|
+
return ignore ? { ...problem, ignored: ignore.reason } : problem;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
export function scanUiTree(root, ignores = [], moduleVersion) {
|
|
134
|
+
const problems = uiFiles(root).flatMap(file => uiFileProblems(file, readFileSync(join(root, file), "utf8")));
|
|
135
|
+
return applyUiIgnores(problems, ignores, moduleVersion);
|
|
136
|
+
}
|
|
137
|
+
export function enforcePublicUi(root, ignores = [], moduleVersion) {
|
|
138
|
+
const files = new Set(uiFiles(root).map(file => logicalUiFile(file, moduleVersion)));
|
|
139
|
+
for (const ignore of ignores)
|
|
140
|
+
if (!files.has(ignore.file))
|
|
141
|
+
throw Object.assign(new Error(`ui_secret_ignores file does not exist: ui/${ignore.file}`), { code: "UI_SECRET_IGNORE_MISSING" });
|
|
142
|
+
const problems = scanUiTree(root, ignores, moduleVersion);
|
|
143
|
+
for (const problem of problems.filter(item => item.ignored))
|
|
144
|
+
console.warn(`[UI_SECRET_IGNORED] ui/${problem.file}: ${problem.pattern}; reason: ${problem.ignored}`);
|
|
145
|
+
const errors = problems.filter(item => !item.ignored);
|
|
146
|
+
if (errors.length)
|
|
147
|
+
throw Object.assign(new Error(errors.map(item => `ui/${item.file}: ${item.pattern}`).join("\n")), { code: "PUBLIC_UI_UNSAFE", hint: "Files under ui/ are public. Remove credentials and source maps; only false positives may use ui_secret_ignores with a reason." });
|
|
148
|
+
}
|
|
149
|
+
export function publicUiReport(files) {
|
|
150
|
+
const bundles = files.filter(item => isUiBundle(item.file));
|
|
151
|
+
const sourceMaps = files.filter(item => item.file.toLowerCase().endsWith(".map") || SOURCE_MAP_COMMENT.test(item.content)).map(item => item.file);
|
|
152
|
+
// Report older or third-party bundles without rejecting their formatting.
|
|
153
|
+
const unminified = bundles.filter(item => {
|
|
154
|
+
try {
|
|
155
|
+
const compact = minifyUi(item.content, item.file);
|
|
156
|
+
const whitespace = (text) => (text.match(/\s/g) ?? []).length;
|
|
157
|
+
return whitespace(item.content) > whitespace(compact) + Math.max(8, compact.length * 0.02);
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
}).map(item => item.file);
|
|
163
|
+
return { minified: !unminified.length, sourceMapFree: !sourceMaps.length, bundles: bundles.length, unminified, sourceMaps };
|
|
164
|
+
}
|
package/dist/standalone/spk.js
CHANGED
|
@@ -28,6 +28,7 @@ import { createReproducibleTar } from "../build-spk/reproducible-archive.js";
|
|
|
28
28
|
import { renderStandaloneScript } from "./lifecycle.js";
|
|
29
29
|
import { APP_SCRIPTS_DIR, APP_SCRIPTS_SPK_DIR } from "./app-scripts.js";
|
|
30
30
|
import { MODULE_UI_ENTRY, uiTreeDigest } from "./ui-assets.js";
|
|
31
|
+
import { enforcePublicUi, isUiBundle, logicalUiFile, minifyUi, minifyUiTree, uiFiles } from "./public-ui.js";
|
|
31
32
|
import { codedMessage } from "../errors.js";
|
|
32
33
|
import { DSM_LANGS, LOCALES } from "./i18n.js";
|
|
33
34
|
import { appTitle, CGI_PAYLOAD_PATH, hasSdkWindow, renderUiConfig, renderWindowScript, windowScriptName, } from "./dsm-window.js";
|
|
@@ -101,6 +102,7 @@ export async function assembleStandaloneSpk(options) {
|
|
|
101
102
|
copyUiTree(manifest.ui.dir, appDir, manifest.root);
|
|
102
103
|
else
|
|
103
104
|
mkdirSync(appDir, { recursive: true });
|
|
105
|
+
minifyUiTree(appDir);
|
|
104
106
|
const moduleUi = hasSdkWindow(manifest) && existsSync(join(appDir, MODULE_UI_ENTRY));
|
|
105
107
|
const uiDigest = uiTreeDigest(appDir, moduleUi);
|
|
106
108
|
const mobile = await renderMobileAssets(manifest, uiDigest, moduleUi ? uiDigest : undefined);
|
|
@@ -266,10 +268,26 @@ export async function assembleStandaloneSpk(options) {
|
|
|
266
268
|
...(variant.daemon || variant.compose ? { 'daemon/config.json': daemonConfig(variant) } : {}),
|
|
267
269
|
...(variant.installSettings ? { 'install/settings.json': JSON.stringify(settingsConfig(variant), null, 2) + '\n' } : {}),
|
|
268
270
|
}));
|
|
271
|
+
// App bytes were minified before their digest; mobile builds its own final inventory.
|
|
272
|
+
minifyUiTree(uiRoot, ["app"]);
|
|
273
|
+
if (manifest.installPorts) {
|
|
274
|
+
const file = join(staging, "package/install/ports.json");
|
|
275
|
+
const ports = JSON.parse(readFileSync(file, "utf8"));
|
|
276
|
+
for (const [path, text] of Object.entries(ports.files)) {
|
|
277
|
+
if (!path.startsWith("ui/") || !isUiBundle(path))
|
|
278
|
+
continue;
|
|
279
|
+
// Preserve installer placeholders through the JS parser as unbound identifiers.
|
|
280
|
+
ports.files[path] = minifyUi(String(text).replace(/@@PORT_([a-z_]+)@@/g, "__SPL_PORT_$1__"), path)
|
|
281
|
+
.replace(/__SPL_PORT_([a-z_]+)__/g, "@@PORT_$1@@");
|
|
282
|
+
}
|
|
283
|
+
writeFileSync(file, JSON.stringify(ports, null, 2) + "\n");
|
|
284
|
+
}
|
|
285
|
+
enforcePublicUi(uiRoot, manifest.uiSecretIgnores, moduleVersion);
|
|
286
|
+
const ignoredUi = uiFiles(uiRoot).filter(file => manifest.uiSecretIgnores?.some(ignore => ignore.file === logicalUiFile(file, moduleVersion))).map(file => `ui/${file}`);
|
|
269
287
|
const packageTgz = join(staging, "package.tgz");
|
|
270
288
|
await createReproducibleTar(join(staging, "package"), packageTgz, {
|
|
271
289
|
rejectSecrets: true,
|
|
272
|
-
allowSecretFiles: manifest.allowSecretFiles,
|
|
290
|
+
allowSecretFiles: [...new Set([...(manifest.allowSecretFiles ?? []), ...ignoredUi])],
|
|
273
291
|
gzip: true,
|
|
274
292
|
});
|
|
275
293
|
rmSync(join(staging, "package"), { recursive: true, force: true });
|
|
@@ -278,6 +296,7 @@ export async function assembleStandaloneSpk(options) {
|
|
|
278
296
|
.digest("hex");
|
|
279
297
|
writeFile(join(staging, "sdk-package.json"), JSON.stringify({
|
|
280
298
|
schema: 2,
|
|
299
|
+
...(manifest.uiSecretIgnores?.length ? { ui_secret_ignores: manifest.uiSecretIgnores } : {}),
|
|
281
300
|
...(manifest.tcpListeners ? { tcp_listeners: manifest.tcpListeners } : {}),
|
|
282
301
|
...(mobile ? { mobile: mobile.record } : {}),
|
|
283
302
|
dependencies: packageDependencies(manifest),
|
|
@@ -17,20 +17,20 @@ export function readTCPListeners(raw) {
|
|
|
17
17
|
invalid(`${id}: use a lowercase letter followed by lowercase letters, digits or underscores (max 64); accepted fields: scope, port, port_range.`);
|
|
18
18
|
const v = value;
|
|
19
19
|
const scope = v.scope === undefined ? 'loopback' : v.scope;
|
|
20
|
-
if (scope !== 'loopback')
|
|
21
|
-
invalid(`${id}.scope must be loopback (default,
|
|
20
|
+
if (scope !== 'loopback' && scope !== 'all')
|
|
21
|
+
invalid(`${id}.scope must be loopback (default, 127.0.0.1) or explicit all (0.0.0.0), IPv4 only.`);
|
|
22
22
|
if (!Number.isInteger(v.port) || Number(v.port) < 1024 || Number(v.port) > 65535)
|
|
23
23
|
invalid(`${id}.port must be an integer from 1024 to 65535.`);
|
|
24
24
|
const range = v.port_range;
|
|
25
25
|
if (range !== undefined && (!Array.isArray(range) || range.length !== 2 || range.some(p => !Number.isInteger(p) || p < 1024 || p > 65535) || range[0] > range[1] || Number(v.port) < range[0] || Number(v.port) > range[1]))
|
|
26
26
|
invalid(`${id}.port_range must be [min,max] within 1024..65535 and include port; omit it to allow only port.`);
|
|
27
|
-
result[id] = { scope:
|
|
27
|
+
result[id] = { scope: scope, port: v.port, ...(range !== undefined ? { port_range: range } : {}) };
|
|
28
28
|
}
|
|
29
29
|
const entries = Object.entries(result);
|
|
30
30
|
for (let i = 0; i < entries.length; i++)
|
|
31
31
|
for (let j = i + 1; j < entries.length; j++)
|
|
32
32
|
if (entries[i][1].port === entries[j][1].port)
|
|
33
|
-
invalid(`${entries[j][0]} default port conflicts with ${entries[i][0]}; loopback bindings share the IPv4 port space.`);
|
|
33
|
+
invalid(`${entries[j][0]} default port conflicts with ${entries[i][0]}; all and loopback bindings share the IPv4 port space.`);
|
|
34
34
|
return result;
|
|
35
35
|
}
|
|
36
36
|
export function tcpSDKProblem(backend) {
|
package/dist/validate.js
CHANGED
|
@@ -4,6 +4,7 @@ import { existsSync } from "node:fs";
|
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { getErrorCode } from "./error-registry.js";
|
|
6
6
|
import { loadStandaloneManifest } from "./standalone/manifest.js";
|
|
7
|
+
import { applyUiIgnores, scanUiTree } from "./standalone/public-ui.js";
|
|
7
8
|
import { isNativeLayout, loadNativeLayout, } from "./standalone/native-layout.js";
|
|
8
9
|
import { manifestPolicyProblem } from "./runtime/executor-policy-check.js";
|
|
9
10
|
/** All shipped Compose and native projects use the schema-2 build path. */
|
|
@@ -39,6 +40,34 @@ export function validateProject(project, _options = {}) {
|
|
|
39
40
|
})),
|
|
40
41
|
...secrets.filter(item => item.severity === "error"),
|
|
41
42
|
];
|
|
43
|
+
if (loaded.ok) {
|
|
44
|
+
const manifest = loaded.manifest;
|
|
45
|
+
const roots = "ui" in manifest
|
|
46
|
+
? [{ dir: manifest.ui.dir, prefix: "app/" }]
|
|
47
|
+
: manifest.arches.map(arch => ({ dir: join(manifest.root, manifest.layout.payload.replaceAll("{arch}", arch), "ui"), prefix: "" }));
|
|
48
|
+
for (const { dir, prefix } of roots) {
|
|
49
|
+
if (!existsSync(dir))
|
|
50
|
+
continue; // A build hook may not have produced its output yet.
|
|
51
|
+
try {
|
|
52
|
+
const ui = applyUiIgnores(scanUiTree(dir).map(item => ({ ...item, file: prefix + item.file })), manifest.uiSecretIgnores ?? []);
|
|
53
|
+
for (const item of ui) {
|
|
54
|
+
const finding = {
|
|
55
|
+
code: item.ignored ? "UI_SECRET_IGNORED" : "PUBLIC_UI_UNSAFE",
|
|
56
|
+
span: { file: `ui/${item.file}`, line: 1, column: 1 },
|
|
57
|
+
message: `${item.pattern}${item.ignored ? `; reason: ${item.ignored}` : ""}`,
|
|
58
|
+
suggestion: "Files under ui/ are public. Remove credentials and source maps; false positives require ui_secret_ignores with a reason.",
|
|
59
|
+
};
|
|
60
|
+
if (item.ignored)
|
|
61
|
+
warnings.push(finding);
|
|
62
|
+
else
|
|
63
|
+
problems.push(finding);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
problems.push({ code: "PUBLIC_UI_SCAN_FAILED", span: { file: "ui/", line: 1, column: 1 }, message: "Cannot read public UI files.", suggestion: "Use only readable regular files and directories." });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
42
71
|
return problems.length
|
|
43
72
|
? {
|
|
44
73
|
ok: false,
|
package/package.json
CHANGED
|
@@ -7,6 +7,19 @@
|
|
|
7
7
|
"required": ["schema"],
|
|
8
8
|
"properties": {
|
|
9
9
|
"schema": {"type": "integer", "const": 2},
|
|
10
|
+
"ui_secret_ignores": {
|
|
11
|
+
"description": "False-positive exceptions for public UI secret scanning. Exact paths relative to ui/; omit a module snapshot hash (app/help.json). Source maps cannot be ignored.",
|
|
12
|
+
"type": "array",
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"required": ["file", "reason"],
|
|
16
|
+
"properties": {
|
|
17
|
+
"file": {"type": "string", "minLength": 1, "pattern": "^(?![\\s\\S]*(?:^|/)\\.{1,2}(?:/|$))[^/\\\\*?\\[\\]{}:\\u0000-\\u001f\\u007f]+(?:/[^/\\\\*?\\[\\]{}:\\u0000-\\u001f\\u007f]+)*$(?![\\s\\S])"},
|
|
18
|
+
"reason": {"type": "string", "pattern": "\\S"}
|
|
19
|
+
},
|
|
20
|
+
"additionalProperties": false
|
|
21
|
+
}
|
|
22
|
+
},
|
|
10
23
|
"allow_secret_files": {
|
|
11
24
|
"description": "Exact payload-relative files exempted from the SPK secret guard only. Do not use for credentials; prefer generating keys at install/runtime. Every entry must exist when packing.",
|
|
12
25
|
"type": "array",
|
|
@@ -25,7 +38,7 @@
|
|
|
25
38
|
"type": "object",
|
|
26
39
|
"required": ["port"],
|
|
27
40
|
"properties": {
|
|
28
|
-
"scope": {"enum": ["loopback"], "default": "loopback"},
|
|
41
|
+
"scope": {"enum": ["loopback", "all"], "default": "loopback"},
|
|
29
42
|
"port": {"type": "integer", "minimum": 1024, "maximum": 65535},
|
|
30
43
|
"port_range": {"type": "array", "minItems": 2, "maxItems": 2, "items": {"type": "integer", "minimum": 1024, "maximum": 65535}}
|
|
31
44
|
},
|
package/skills/SKILL.md
CHANGED
|
@@ -5,10 +5,12 @@ description: Initialize, extend, check, build, inspect, and deploy Synology appl
|
|
|
5
5
|
|
|
6
6
|
# Independent Synology SPKs
|
|
7
7
|
|
|
8
|
+
Files under ui/ (including mobile.json and entry.html) are public static files readable without sign-in; never put secrets there. Access control is the EntryGate/backend.
|
|
9
|
+
|
|
8
10
|
For native DSM strings and fixed desktop notifications, read
|
|
9
11
|
[reference/dsm-texts.md](reference/dsm-texts.md) (`synopkgland skill show dsm-texts`).
|
|
10
|
-
For
|
|
11
|
-
|
|
12
|
+
For raw TCP protocols (`scope: loopback` by default, or `scope: all` for all IPv4
|
|
13
|
+
interfaces), read [reference/raw-tcp.md](reference/raw-tcp.md)
|
|
12
14
|
(`synopkgland skill show raw-tcp`).
|
|
13
15
|
|
|
14
16
|
For mobile registration, entry pages and native-shell capabilities, read
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Mobile Apps
|
|
2
2
|
|
|
3
|
+
Files under ui/ (including mobile.json and entry.html) are public static files readable without sign-in; never put secrets there. Access control is the EntryGate/backend.
|
|
4
|
+
|
|
3
5
|
Declare `mobile` in `dsm-package.yaml`. Both `admin-only` and `app-privilege`
|
|
4
6
|
Apps may register. DSM entry and backend permissions still apply to every request.
|
|
5
7
|
A portal is optional; without it the App stays on its entry URL.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
the native Go package's build-bound manifest declaration. This supports private
|
|
5
5
|
protocols such as a loopback SMTP relay without permitting arbitrary `net.Listen`
|
|
6
6
|
constructors in shipped application binaries. The CLI and Go SDK use TCP policy
|
|
7
|
-
v1 with loopback-
|
|
7
|
+
v1 with loopback or all-interface declarations.
|
|
8
8
|
|
|
9
9
|
```yaml
|
|
10
10
|
# dsm-package.yaml, schema 2
|
|
@@ -26,9 +26,10 @@ defer listener.Close()
|
|
|
26
26
|
|
|
27
27
|
A zero requested port selects the manifest default, rather than an ephemeral
|
|
28
28
|
port. Without `port_range`, only that fixed default is allowed. All ports must
|
|
29
|
-
be unprivileged integers, 1024–65535.
|
|
30
|
-
`tcp4` on `127.0.0.1
|
|
31
|
-
|
|
29
|
+
be unprivileged integers, 1024–65535. Only the declaration selects the address:
|
|
30
|
+
`scope: loopback` (default) means `tcp4` on `127.0.0.1`; explicit `scope: all`
|
|
31
|
+
means `tcp4` on `0.0.0.0`, exposed on all IPv4 interfaces. IPv6, DNS names,
|
|
32
|
+
arbitrary host strings and privileged ports are unsupported. Names use lowercase ASCII letters, digits and underscores,
|
|
32
33
|
start with a letter and have at most 64 characters. At most 64 declarations are
|
|
33
34
|
allowed. Duplicate default ports fail CLI validation; overlapping configurable
|
|
34
35
|
ranges are allowed and runtime binding decides conflicts. No DSM firewall rule,
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Vue UI for DSM apps
|
|
2
2
|
|
|
3
|
+
Files under ui/ (including mobile.json and entry.html) are public static files readable without sign-in; never put secrets there. Access control is the EntryGate/backend.
|
|
4
|
+
|
|
5
|
+
`build` minifies packaged JS/CSS and removes `.map` files and their JS/CSS comments.
|
|
6
|
+
`check` scans the current UI output; `check path/to/package.spk` scans the final
|
|
7
|
+
archived public payload, including generated scripts. Build also scans that payload.
|
|
8
|
+
Keep LICENSES files in the output. For a verified false positive, declare an exact
|
|
9
|
+
file relative to `ui/` with a reason (omit the module snapshot hash):
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
ui_secret_ignores:
|
|
13
|
+
- file: app/help.json
|
|
14
|
+
reason: Documentation example containing a deliberately fake credential
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Exceptions are recorded in the SPK and reported during inspection. They never
|
|
18
|
+
allow source maps and do not bypass repository secret checks.
|
|
19
|
+
|
|
3
20
|
## Choose Vue or JSON
|
|
4
21
|
|
|
5
22
|
The native-go Vue template writes Vue components directly. Keep Vue for existing
|