@synopackageland/cli 0.53.2 → 0.53.4
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 +9 -0
- package/README.md +5 -0
- package/dist/runtime/approval-diff.d.ts +5 -0
- package/dist/runtime/approval-diff.js +19 -4
- package/dist/spk/check-payload.js +7 -7
- package/dist/standalone/inspect-spk.d.ts +2 -0
- package/dist/standalone/inspect-spk.js +10 -5
- package/dist/standalone/public-ui.d.ts +1 -1
- package/dist/standalone/public-ui.js +27 -5
- package/dist/standalone/resource.d.ts +7 -0
- package/dist/standalone/resource.js +26 -1
- package/package.json +1 -1
- package/skills/reference/approval-upgrades.md +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.53.4 (2026-11-10)
|
|
4
|
+
|
|
5
|
+
- Recognize ELF, Mach-O and PE content in public UI scans, so compiled CGI string pools do not trigger source-syntax `credential-literal` false positives. Text-file rules stay unchanged; executable content still fails private-key, known token, environment-file and source-map checks. Known token signatures in executables no longer require word boundaries between pooled constants.
|
|
6
|
+
|
|
7
|
+
## 0.53.3 (2026-11-10)
|
|
8
|
+
|
|
9
|
+
- Accept exact released Portal ingress resource contracts when inspecting an approval baseline, including daemon and identity gateway SPKs built before their Portal `www` registration was introduced. Current SPKs still require the current resource contract; extra workers, duplicate registrations, changed file paths and invalid payload or executor pins still fail inspection.
|
|
10
|
+
- Include archived DSM `resource_changes` in build/inspect approval JSON and text. Adding an ingress registration, including Portal `www` on ports 80/443, reports `permissions: expanded` and `retention: required` even when executor policy and tasks are unchanged; other resource changes require review.
|
|
11
|
+
|
|
3
12
|
## 0.53.2 (2026-11-10)
|
|
4
13
|
|
|
5
14
|
- Enable identity gateway path ingress on the Application Portal default web server (80/443) when the App declares `portal`, including custom paths, OIDC, header login, entry gates and upstream API/share routes. All path ingress resources share the same Portal registration rule and nginx files; Apps without a portal or path ingress and dedicated-port listeners retain their behavior.
|
package/README.md
CHANGED
|
@@ -706,6 +706,11 @@ For same-origin App URLs, see [DSM path ingress](docs/path-ingress.md).
|
|
|
706
706
|
|
|
707
707
|
### CLI release checks
|
|
708
708
|
|
|
709
|
+
Public UI scans distinguish ELF, Mach-O and PE content from text, including
|
|
710
|
+
compiled CGI files. Executables retain private-key and known token checks;
|
|
711
|
+
source-syntax credential checks apply to text. See the
|
|
712
|
+
[public UI scan policy](docs/release-checks.md#public-ui-scans) for coverage and limits.
|
|
713
|
+
|
|
709
714
|
`pnpm run gates` runs basic checks and is the default for release packaging and CI.
|
|
710
715
|
Use `pnpm run gates:full` only when explicitly requested. See
|
|
711
716
|
[release entry points and checks](docs/release-checks.md) for the complete inventory.
|
|
@@ -30,6 +30,11 @@ export interface ApprovalDifference {
|
|
|
30
30
|
old: unknown;
|
|
31
31
|
new: unknown;
|
|
32
32
|
}>;
|
|
33
|
+
resource_changes?: Array<{
|
|
34
|
+
path: string;
|
|
35
|
+
old: unknown;
|
|
36
|
+
new: unknown;
|
|
37
|
+
}>;
|
|
33
38
|
reason: string;
|
|
34
39
|
}
|
|
35
40
|
export declare function approvalDiff(old: ApprovalInventory | undefined, next: ApprovalInventory | undefined): ApprovalDifference;
|
|
@@ -47,6 +47,22 @@ function noApproval(r) {
|
|
|
47
47
|
function notRequired() {
|
|
48
48
|
return { retention: 'not-required', permissions: 'unchanged', executor_only: false, task_template_changed: false, root_programs: [], policy_changes: [], reason: 'No SDK administrator approval is required: this verified package has no executor or approval-requiring capability.' };
|
|
49
49
|
}
|
|
50
|
+
/** Resource registration changes are authority changes, even with identical executor pins. */
|
|
51
|
+
function resourceDiff(old, next, diff) {
|
|
52
|
+
if (!next.dsm.ok || next.findings.length || !old.synopkgland || !next.synopkgland || old.package !== next.package || old.arch !== next.arch)
|
|
53
|
+
return diff;
|
|
54
|
+
const resource_changes = changes(old.resources ?? {}, next.resources ?? {});
|
|
55
|
+
if (!resource_changes.length)
|
|
56
|
+
return diff;
|
|
57
|
+
const ingress = (r) => (r.resources?.['web-config']?.['nginx-static-config']?.enable ?? []);
|
|
58
|
+
const previous = new Set(ingress(old).map(canonical));
|
|
59
|
+
const expanded = ingress(next).some(entry => !previous.has(canonical(entry)));
|
|
60
|
+
return { ...diff, resource_changes, retention: 'required', executor_only: false,
|
|
61
|
+
permissions: expanded || diff.permissions === 'expanded' ? 'expanded' : 'review-required',
|
|
62
|
+
reason: expanded
|
|
63
|
+
? 'Administrator review and reapproval are required: nginx-static-config gained an ingress registration (including Portal www on ports 80/443). Unchanged executor pins do not approve wider access.'
|
|
64
|
+
: 'Administrator review and reapproval are required for changed DSM resource registrations.' };
|
|
65
|
+
}
|
|
50
66
|
export async function spkApprovalDiff(current, baseline, report) {
|
|
51
67
|
const nextReport = report ?? await inspectAnySpk(current);
|
|
52
68
|
if (!baseline)
|
|
@@ -55,11 +71,10 @@ export async function spkApprovalDiff(current, baseline, report) {
|
|
|
55
71
|
const old = await inspectAnySpk(baseline, { baseline: true });
|
|
56
72
|
if (!old.dsm.ok || old.findings.length)
|
|
57
73
|
throw new Error('[APPROVAL_BASELINE_INVALID] Baseline SPK failed inspection: ' + [...old.findings, ...old.dsm.errors.map(e => e.message)].join('; '));
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return approvalDiff(inventory(old), next);
|
|
74
|
+
const diff = old.package === nextReport.package && old.arch === nextReport.arch && noApproval(old) && noApproval(nextReport) ? notRequired() : approvalDiff(inventory(old), next);
|
|
75
|
+
return resourceDiff(old, nextReport, diff);
|
|
61
76
|
}
|
|
62
77
|
export function formatApprovalDiff(d) {
|
|
63
78
|
const short = (s) => s?.slice(0, 12) ?? '—';
|
|
64
|
-
return ['Approval: ' + d.reason, 'Permissions: ' + d.permissions, ...d.root_programs.map(p => `Root program ${p.name}: ${short(p.old)} → ${short(p.new)}`), ...d.policy_changes.map(c => `Policy ${c.path}: ${JSON.stringify(c.old)} → ${JSON.stringify(c.new)}`), `Task template: ${d.task_template_changed === null ? 'unknown' : d.task_template_changed ? 'changed' : 'unchanged'}`, `Executor-only handover: ${d.executor_only ? 'eligible under the INFO anchor' : 'not established'}`].join('\n');
|
|
79
|
+
return ['Approval: ' + d.reason, 'Permissions: ' + d.permissions, ...d.root_programs.map(p => `Root program ${p.name}: ${short(p.old)} → ${short(p.new)}`), ...d.policy_changes.map(c => `Policy ${c.path}: ${JSON.stringify(c.old)} → ${JSON.stringify(c.new)}`), ...(d.resource_changes ?? []).map(c => `Resource ${c.path}: ${JSON.stringify(c.old)} → ${JSON.stringify(c.new)}`), `Task template: ${d.task_template_changed === null ? 'unknown' : d.task_template_changed ? 'changed' : 'unchanged'}`, `Executor-only handover: ${d.executor_only ? 'eligible under the INFO anchor' : 'not established'}`].join('\n');
|
|
65
80
|
}
|
|
@@ -49,7 +49,7 @@ async function scanPayload(payloadPath, wanted, findings) {
|
|
|
49
49
|
chunks.push(chunk);
|
|
50
50
|
});
|
|
51
51
|
entry.on("end", () => { if (keep)
|
|
52
|
-
file.
|
|
52
|
+
file.content = Buffer.concat(chunks); });
|
|
53
53
|
files.push(file);
|
|
54
54
|
},
|
|
55
55
|
});
|
|
@@ -84,9 +84,9 @@ function checkEntryPath(path, type, linkpath, findings) {
|
|
|
84
84
|
function ownSections(files) {
|
|
85
85
|
const sections = new Set();
|
|
86
86
|
for (const file of files) {
|
|
87
|
-
if (!/(^|\/)texts\/[^/]+\/strings$/.test(file.path) || file.
|
|
87
|
+
if (!/(^|\/)texts\/[^/]+\/strings$/.test(file.path) || file.content === undefined)
|
|
88
88
|
continue;
|
|
89
|
-
for (const match of file.
|
|
89
|
+
for (const match of file.content.toString("utf8").matchAll(/^\s*\[([^\]]+)\]\s*$/gm))
|
|
90
90
|
sections.add(match[1]);
|
|
91
91
|
}
|
|
92
92
|
return sections;
|
|
@@ -99,7 +99,7 @@ function ownSections(files) {
|
|
|
99
99
|
function checkUiConfig(file, sections, findings) {
|
|
100
100
|
let config;
|
|
101
101
|
try {
|
|
102
|
-
config = JSON.parse(file.
|
|
102
|
+
config = JSON.parse(file.content?.toString("utf8") ?? "");
|
|
103
103
|
}
|
|
104
104
|
catch { /* reported below */ }
|
|
105
105
|
if (typeof config !== "object" || config === null || Array.isArray(config)) {
|
|
@@ -165,16 +165,16 @@ export async function checkPayload(payloadPath, info, findings, policy = {}) {
|
|
|
165
165
|
checkElf(files, info.arch, findings);
|
|
166
166
|
const ui = files.filter(file => file.path.startsWith("ui/"));
|
|
167
167
|
for (const file of ui) {
|
|
168
|
-
if (file.
|
|
168
|
+
if (file.content === undefined) {
|
|
169
169
|
findings.add("SPK_UI_UNSAFE", "Public UI file exceeds the 64 MiB scan limit.", at(file.path));
|
|
170
170
|
continue;
|
|
171
171
|
}
|
|
172
|
-
const problems = applyUiIgnores(uiFileProblems(file.path.slice(3), file.
|
|
172
|
+
const problems = applyUiIgnores(uiFileProblems(file.path.slice(3), file.content), policy.ignores ?? [], policy.moduleVersion);
|
|
173
173
|
for (const problem of problems) {
|
|
174
174
|
if (policy.sourceMaps === false && ["source-map-file", "sourceMappingURL"].includes(problem.pattern))
|
|
175
175
|
continue;
|
|
176
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
177
|
}
|
|
178
178
|
}
|
|
179
|
-
return publicUiReport(ui.filter(file => file.
|
|
179
|
+
return publicUiReport(ui.filter(file => file.content !== undefined).map(file => ({ file: file.path, content: file.content.toString("utf8") })));
|
|
180
180
|
}
|
|
@@ -13,6 +13,8 @@ import type { EntryMode } from "./manifest.js";
|
|
|
13
13
|
import { type UninstallCleanupItem } from "../runtime/uninstall-cleanup.js";
|
|
14
14
|
export type SpkKind = "native-go" | "native-python" | "native-node" | "native-rust" | "binary" | "container" | "native-layout";
|
|
15
15
|
export interface SpkInspection {
|
|
16
|
+
/** Declaration-checked DSM worker registrations, preserved as archived. */
|
|
17
|
+
resources?: Record<string, unknown>;
|
|
16
18
|
publicUi?: PublicUiReport;
|
|
17
19
|
/** Archived DSM language -> native section -> sorted keys (no text values). */
|
|
18
20
|
nativeTexts?: Record<string, Record<string, string[]>>;
|
|
@@ -46,7 +46,7 @@ import { readUninstallRecord, stateItemTexts } from "./uninstall.js";
|
|
|
46
46
|
import { DSM_LANGS } from "./i18n.js";
|
|
47
47
|
import { BACKGROUND_UNIT_DIR, BACKGROUND_WORKER_PAYLOAD, BRIDGE_WORKER_ARGS, backgroundUnitName, renderBackgroundUnit, } from "./background.js";
|
|
48
48
|
import { matchesComposeWorkerResource } from '../build-spk/resource-worker.js';
|
|
49
|
-
import { renderStandaloneResource } from "./resource.js";
|
|
49
|
+
import { matchesStandaloneResource, renderStandaloneResource } from "./resource.js";
|
|
50
50
|
import { recoverSharedFolder, renderUpgradeWizardFiles, sharedFolderInstallSteps, SHARED_FOLDER_MARKER, } from "./shared-folder.js";
|
|
51
51
|
import { renderInstallWizardFiles, integrationWizardSteps, renderNativeInstallWizard, } from "../build-spk/install-wizard.js";
|
|
52
52
|
import { renderDelegateScopeSteps, } from "../build-spk/delegate-scope.js";
|
|
@@ -270,7 +270,7 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
|
|
|
270
270
|
!isDsmAtLeast(info.os_min_ver, PORTAL_MIN_DSM)) {
|
|
271
271
|
findings.push(`INFO os_min_ver "${info.os_min_ver}" is below the DSM ${PORTAL_MIN_DSM} a portal needs; ${PORTAL_MIN_DSM_REASON}`);
|
|
272
272
|
}
|
|
273
|
-
checkConf(dir, findings, kind, background, sharedFolder, info.package, portal, combined?.compose, nativeGateway, info.os_min_ver, daemonIngress, Boolean(metadata.installPorts), daemonNoFile);
|
|
273
|
+
const resources = checkConf(dir, findings, kind, background, sharedFolder, info.package, portal, combined?.compose, nativeGateway, info.os_min_ver, daemonIngress, Boolean(metadata.installPorts), daemonNoFile, options.baseline);
|
|
274
274
|
checkScripts(dir, findings);
|
|
275
275
|
checkUninstall(dir, findings);
|
|
276
276
|
if (kind === "container")
|
|
@@ -364,6 +364,7 @@ export async function inspectSpk(spkPath, expectedKind, options = {}) {
|
|
|
364
364
|
findings.push(`${CGI_PAYLOAD_PATH} has mode ${cgiEntry.mode}; it should be 0755`);
|
|
365
365
|
}
|
|
366
366
|
return {
|
|
367
|
+
...(resources ? { resources } : {}),
|
|
367
368
|
...(dependencies ? { dependencies } : {}),
|
|
368
369
|
kind,
|
|
369
370
|
...(nativeTexts ? { nativeTexts } : {}),
|
|
@@ -1396,7 +1397,7 @@ async function recoverDaemonIngress(dir, value, info, paths, findings) {
|
|
|
1396
1397
|
return undefined;
|
|
1397
1398
|
}
|
|
1398
1399
|
}
|
|
1399
|
-
function checkConf(dir, findings, kind, background, sharedFolder, pkg, portal, compose, nativeGateway, osMinVer, daemonIngress, installPorts = false, nofile) {
|
|
1400
|
+
function checkConf(dir, findings, kind, background, sharedFolder, pkg, portal, compose, nativeGateway, osMinVer, daemonIngress, installPorts = false, nofile, baseline = false) {
|
|
1400
1401
|
const confDir = join(dir, "conf");
|
|
1401
1402
|
const entries = existsSync(confDir) ? readdirSync(confDir) : [];
|
|
1402
1403
|
const nativeResource = kind !== "container"
|
|
@@ -1413,9 +1414,11 @@ function checkConf(dir, findings, kind, background, sharedFolder, pkg, portal, c
|
|
|
1413
1414
|
...(daemonIngress ? { daemon: { ingress: daemonIngress } } : {}),
|
|
1414
1415
|
}, portal)
|
|
1415
1416
|
: undefined;
|
|
1417
|
+
const actualResource = readOptional(join(confDir, "resource"));
|
|
1418
|
+
const resourceMatches = matchesStandaloneResource(actualResource, nativeResource, baseline);
|
|
1416
1419
|
if (nativeResource !== undefined &&
|
|
1417
|
-
|
|
1418
|
-
findings.push(`conf/resource must be ${nativeResource} (only the official data-share, systemd-user-unit and web-config, and consistent with the install.sharedFolder and portal declarations)`);
|
|
1420
|
+
!resourceMatches) {
|
|
1421
|
+
findings.push(`conf/resource must be ${nativeResource}${baseline ? ' or an exact released resource contract' : ''} (only the official data-share, systemd-user-unit and web-config, and consistent with the install.sharedFolder and portal declarations)`);
|
|
1419
1422
|
}
|
|
1420
1423
|
for (const name of entries) {
|
|
1421
1424
|
if (name !== "privilege" &&
|
|
@@ -1484,6 +1487,8 @@ function checkConf(dir, findings, kind, background, sharedFolder, pkg, portal, c
|
|
|
1484
1487
|
findings.push(`conf/privilege requires ${key} (root or extra group privileges)`);
|
|
1485
1488
|
}
|
|
1486
1489
|
}
|
|
1490
|
+
if (resourceMatches && actualResource)
|
|
1491
|
+
return JSON.parse(actualResource);
|
|
1487
1492
|
}
|
|
1488
1493
|
/** The opt-in package user unit must be exactly what the generator writes. */
|
|
1489
1494
|
function checkBackground(dir, info, payload, findings, executor, daemon, bridge = false, lifecycleTimeouts, nativeGateway, installPorts = false) {
|
|
@@ -22,7 +22,7 @@ export declare function minifyUi(content: string, file: string): string;
|
|
|
22
22
|
export declare function uiFiles(root: string): string[];
|
|
23
23
|
/** Run before computing content addresses or mobile asset inventories. */
|
|
24
24
|
export declare function minifyUiTree(root: string, skip?: string[]): void;
|
|
25
|
-
export declare function uiFileProblems(file: string,
|
|
25
|
+
export declare function uiFileProblems(file: string, input: string | Buffer): UiProblem[];
|
|
26
26
|
export declare function logicalUiFile(file: string, moduleVersion?: string): string;
|
|
27
27
|
export declare function applyUiIgnores(problems: UiProblem[], ignores: UiSecretIgnore[], moduleVersion?: string): UiProblem[];
|
|
28
28
|
export declare function scanUiTree(root: string, ignores?: UiSecretIgnore[], moduleVersion?: string): UiProblem[];
|
|
@@ -78,6 +78,25 @@ const SECRET_PATTERNS = [
|
|
|
78
78
|
["aws-access-key", /\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/],
|
|
79
79
|
["aws-secret-key", /(?:["']?aws_secret_access_key["']?)\s*[:=]\s*["']?[A-Za-z0-9/+=]{40}(?![A-Za-z0-9/+=])/i],
|
|
80
80
|
];
|
|
81
|
+
// Linker string pools need not put word boundaries between constants. Keep the
|
|
82
|
+
// known token signatures/lengths, but do not require text word boundaries there.
|
|
83
|
+
const BINARY_SECRET_PATTERNS = SECRET_PATTERNS.map(([name, pattern]) => [name, new RegExp(pattern.source.replaceAll("\\b", ""), pattern.flags)]);
|
|
84
|
+
const MACH_O_MAGICS = new Set([
|
|
85
|
+
0xfeedface, 0xcefaedfe, 0xfeedfacf, 0xcffaedfe,
|
|
86
|
+
0xcafebabe, 0xbebafeca, 0xcafebabf, 0xbfbafeca,
|
|
87
|
+
]);
|
|
88
|
+
/** Content-based format detection, independent of filename or executable mode. */
|
|
89
|
+
function isExecutable(bytes) {
|
|
90
|
+
if (bytes.length < 4)
|
|
91
|
+
return false;
|
|
92
|
+
const magic = bytes.readUInt32BE(0);
|
|
93
|
+
if (magic === 0x7f454c46 || MACH_O_MAGICS.has(magic))
|
|
94
|
+
return true;
|
|
95
|
+
if (bytes.length < 64 || bytes[0] !== 0x4d || bytes[1] !== 0x5a)
|
|
96
|
+
return false;
|
|
97
|
+
const pe = bytes.readUInt32LE(60);
|
|
98
|
+
return pe >= 64 && pe <= bytes.length - 4 && bytes.readUInt32LE(pe) === 0x00004550;
|
|
99
|
+
}
|
|
81
100
|
// Common field captions are public text, not embedded credential defaults.
|
|
82
101
|
// Only object captions are recognized; password="Password" still fails.
|
|
83
102
|
const PASSWORD_CAPTIONS = new Set([
|
|
@@ -98,7 +117,9 @@ function credentialLiteral(content) {
|
|
|
98
117
|
}
|
|
99
118
|
return /(?:^|[^\w$"'`])(?:password|secret)\s*=\s*(?:"[^"\r\n]+"|'[^'\r\n]+'|`[^`$\r\n]+`|\d+(?:\.\d+)?\b)|["'`](?:password|secret)=[^"'`\s]+/i.test(content);
|
|
100
119
|
}
|
|
101
|
-
export function uiFileProblems(file,
|
|
120
|
+
export function uiFileProblems(file, input) {
|
|
121
|
+
const executable = Buffer.isBuffer(input) && isExecutable(input);
|
|
122
|
+
const content = typeof input === "string" ? input : input.toString(executable ? "latin1" : "utf8");
|
|
102
123
|
const found = [];
|
|
103
124
|
const name = basename(file).toLowerCase();
|
|
104
125
|
if (name === ".env" || name.startsWith(".env."))
|
|
@@ -107,13 +128,14 @@ export function uiFileProblems(file, content) {
|
|
|
107
128
|
found.push({ file, pattern: "source-map-file" });
|
|
108
129
|
if (SOURCE_MAP_COMMENT.test(content))
|
|
109
130
|
found.push({ file, pattern: "sourceMappingURL" });
|
|
110
|
-
for (const [pattern, match] of SECRET_PATTERNS)
|
|
131
|
+
for (const [pattern, match] of executable ? BINARY_SECRET_PATTERNS : SECRET_PATTERNS)
|
|
111
132
|
if (match.test(content))
|
|
112
133
|
found.push({ file, pattern });
|
|
113
|
-
|
|
134
|
+
// Source syntax has no reliable meaning in machine code or pooled constants.
|
|
135
|
+
if (!executable && credentialLiteral(content))
|
|
114
136
|
found.push({ file, pattern: "credential-literal" });
|
|
115
137
|
// 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))
|
|
138
|
+
if (!executable && !isUiBundle(file) && /(?:^|[^\w$])(?:password|secret)\s*=\s*[^\s"'`<>{};,]+/i.test(content))
|
|
117
139
|
if (!found.some(item => item.pattern === "credential-literal"))
|
|
118
140
|
found.push({ file, pattern: "credential-literal" });
|
|
119
141
|
return found;
|
|
@@ -131,7 +153,7 @@ export function applyUiIgnores(problems, ignores, moduleVersion) {
|
|
|
131
153
|
});
|
|
132
154
|
}
|
|
133
155
|
export function scanUiTree(root, ignores = [], moduleVersion) {
|
|
134
|
-
const problems = uiFiles(root).flatMap(file => uiFileProblems(file, readFileSync(join(root, file)
|
|
156
|
+
const problems = uiFiles(root).flatMap(file => uiFileProblems(file, readFileSync(join(root, file))));
|
|
135
157
|
return applyUiIgnores(problems, ignores, moduleVersion);
|
|
136
158
|
}
|
|
137
159
|
export function enforcePublicUi(root, ignores = [], moduleVersion) {
|
|
@@ -4,6 +4,13 @@ import { type SharedFolder } from "./shared-folder.js";
|
|
|
4
4
|
import { type PortalPackage } from "../portal/package.js";
|
|
5
5
|
import { type NativeGatewayPlan } from './native-gateway.js';
|
|
6
6
|
import { type DaemonIngress } from "./daemon-ingress.js";
|
|
7
|
+
/**
|
|
8
|
+
* Validate a baseline against the released resource contracts. Never skip the
|
|
9
|
+
* comparison: the only historical differences are the Portal www registrations
|
|
10
|
+
* introduced first for daemon ingress, then for identity gateway ingress.
|
|
11
|
+
* Exact serialized matching also rejects extra keys, entries and duplicates.
|
|
12
|
+
*/
|
|
13
|
+
export declare function matchesStandaloneResource(actual: string | undefined, current: string | undefined, baseline?: boolean): boolean;
|
|
7
14
|
/**
|
|
8
15
|
* `conf/resource` for a native package: only DSM's official `data-share`,
|
|
9
16
|
* `systemd-user-unit` and `web-config` workers, in a fixed key order.
|
|
@@ -2,7 +2,32 @@ import { renderDockerProjectResource } from "../build-spk/resource-worker.js";
|
|
|
2
2
|
import { sharedFolderResource } from "./shared-folder.js";
|
|
3
3
|
import { portalResource } from "../portal/package.js";
|
|
4
4
|
import { nativeGatewayResource } from './native-gateway.js';
|
|
5
|
-
import { daemonIngressResource } from "./daemon-ingress.js";
|
|
5
|
+
import { DAEMON_INGRESS_CONFIG, daemonIngressResource } from "./daemon-ingress.js";
|
|
6
|
+
/**
|
|
7
|
+
* Validate a baseline against the released resource contracts. Never skip the
|
|
8
|
+
* comparison: the only historical differences are the Portal www registrations
|
|
9
|
+
* introduced first for daemon ingress, then for identity gateway ingress.
|
|
10
|
+
* Exact serialized matching also rejects extra keys, entries and duplicates.
|
|
11
|
+
*/
|
|
12
|
+
export function matchesStandaloneResource(actual, current, baseline = false) {
|
|
13
|
+
if (actual === current)
|
|
14
|
+
return true;
|
|
15
|
+
if (!baseline || !actual || !current)
|
|
16
|
+
return false;
|
|
17
|
+
const resource = JSON.parse(current);
|
|
18
|
+
const web = resource['web-config'];
|
|
19
|
+
const entries = web?.['nginx-static-config']?.enable;
|
|
20
|
+
if (!web?.['app-portal'] || !entries)
|
|
21
|
+
return false;
|
|
22
|
+
// Released contracts, in order: no www, daemon www only, all path ingress www.
|
|
23
|
+
// The current contract was already checked above. Keep every other byte and
|
|
24
|
+
// the declaration-derived file paths intact, including dedicated listeners.
|
|
25
|
+
return [false, true].some(daemonWww => {
|
|
26
|
+
const historical = structuredClone(resource);
|
|
27
|
+
historical['web-config']['nginx-static-config'].enable = entries.filter(e => e.type !== 'www' || (daemonWww && e.relpath === DAEMON_INGRESS_CONFIG));
|
|
28
|
+
return actual === JSON.stringify(historical);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
6
31
|
/**
|
|
7
32
|
* `conf/resource` for a native package: only DSM's official `data-share`,
|
|
8
33
|
* `systemd-user-unit` and `web-config` workers, in a fixed key order.
|
package/package.json
CHANGED
|
@@ -39,3 +39,25 @@ Baseline comparison reads historical wizard files as archived data. It does not
|
|
|
39
39
|
replay the current wizard renderer against them. Archive integrity, package
|
|
40
40
|
identity, privilege/resources, lifecycle and executor authority remain checked.
|
|
41
41
|
The current SPK receives the normal current-format inspection.
|
|
42
|
+
|
|
43
|
+
Baseline resource inspection accepts the exact contracts emitted by released
|
|
44
|
+
renderers, including Portal path ingress registered on DSM ports alone. It
|
|
45
|
+
checks the archived registration against its declared files and workers; it does
|
|
46
|
+
not require a historical App to contain a newly introduced Portal `www` entry.
|
|
47
|
+
Current SPKs still require the current resource contract. Extra workers, foreign
|
|
48
|
+
paths, duplicate registrations and changes to fixed ingress files remain invalid.
|
|
49
|
+
The existing archive, payload checksum, executor digest/INFO anchor, ownership
|
|
50
|
+
and lifecycle checks remain in force. Unsigned packages have no cryptographic
|
|
51
|
+
provenance for `conf/resource`; compatibility recognizes released contracts, not
|
|
52
|
+
a claim about which CLI binary produced them.
|
|
53
|
+
|
|
54
|
+
JSON `resource_changes` and text `Resource` lines show the old and new DSM
|
|
55
|
+
registrations. Adding an ingress registration, including `www` for the same
|
|
56
|
+
ingress file, is `permissions: expanded` and `retention: required`: the default
|
|
57
|
+
web server on ports 80/443 adds an access surface beyond the DSM server. The
|
|
58
|
+
report requires administrator review and reapproval even with identical executor
|
|
59
|
+
policy and task pins. For Apps without an executor, this means administrator
|
|
60
|
+
review of the ingress change before release; it does not invent an SDK approval
|
|
61
|
+
task. Other resource changes are conservatively `review-required` and `required`.
|
|
62
|
+
An unchanged resource follows the existing executor approval rules. The offline
|
|
63
|
+
report does not apply an alias, approve a task or change runtime authorization.
|