@synopackageland/cli 0.42.1 → 0.43.0
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 +18 -0
- package/README.md +3 -1
- package/assets/go/route-audit/main.go +23 -3
- package/dist/e2e/app-open.js +6 -2
- package/dist/error-registry.js +1 -1
- package/dist/runtime/sdk-source.d.ts +1 -1
- package/dist/runtime/sdk-source.js +1 -1
- package/dist/standalone/identity-gateway.d.ts +3 -0
- package/dist/standalone/identity-gateway.js +15 -2
- package/dist/standalone/inspect-spk.js +5 -3
- package/dist/standalone/install-ports.js +1 -1
- package/dist/standalone/manifest.js +14 -1
- package/dist/standalone/native-gateway.d.ts +1 -1
- package/dist/standalone/native-gateway.js +17 -9
- package/dist/standalone/spk.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.43.0 (2026-11-02)
|
|
4
|
+
|
|
5
|
+
- Add identity_gateway.ingress for fixed DSM package paths without a public gateway port.
|
|
6
|
+
- Validate and inspect the exact package namespace, require matching SDK path support, and derive the same path for browser smoke checks.
|
|
7
|
+
- Pin SDK 0.43.0 and templates ~0.38.0; existing dedicated-port manifests retain their behavior.
|
|
8
|
+
|
|
9
|
+
## 0.42.2 (2026-11-01)
|
|
10
|
+
|
|
11
|
+
- Pin SDK 0.42.0 for CLI-owned runtime defaults (daemon controllers, Compose
|
|
12
|
+
planning and installer context); it reuses the executor/v0.39.0 inventory.
|
|
13
|
+
Explicit App SDK declarations still take precedence; templates stay ~0.37.0.
|
|
14
|
+
- The route audit accepts `api.WithObserver` (SDK 0.42.0) around the CGI root,
|
|
15
|
+
like `api.WithRequestDeadline`; only its handler argument is followed, and a
|
|
16
|
+
private handler wrapped in it is still refused.
|
|
17
|
+
- The route audit no longer resolves the selected name of a selector
|
|
18
|
+
(`pkg.Config`, `value.Method`) as a name of the App's own package, which
|
|
19
|
+
made an App type and all its methods look reachable from a private handler.
|
|
20
|
+
|
|
3
21
|
## 0.42.1 (2026-11-01)
|
|
4
22
|
|
|
5
23
|
- Add `--version` and `-V` to report the installed CLI version.
|
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ alongside npm lockfiles. Do not disable checksum verification for public SDK
|
|
|
89
89
|
packages. Private mirrors can use explicitly configured Go authentication and
|
|
90
90
|
checksum settings; a failed fetch reports `SDK_DOWNLOAD_FAILED`.
|
|
91
91
|
|
|
92
|
-
The CLI pins SDK 0.
|
|
92
|
+
The CLI pins SDK 0.42.0 for its daemon controllers, Compose planning and installer
|
|
93
93
|
context. Explicit App SDK declarations take precedence. Templates use ~0.37.0
|
|
94
94
|
and retain their own scaffold SDK pins; none declare daemon ingress.
|
|
95
95
|
Every App method must be declared in the permissions table. Dynamic names and
|
|
@@ -627,3 +627,5 @@ nonroot package process with no-new-privileges has zero effective, permitted and
|
|
|
627
627
|
ambient capabilities on the tested provider. This general platform behavior is
|
|
628
628
|
not a GPU blocker. Plan metadata describes SDK policy, not an attestation of the
|
|
629
629
|
provider's final container configuration; see the SDK Compose security boundary.
|
|
630
|
+
|
|
631
|
+
For same-origin App URLs, see [DSM path ingress](docs/path-ingress.md).
|
|
@@ -118,6 +118,21 @@ type source struct {
|
|
|
118
118
|
file *ast.File
|
|
119
119
|
path, pkg string
|
|
120
120
|
imports map[string]string
|
|
121
|
+
// selected are the Sel identifiers of selector expressions (pkg.Name,
|
|
122
|
+
// value.Field, value.Method). They name nothing in this package: the
|
|
123
|
+
// selector itself is resolved through imports, never as a local name.
|
|
124
|
+
selected map[*ast.Ident]bool
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
func selectedNames(file *ast.File) map[*ast.Ident]bool {
|
|
128
|
+
out := map[*ast.Ident]bool{}
|
|
129
|
+
ast.Inspect(file, func(n ast.Node) bool {
|
|
130
|
+
if sel, ok := n.(*ast.SelectorExpr); ok {
|
|
131
|
+
out[sel.Sel] = true
|
|
132
|
+
}
|
|
133
|
+
return true
|
|
134
|
+
})
|
|
135
|
+
return out
|
|
121
136
|
}
|
|
122
137
|
|
|
123
138
|
// Follow the handler argument through local declarations and factories. A
|
|
@@ -176,6 +191,9 @@ func boundaryHandlers(sources []source) map[ast.Node]bool {
|
|
|
176
191
|
key := ""
|
|
177
192
|
switch v := n.(type) {
|
|
178
193
|
case *ast.Ident:
|
|
194
|
+
if s.selected[v] {
|
|
195
|
+
return true
|
|
196
|
+
}
|
|
179
197
|
key = s.pkg + "." + v.Name
|
|
180
198
|
if v.Obj != nil {
|
|
181
199
|
// A parameter or receiver carries a value built elsewhere.
|
|
@@ -242,7 +260,9 @@ func reusesBoundary(expr ast.Node, owner source, sources []source, safe map[ast.
|
|
|
242
260
|
switch sel.Sel.Name {
|
|
243
261
|
case "NewServerWithPermissions":
|
|
244
262
|
return false
|
|
245
|
-
case "WithRequestDeadline", "WithDescription":
|
|
263
|
+
case "WithRequestDeadline", "WithDescription", "WithObserver":
|
|
264
|
+
// WithObserver's callback runs after the SDK answered; only its
|
|
265
|
+
// handler argument can serve the request.
|
|
246
266
|
return len(call.Args) > 0 && reusesBoundary(call.Args[0], owner, sources, safe, seen)
|
|
247
267
|
}
|
|
248
268
|
}
|
|
@@ -298,7 +318,7 @@ func reusesBoundary(expr ast.Node, owner source, sources []source, safe map[ast.
|
|
|
298
318
|
}
|
|
299
319
|
}
|
|
300
320
|
return false
|
|
301
|
-
} else {
|
|
321
|
+
} else if !owner.selected[id] {
|
|
302
322
|
targetPackage, targetName = owner.pkg, id.Name
|
|
303
323
|
}
|
|
304
324
|
}
|
|
@@ -502,7 +522,7 @@ func main() {
|
|
|
502
522
|
}
|
|
503
523
|
imports[alias] = module
|
|
504
524
|
}
|
|
505
|
-
sources = append(sources, source{file, path, pkg, imports})
|
|
525
|
+
sources = append(sources, source{file, path, pkg, imports, selectedNames(file)})
|
|
506
526
|
}
|
|
507
527
|
safe := boundaryHandlers(sources)
|
|
508
528
|
for _, src := range sources {
|
package/dist/e2e/app-open.js
CHANGED
|
@@ -29,7 +29,10 @@ export function deriveSmokeEntry(raw, entry) {
|
|
|
29
29
|
const ingress = readDaemonIngress(raw.daemon?.ingress, raw.package, () => { });
|
|
30
30
|
if (raw.daemon?.ingress !== undefined && !ingress)
|
|
31
31
|
throw new Error('Invalid daemon ingress: use /synopkgland/<package>/ with the exact package ID');
|
|
32
|
-
const
|
|
32
|
+
const gatewayIngress = readDaemonIngress(gateway?.ingress, raw.package, () => { });
|
|
33
|
+
if (gateway?.ingress !== undefined && !gatewayIngress)
|
|
34
|
+
throw new Error("Invalid gateway ingress namespace");
|
|
35
|
+
const derived = ingress?.path ?? gatewayIngress?.path ?? (gateway
|
|
33
36
|
? `/webman/3rdparty/${raw.package}/sso/open.cgi`
|
|
34
37
|
: native ? `/?launchApp=${encodeURIComponent(appId)}`
|
|
35
38
|
: trustedAppEntryPath(raw));
|
|
@@ -39,7 +42,8 @@ export function deriveSmokeEntry(raw, entry) {
|
|
|
39
42
|
const menuEntry = `/webman/3rdparty/${raw.package}/sso/open.cgi`;
|
|
40
43
|
const upstreamAuthenticated = (gateway?.upstream_access === 'public' && pathname !== menuEntry) ||
|
|
41
44
|
(!native && raw.integration?.web?.access === 'public') ||
|
|
42
|
-
(gateway?.upstream_auth_paths ?? []).some((prefix) => pathname ===
|
|
45
|
+
(gateway?.upstream_auth_paths ?? []).some((prefix) => pathname === (gatewayIngress ? gatewayIngress.path.slice(0, -1) + prefix : prefix) ||
|
|
46
|
+
pathname.startsWith((gatewayIngress ? gatewayIngress.path.slice(0, -1) + prefix : prefix).replace(/\/$/, '') + '/'));
|
|
43
47
|
return { package: raw.package, appId, entry: selected, window: entry ? false : window, upstreamAuthenticated,
|
|
44
48
|
normalExpectation: raw.entry === 'admin-only' ? 'denied' : 'ready' };
|
|
45
49
|
}
|
package/dist/error-registry.js
CHANGED
|
@@ -406,7 +406,7 @@ export const ERROR_REGISTRY = {
|
|
|
406
406
|
STANDALONE_IDENTITY_GATEWAY_INVALID: {
|
|
407
407
|
code: "STANDALONE_IDENTITY_GATEWAY_INVALID",
|
|
408
408
|
description: "The identity_gateway declaration does not match the gateway contract.",
|
|
409
|
-
suggestion: "Declare a daemon; set sdk, mode (oidc, header or token),
|
|
409
|
+
suggestion: "Declare a daemon or Compose web service; set sdk, mode (none, oidc, header or token), and either ingress.path at /synopkgland/<package>/ or distinct public listen ports; keep passthrough and redirects local paths outside /_sso; oidc needs issuer_port and clients, header needs headers.user, token needs token.exec in the daemon payload.",
|
|
410
410
|
},
|
|
411
411
|
STANDALONE_IDENTITY_GATEWAY_EXTERNAL_INVALID: {
|
|
412
412
|
code: "STANDALONE_IDENTITY_GATEWAY_EXTERNAL_INVALID",
|
|
@@ -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.
|
|
4
|
+
export declare const DEFAULT_SDK_VERSION = "0.43.0";
|
|
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.
|
|
8
|
+
export const DEFAULT_SDK_VERSION = '0.43.0';
|
|
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`;
|
|
@@ -51,6 +51,9 @@ export interface IdentityGateway {
|
|
|
51
51
|
mode: GatewayMode;
|
|
52
52
|
/** Fixed same-origin menu target, including optional query and fragment. */
|
|
53
53
|
launch_path?: string;
|
|
54
|
+
ingress?: {
|
|
55
|
+
path: string;
|
|
56
|
+
};
|
|
54
57
|
access?: WebAccessMode;
|
|
55
58
|
/** Public App routes keep upstream authentication; access still protects OIDC issuance. */
|
|
56
59
|
upstream_access?: "protected" | "public";
|
|
@@ -157,6 +157,7 @@ export function readIdentityGateway(value, daemon, fail, packagedPayload = false
|
|
|
157
157
|
"access",
|
|
158
158
|
"upstream_access",
|
|
159
159
|
"launch_path",
|
|
160
|
+
"ingress",
|
|
160
161
|
"groups",
|
|
161
162
|
"max_upload_bytes",
|
|
162
163
|
"response_header_timeout_seconds",
|
|
@@ -241,10 +242,15 @@ export function readIdentityGateway(value, daemon, fail, packagedPayload = false
|
|
|
241
242
|
return invalid("mode must be none, oidc, header or token.");
|
|
242
243
|
if (!port(v.upstream))
|
|
243
244
|
return invalid("upstream must be the App's loopback port.");
|
|
244
|
-
const
|
|
245
|
+
const ingress = v.ingress;
|
|
246
|
+
if (ingress !== undefined && (!record(ingress) || !only(ingress, ["path"]) || typeof ingress.path !== "string" || !/^\/synopkgland\/[A-Za-z][A-Za-z0-9]{1,63}\/$/.test(ingress.path)))
|
|
247
|
+
return invalid("ingress.path must be exactly /synopkgland/<package>/.");
|
|
248
|
+
if (ingress !== undefined && v.listen !== undefined && !(packagedPayload && record(v.listen) && Object.keys(v.listen).length === 0))
|
|
249
|
+
return invalid("ingress replaces listen; remove the public gateway ports.");
|
|
250
|
+
const listen = ingress !== undefined ? {} : v.listen;
|
|
245
251
|
if (!record(listen) ||
|
|
246
252
|
!only(listen, ["http", "https"]) ||
|
|
247
|
-
(listen.http === undefined && listen.https === undefined) ||
|
|
253
|
+
(ingress === undefined && listen.http === undefined && listen.https === undefined) ||
|
|
248
254
|
![listen.http, listen.https].every((p) => p === undefined || port(p)))
|
|
249
255
|
return invalid("listen needs an http and/or https port.");
|
|
250
256
|
const issuer = record(v.oidc) ? v.oidc.issuer_port : undefined;
|
|
@@ -330,6 +336,7 @@ export function readIdentityGateway(value, daemon, fail, packagedPayload = false
|
|
|
330
336
|
sdk: v.sdk,
|
|
331
337
|
...(externalAccess ? { external_access: externalAccess } : {}),
|
|
332
338
|
mode: v.mode,
|
|
339
|
+
...(ingress ? { ingress: ingress } : {}),
|
|
333
340
|
...(v.launch_path !== undefined ? { launch_path: v.launch_path } : {}),
|
|
334
341
|
access,
|
|
335
342
|
...(v.upstream_access !== undefined ? { upstream_access: v.upstream_access } : {}),
|
|
@@ -475,6 +482,7 @@ export function identityGatewayConfig(m) {
|
|
|
475
482
|
package: m.package,
|
|
476
483
|
...(gatewayExternalAccess(g) ? { external: gatewayExternalAccess(g) } : {}),
|
|
477
484
|
...(nativeGatewaySupported(m) ? { native_ingress: true } : {}),
|
|
485
|
+
...(g.ingress ? { ingress_path: g.ingress.path } : {}),
|
|
478
486
|
...(runtimeBudgetSdkSupported(g.sdk) ? {
|
|
479
487
|
operation_seconds: operationBudgetSeconds(m),
|
|
480
488
|
stop_seconds: m.daemon?.timeouts.stop ?? m.lifecycleTimeouts?.stop ?? 30,
|
|
@@ -588,6 +596,11 @@ export async function buildIdentityGateway(m, arch, work, run) {
|
|
|
588
596
|
if (!existsSync(capability) || !/const LauncherPathVersion = 1\b/.test(readFileSync(capability, "utf8")))
|
|
589
597
|
throw new StandaloneBuildError("STANDALONE_IDENTITY_GATEWAY_INVALID", "The selected SDK lacks fixed launch_path support; use a matching SDK release or an explicit development source override.");
|
|
590
598
|
}
|
|
599
|
+
if (m.identityGateway.ingress) {
|
|
600
|
+
const capability = join(sdk.goDir, "idgateway/path_ingress.go");
|
|
601
|
+
if (!existsSync(capability) || !/const PathIngressVersion = 1\b/.test(readFileSync(capability, "utf8")))
|
|
602
|
+
throw new StandaloneBuildError("STANDALONE_IDENTITY_GATEWAY_INVALID", "The selected SDK lacks DSM path ingress; use a matching SDK release or an explicit development source override.");
|
|
603
|
+
}
|
|
591
604
|
const out = join(work, `identity-gateway-${arch}`);
|
|
592
605
|
const policyFlag = upstreamAuthSdkSupported(sdk.goDir)
|
|
593
606
|
? ` -X github.com/synopackageland/syno-pkg-land-sdk/idgateway.expectedEntryPolicyDigest=${gatewayEntryPolicyDigest(JSON.parse(identityGatewayConfig(m)))}`
|
|
@@ -1257,17 +1257,19 @@ async function recoverNativeGateway(dir, value, info, findings) {
|
|
|
1257
1257
|
throw new Error('invalid native gateway record');
|
|
1258
1258
|
const plan = value;
|
|
1259
1259
|
if (typeof plan.sdk !== 'string' || !plan.listen || typeof plan.listen !== 'object' || Array.isArray(plan.listen)
|
|
1260
|
-
|| !Object.keys(plan.listen).length || Object.keys(plan).some(k => !['sdk', 'listen'].includes(k))
|
|
1260
|
+
|| !plan.ingress && !Object.keys(plan.listen).length || Object.keys(plan).some(k => !['sdk', 'listen', 'ingress'].includes(k))
|
|
1261
1261
|
|| Object.entries(plan.listen).some(([k, v]) => !['http', 'https'].includes(k) || !Number.isInteger(v) || v < 1 || v > 65535))
|
|
1262
1262
|
throw new Error('invalid native gateway ports');
|
|
1263
1263
|
const target = { package: info.package, os_min_ver: info.os_min_ver, identityGateway: plan };
|
|
1264
|
+
if (plan.ingress && (plan.ingress.path !== `/synopkgland/${info.package}/` || Object.keys(plan.ingress).some(k => k !== 'path') || Object.keys(plan.listen).length))
|
|
1265
|
+
throw new Error('invalid gateway ingress namespace');
|
|
1264
1266
|
if (!nativeGatewaySupported(target))
|
|
1265
1267
|
throw new Error('unsupported native gateway SDK/DSM floor');
|
|
1266
1268
|
const root = join(dir, 'native-gateway-inspection');
|
|
1267
1269
|
mkdirSync(root);
|
|
1268
1270
|
await tar.x({ file: join(dir, 'package.tgz'), cwd: root, filter: path => ['sso/gateway.json', NATIVE_GATEWAY_CONFIG].includes(path.replace(/^\.\//, '')) });
|
|
1269
1271
|
const config = JSON.parse(readFileSync(join(root, 'sso/gateway.json'), 'utf8'));
|
|
1270
|
-
if (config.native_ingress !== true || config.package !== info.package || !isDeepStrictEqual(config.listen, plan.listen)
|
|
1272
|
+
if (config.native_ingress !== true || config.package !== info.package || !isDeepStrictEqual(config.listen, plan.listen) || config.ingress_path !== plan.ingress?.path
|
|
1271
1273
|
|| config.state_dir !== `/var/packages/${info.package}/var/sso`)
|
|
1272
1274
|
throw new Error('native gateway config does not match its package');
|
|
1273
1275
|
if (readOptional(join(root, NATIVE_GATEWAY_CONFIG)) !== renderNativeGatewayConfig(target))
|
|
@@ -1523,7 +1525,7 @@ async function inspectInstallSettings(dir, payload, metadata, findings) {
|
|
|
1523
1525
|
if (ports) {
|
|
1524
1526
|
const config = JSON.parse(readFileSync(join(root, 'install/ports.json'), 'utf8'));
|
|
1525
1527
|
const actualGateway = JSON.parse(readFileSync(join(root, 'sso/gateway.json'), 'utf8'));
|
|
1526
|
-
const expected = portDefaults({ ...m, identityGateway: { ...actualGateway, sdk: gateway.sdk } });
|
|
1528
|
+
const expected = portDefaults({ ...m, identityGateway: { ...actualGateway, sdk: gateway.sdk, ...(actualGateway.ingress_path ? { ingress: { path: actualGateway.ingress_path } } : {}) } });
|
|
1527
1529
|
if (config.schema !== 1 || config.package !== info.package || !isDeepStrictEqual(config.ports, ports) || !isDeepStrictEqual(ports, expected))
|
|
1528
1530
|
throw new Error('port defaults differ from gateway listeners');
|
|
1529
1531
|
const required = ['sso/gateway.json', 'daemon/config.json', ...(actualGateway.native_ingress ? ['sso/native-nginx.conf'] : []), ...(settings ? ['install/settings.json'] : []), ...payload.filter(p => /^ui\/window-[0-9]+\.js$/.test(p.path)).map(p => p.path)].sort();
|
|
@@ -5,7 +5,7 @@ export function portDefaults(m) {
|
|
|
5
5
|
return {};
|
|
6
6
|
const g = m.identityGateway;
|
|
7
7
|
return Object.fromEntries([
|
|
8
|
-
...Object.entries(g.listen ?? {}).map(([key, value]) => ['gateway_' + key, { default: value, protocol: 'tcp' }]),
|
|
8
|
+
...Object.entries(g.ingress ? {} : g.listen ?? {}).map(([key, value]) => ['gateway_' + key, { default: value, protocol: 'tcp' }]),
|
|
9
9
|
...(g.oidc ? [['oidc_issuer', { default: g.oidc.issuer_port, protocol: 'tcp' }]] : []),
|
|
10
10
|
]);
|
|
11
11
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { nativeGatewaySdk } from "./native-gateway.js";
|
|
1
2
|
import { portDefaults } from "./install-ports.js";
|
|
2
3
|
import { readPackageDependencies, packageDependencies, dependencyError } from "./package-dependencies.js";
|
|
3
4
|
import { readInstallSettings } from './install-settings.js';
|
|
@@ -300,7 +301,7 @@ function readManifest(raw, c) {
|
|
|
300
301
|
? {
|
|
301
302
|
sdk: compose.sdk,
|
|
302
303
|
mode: "none",
|
|
303
|
-
listen: { http: 28000 },
|
|
304
|
+
...(gatewayRaw.ingress === undefined ? { listen: { http: 28000 } } : {}),
|
|
304
305
|
...gatewayRaw,
|
|
305
306
|
upstream: compose.plan.ingress?.port ??
|
|
306
307
|
compose.web.host_port ??
|
|
@@ -311,6 +312,18 @@ function readManifest(raw, c) {
|
|
|
311
312
|
c.fail("COMPOSE_WEB_INVALID", "Compose upstream is derived from the SDK Compose ingress endpoint; remove identity_gateway.upstream.");
|
|
312
313
|
// A failed Compose plan already explains the invalid upstream declaration.
|
|
313
314
|
const identityGateway = raw.compose !== undefined && !compose ? undefined : readIdentityGateway(gatewayValue, daemon || (compose ? { targets: compose.targets } : undefined), (e) => c.fail(e.code, e.message), false, Boolean(compose?.plan.ingress));
|
|
315
|
+
if (identityGateway?.ingress) {
|
|
316
|
+
if (!nativeGatewaySdk(identityGateway.sdk))
|
|
317
|
+
c.fail("STANDALONE_IDENTITY_GATEWAY_INVALID", "Path ingress requires an SDK with native gateway support.");
|
|
318
|
+
if (identityGateway.ingress.path !== `/synopkgland/${raw.package}/`)
|
|
319
|
+
c.fail('STANDALONE_IDENTITY_GATEWAY_INVALID', 'identity_gateway.ingress.path must use the exact manifest package ID.');
|
|
320
|
+
if (daemonIngressMinDsmProblem(typeof raw.os_min_ver === "string" ? raw.os_min_ver : undefined))
|
|
321
|
+
c.fail('STANDALONE_IDENTITY_GATEWAY_INVALID', 'identity_gateway.ingress requires DSM 7.2-64570 or later.');
|
|
322
|
+
if (installPorts && !identityGateway.oidc)
|
|
323
|
+
c.fail('INSTALL_PORT_INVALID', 'Path ingress has no public gateway ports; remove install.ports.');
|
|
324
|
+
if (identityGateway.external_access?.single_origin)
|
|
325
|
+
c.fail('STANDALONE_IDENTITY_GATEWAY_INVALID', 'Path ingress uses the DSM origin and cannot combine with external_access.single_origin.');
|
|
326
|
+
}
|
|
314
327
|
if (installPorts && !identityGateway)
|
|
315
328
|
c.fail('INSTALL_PORT_INVALID', 'install.ports requires an identity gateway');
|
|
316
329
|
if (installPorts && identityGateway) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IdentityGateway } from './identity-gateway.js';
|
|
2
|
-
export type NativeGatewayPlan = Pick<IdentityGateway, 'sdk' | 'listen'>;
|
|
2
|
+
export type NativeGatewayPlan = Pick<IdentityGateway, 'sdk' | 'listen' | 'ingress'>;
|
|
3
3
|
type Target = {
|
|
4
4
|
package: string;
|
|
5
5
|
os_min_ver?: string;
|
|
@@ -12,7 +12,7 @@ export function nativeGatewaySupported(m) {
|
|
|
12
12
|
}
|
|
13
13
|
/** Observe the boundary before DSM acquires web-config, without claiming port ownership. */
|
|
14
14
|
export function renderNativeGatewayDiagnostic(m, hook) {
|
|
15
|
-
if (!nativeGatewaySupported(m) || !['start-stop-status', 'postinst', 'postupgrade', 'preupgrade', 'preuninst'].includes(hook))
|
|
15
|
+
if (m.identityGateway?.ingress || !nativeGatewaySupported(m) || !['start-stop-status', 'postinst', 'postupgrade', 'preupgrade', 'preuninst'].includes(hook))
|
|
16
16
|
return '';
|
|
17
17
|
if (m.installPorts)
|
|
18
18
|
return managedPortHook(m, hook, false);
|
|
@@ -43,7 +43,7 @@ synopkgland_native_diagnostic "$@" >/dev/null 2>&1 || :
|
|
|
43
43
|
}
|
|
44
44
|
/** Give a retiring nginx listener a bounded window before DSM acquires web-config. */
|
|
45
45
|
export function renderNativeGatewayPortWait(m, hook) {
|
|
46
|
-
if (hook !== 'start-stop-status' || !nativeGatewaySupported(m))
|
|
46
|
+
if (m.identityGateway?.ingress || hook !== 'start-stop-status' || !nativeGatewaySupported(m))
|
|
47
47
|
return '';
|
|
48
48
|
if (m.installPorts)
|
|
49
49
|
return managedPortHook(m, hook, true);
|
|
@@ -109,6 +109,8 @@ export function legacyGatewayNotice() {
|
|
|
109
109
|
export function nativeGatewayResource(m) {
|
|
110
110
|
if (!nativeGatewaySupported(m))
|
|
111
111
|
return undefined;
|
|
112
|
+
if (m.identityGateway.ingress)
|
|
113
|
+
return { "nginx-static-config": { enable: [{ type: "dsm", relpath: NATIVE_GATEWAY_CONFIG }] } };
|
|
112
114
|
const g = m.identityGateway, https = g.listen.https ?? g.listen.http;
|
|
113
115
|
const ports = [https, ...(g.listen.http && g.listen.http !== https ? [g.listen.http] : [])];
|
|
114
116
|
return { 'nginx-static-config': { enable: [{ type: 'server', relpath: NATIVE_GATEWAY_CONFIG,
|
|
@@ -122,13 +124,7 @@ export function renderNativeGatewayConfig(m) {
|
|
|
122
124
|
// Public ssl_certificate is deliberately inherited from DSM's http context.
|
|
123
125
|
// Only nginx's master reads the package's private upstream key. No DSM key
|
|
124
126
|
// is read or copied by the package, and no secret appears in this config.
|
|
125
|
-
|
|
126
|
-
listen ${port} ssl;
|
|
127
|
-
listen [::]:${port} ssl;
|
|
128
|
-
server_name _;
|
|
129
|
-
client_max_body_size 0;
|
|
130
|
-
location / {
|
|
131
|
-
proxy_pass https://unix:/tmp/synopkgland-gateway-${m.package}.sock:;
|
|
127
|
+
const proxy = ` proxy_pass https://unix:/tmp/synopkgland-gateway-${m.package}.sock:;
|
|
132
128
|
proxy_http_version 1.1;
|
|
133
129
|
proxy_ssl_verify on;
|
|
134
130
|
proxy_ssl_verify_depth 1;
|
|
@@ -144,7 +140,19 @@ export function renderNativeGatewayConfig(m) {
|
|
|
144
140
|
proxy_request_buffering off;
|
|
145
141
|
proxy_buffering off;
|
|
146
142
|
proxy_read_timeout 3600s;
|
|
143
|
+
`;
|
|
144
|
+
if (g.ingress) {
|
|
145
|
+
if (g.ingress.path !== `/synopkgland/${m.package}/`)
|
|
146
|
+
throw new Error('Invalid gateway ingress namespace');
|
|
147
|
+
return `location = ${g.ingress.path.slice(0, -1)} { return 308 ${g.ingress.path}$is_args$args; }\nlocation ^~ ${g.ingress.path} {\n client_max_body_size 0;\n${proxy} proxy_set_header X-Synopkgland-Scheme $scheme;\n}\n`;
|
|
147
148
|
}
|
|
149
|
+
return `server {
|
|
150
|
+
listen ${port} ssl;
|
|
151
|
+
listen [::]:${port} ssl;
|
|
152
|
+
server_name _;
|
|
153
|
+
client_max_body_size 0;
|
|
154
|
+
location / {
|
|
155
|
+
${proxy} }
|
|
148
156
|
}
|
|
149
157
|
${g.listen.http && g.listen.http !== port ? `server {
|
|
150
158
|
listen ${g.listen.http};
|
package/dist/standalone/spk.js
CHANGED
|
@@ -268,7 +268,7 @@ export async function assembleStandaloneSpk(options) {
|
|
|
268
268
|
...(gatewayAdmissionPolicy(manifest.identityGateway, manifest.entry) ? { provider_only_oidc: gatewayAdmissionPolicy(manifest.identityGateway, manifest.entry) } : {}),
|
|
269
269
|
...(manifest.identityGateway && gatewayExternalAccess(manifest.identityGateway)
|
|
270
270
|
? { gateway_external: gatewayExternalAccess(manifest.identityGateway) } : {}),
|
|
271
|
-
...(nativeGatewaySupported(manifest) ? { native_gateway: { sdk: manifest.identityGateway.sdk, listen: manifest.identityGateway.listen } } : {}),
|
|
271
|
+
...(nativeGatewaySupported(manifest) ? { native_gateway: { sdk: manifest.identityGateway.sdk, listen: manifest.identityGateway.listen, ...(manifest.identityGateway.ingress ? { ingress: manifest.identityGateway.ingress } : {}) } } : {}),
|
|
272
272
|
...(manifest.daemon?.ingress ? { daemon_ingress: manifest.daemon.ingress } : {}),
|
|
273
273
|
...(manifest.daemon?.node ? { daemon_node: manifest.daemon.node } : {}),
|
|
274
274
|
...(manifest.daemon?.restart ? { daemon_restart: manifest.daemon.restart, daemon_sdk: daemonSdkVersion(manifest) } : {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synopackageland/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"description": "Syno Package Land Developer Kit CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@napi-rs/keyring": "^2.1.1",
|
|
31
|
-
"@synopackageland/templates": "~0.
|
|
31
|
+
"@synopackageland/templates": "~0.38.0",
|
|
32
32
|
"ajv": "^8.17.1",
|
|
33
33
|
"commander": "^13.1.0",
|
|
34
34
|
"json-canonicalize": "^3.0.1",
|