@synopackageland/cli 0.53.2 → 0.53.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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.53.3 (2026-11-10)
4
+
5
+ - 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.
6
+ - 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.
7
+
3
8
  ## 0.53.2 (2026-11-10)
4
9
 
5
10
  - 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.
@@ -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
- if (old.package === nextReport.package && old.arch === nextReport.arch && noApproval(old) && noApproval(nextReport))
59
- return notRequired();
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
  }
@@ -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
- readOptional(join(confDir, "resource")) !== nativeResource) {
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) {
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.53.2",
3
+ "version": "0.53.3",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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.