@synopackageland/cli 0.48.22 → 0.48.23
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 +6 -0
- package/dist/cli.js +12 -2
- package/dist/error-registry.js +10 -0
- package/dist/standalone/gateway-review.d.ts +24 -0
- package/dist/standalone/gateway-review.js +53 -0
- package/dist/standalone/inspect-spk.d.ts +3 -0
- package/dist/standalone/inspect-spk.js +11 -6
- package/package.json +1 -1
- package/skills/reference/identity-gateway.md +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.48.23
|
|
4
|
+
|
|
5
|
+
- Show paths that bypass DSM sign-in in inspect and check, including upstream-auth paths, permanent and optional passthrough, and public gateway/upstream access; JSON includes the declared paths and nonblocking review notices
|
|
6
|
+
- Flag broad API-root prefixes with a nonblocking review warning and remind reviewers to check the App's own authentication
|
|
7
|
+
- List integration callbacks that bypass DSM sign-in in human inspect output, alongside the existing JSON inventory
|
|
8
|
+
|
|
3
9
|
## 0.48.22
|
|
4
10
|
|
|
5
11
|
- Recognize generated nginx restart and native Portal INFO fields during inspection without hiding unknown-field warnings
|
package/dist/cli.js
CHANGED
|
@@ -13,6 +13,7 @@ import { codedMessage, formatErrors } from "./errors.js";
|
|
|
13
13
|
import { getErrorCode } from "./error-registry.js";
|
|
14
14
|
import { formatInspectReport, inspectProject } from "./inspect.js";
|
|
15
15
|
import { gatewayAdmissionReport } from "./standalone/identity-gateway.js";
|
|
16
|
+
import { formatGatewayReview, gatewayReviewReport } from "./standalone/gateway-review.js";
|
|
16
17
|
import { formatPinReport, pinProjectImages } from "./images/pin.js";
|
|
17
18
|
import { initFromTemplate, initNextSteps, isTemplateName, listTemplates, } from "./init.js";
|
|
18
19
|
import { templatesRoot } from "./template-paths.js";
|
|
@@ -132,11 +133,13 @@ function formatHyperBackup(b) {
|
|
|
132
133
|
return [b ? `Hyper Backup: application backup on, ${b.online ? 'online (App keeps running; SQLite snapshots)' : 'offline (App stopped during export)'}, data version ${b.dataVersion}${b.hook ? `, hook ${b.hook}` : ''}. Hyper Backup runs the fixed backup scripts as root; they only switch to the package account.` : 'Hyper Backup: application backup off'];
|
|
133
134
|
}
|
|
134
135
|
function formatSpkReport(spk, report) {
|
|
136
|
+
const hasEntryExceptions = Boolean(report.gateway || report.integrations?.length);
|
|
135
137
|
return [
|
|
136
138
|
`SPK: ${spk}`,
|
|
137
139
|
...formatInstallSettings(report.installSettings),
|
|
138
140
|
...(report.synopkgland ? formatHyperBackup(report.hyperBackup) : []),
|
|
139
141
|
...(report.identityGateway ? [report.identityGateway.notice, `OIDC issuer access: ${report.identityGateway.issuerAccess}`] : []),
|
|
142
|
+
...formatGatewayReview(report.gateway),
|
|
140
143
|
`package: ${report.package ?? "?"} version: ${report.version ?? "?"}`,
|
|
141
144
|
report.synopkgland
|
|
142
145
|
? `arch: ${report.arch ?? "?"} runtime: ${report.kind ?? "?"}`
|
|
@@ -159,15 +162,18 @@ function formatSpkReport(spk, report) {
|
|
|
159
162
|
: []),
|
|
160
163
|
...(report.entry === "admin-only"
|
|
161
164
|
? [
|
|
162
|
-
|
|
165
|
+
`Entry: entry: admin-only; only a DSM administrator can open it and call ${hasEntryExceptions ? "routes covered by the DSM entry gate" : "any route (including SDK routes)"}`,
|
|
163
166
|
]
|
|
164
167
|
: []),
|
|
165
168
|
...(report.entry === "app-privilege"
|
|
166
169
|
? [
|
|
167
|
-
|
|
170
|
+
`Entry: entry: app-privilege; DSM Control Panel > Application Privileges decides who can use ${hasEntryExceptions ? "routes covered by the DSM entry gate" : "it"}`,
|
|
168
171
|
]
|
|
169
172
|
: []),
|
|
170
173
|
...formatRootSteps(report),
|
|
174
|
+
...(report.integrations?.length ? [
|
|
175
|
+
`INFO INTEGRATION_DSM_SIGN_IN_BYPASS: Integration callbacks that do not require DSM sign-in: ${report.integrations.join(", ")}; each callback's handler authenticates the caller.`,
|
|
176
|
+
] : []),
|
|
171
177
|
...(report.appScripts
|
|
172
178
|
? [
|
|
173
179
|
`App scripts: ${report.appScripts.join(", ")} (scripts/app, run by the generated scripts of the same name as the package account)`,
|
|
@@ -418,6 +424,8 @@ async function runCliWithin(argv) {
|
|
|
418
424
|
? loaded.manifest.loginStyle
|
|
419
425
|
: undefined)
|
|
420
426
|
: undefined;
|
|
427
|
+
const gateway = "identityGateway" in loaded.manifest
|
|
428
|
+
? gatewayReviewReport(loaded.manifest.identityGateway) : undefined;
|
|
421
429
|
emit("check", {
|
|
422
430
|
package: loaded.manifest.package,
|
|
423
431
|
warnings: validation.warnings ?? [],
|
|
@@ -425,6 +433,7 @@ async function runCliWithin(argv) {
|
|
|
425
433
|
...("installSettings" in loaded.manifest && loaded.manifest.installSettings ? { installSettings: loaded.manifest.installSettings } : {}),
|
|
426
434
|
...("hyperBackup" in loaded.manifest && loaded.manifest.hyperBackup ? { hyperBackup: backupRecord(loaded.manifest.hyperBackup) } : {}),
|
|
427
435
|
...("identityGateway" in loaded.manifest && gatewayAdmissionReport(loaded.manifest.identityGateway, loaded.manifest.entry) ? { identityGateway: gatewayAdmissionReport(loaded.manifest.identityGateway, loaded.manifest.entry) } : {}),
|
|
436
|
+
...(gateway ? { gateway } : {}),
|
|
428
437
|
capabilities: "capabilities" in loaded.manifest
|
|
429
438
|
? loaded.manifest.capabilities
|
|
430
439
|
: {},
|
|
@@ -448,6 +457,7 @@ async function runCliWithin(argv) {
|
|
|
448
457
|
...formatInstallSettings("installSettings" in loaded.manifest ? loaded.manifest.installSettings : undefined),
|
|
449
458
|
...("capabilities" in loaded.manifest ? formatHyperBackup(loaded.manifest.hyperBackup) : []),
|
|
450
459
|
...("identityGateway" in loaded.manifest && gatewayAdmissionReport(loaded.manifest.identityGateway) ? [gatewayAdmissionReport(loaded.manifest.identityGateway).notice] : []),
|
|
460
|
+
...formatGatewayReview(gateway),
|
|
451
461
|
...("compose" in loaded.manifest && loaded.manifest.compose
|
|
452
462
|
? [
|
|
453
463
|
"Containers use the fixed package identity; signed-in File Station ACLs are not inherited.",
|
package/dist/error-registry.js
CHANGED
|
@@ -817,6 +817,16 @@ export const ERROR_REGISTRY = {
|
|
|
817
817
|
description: "The SPK does not match the DSM 7 package format (dsm.errors), or a synopkgland-built SPK does not match the build contract (findings).",
|
|
818
818
|
suggestion: "Fix the SPK_* rule codes and findings, then repackage; warnings do not affect the result.",
|
|
819
819
|
},
|
|
820
|
+
GATEWAY_DSM_SIGN_IN_BYPASS: {
|
|
821
|
+
code: "GATEWAY_DSM_SIGN_IN_BYPASS",
|
|
822
|
+
description: "Informational review notice: declared upstream paths bypass DSM sign-in.",
|
|
823
|
+
suggestion: "Review the App's own authentication and public/share routes; this notice does not block builds.",
|
|
824
|
+
},
|
|
825
|
+
GATEWAY_BROAD_AUTH_PREFIX: {
|
|
826
|
+
code: "GATEWAY_BROAD_AUTH_PREFIX",
|
|
827
|
+
description: "Nonblocking review warning: a DSM sign-in exception looks like a whole API root.",
|
|
828
|
+
suggestion: "Narrow the prefix to the routes the upstream really authenticates.",
|
|
829
|
+
},
|
|
820
830
|
IMAGE_PIN_REQUIRED: {
|
|
821
831
|
code: "IMAGE_PIN_REQUIRED",
|
|
822
832
|
description: "The image digest is not pinned.",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IdentityGateway } from "./identity-gateway.js";
|
|
2
|
+
export interface GatewayReviewNotice {
|
|
3
|
+
severity: "info" | "warning";
|
|
4
|
+
code: "GATEWAY_DSM_SIGN_IN_BYPASS" | "GATEWAY_BROAD_AUTH_PREFIX";
|
|
5
|
+
message: string;
|
|
6
|
+
path?: string;
|
|
7
|
+
}
|
|
8
|
+
/** Review information only; notices never join the blocking SPK findings. */
|
|
9
|
+
export interface GatewayReviewReport {
|
|
10
|
+
upstreamAuthPaths?: string[];
|
|
11
|
+
passthrough?: string[];
|
|
12
|
+
optionalPassthrough?: Record<string, {
|
|
13
|
+
prefixes: string[];
|
|
14
|
+
defaultEnabled: false;
|
|
15
|
+
}>;
|
|
16
|
+
access?: "public";
|
|
17
|
+
upstreamAccess?: "public";
|
|
18
|
+
notices: GatewayReviewNotice[];
|
|
19
|
+
}
|
|
20
|
+
type GatewayReviewConfig = Pick<IdentityGateway, "upstream_auth_paths" | "passthrough" | "optional_passthrough" | "access" | "upstream_access">;
|
|
21
|
+
/** Accepts either the normalized manifest or the packaged sso/gateway.json. */
|
|
22
|
+
export declare function gatewayReviewReport(g?: Partial<GatewayReviewConfig>): GatewayReviewReport | undefined;
|
|
23
|
+
export declare function formatGatewayReview(report?: GatewayReviewReport): string[];
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** Accepts either the normalized manifest or the packaged sso/gateway.json. */
|
|
2
|
+
export function gatewayReviewReport(g) {
|
|
3
|
+
if (!g)
|
|
4
|
+
return;
|
|
5
|
+
const upstreamAuthPaths = g.upstream_auth_paths ?? [];
|
|
6
|
+
const passthrough = g.passthrough ?? [];
|
|
7
|
+
const optional = Object.entries(g.optional_passthrough ?? {});
|
|
8
|
+
const paths = [];
|
|
9
|
+
if (upstreamAuthPaths.length)
|
|
10
|
+
paths.push(`upstream_auth_paths: ${upstreamAuthPaths.join(", ")}`);
|
|
11
|
+
if (passthrough.length)
|
|
12
|
+
paths.push(`passthrough: ${passthrough.join(", ")}`);
|
|
13
|
+
for (const [id, rule] of optional) {
|
|
14
|
+
paths.push(`optional_passthrough ${id}: ${rule.prefixes.join(", ")} (default off; bypass when enabled)`);
|
|
15
|
+
}
|
|
16
|
+
if (g.access === "public")
|
|
17
|
+
paths.push("all upstream paths (access: public)");
|
|
18
|
+
if (g.upstream_access === "public")
|
|
19
|
+
paths.push("all upstream paths (upstream_access: public; OIDC issuance still requires DSM sign-in)");
|
|
20
|
+
if (!paths.length)
|
|
21
|
+
return;
|
|
22
|
+
const notices = [{
|
|
23
|
+
severity: "info",
|
|
24
|
+
code: "GATEWAY_DSM_SIGN_IN_BYPASS",
|
|
25
|
+
message: `Paths that do not require DSM sign-in; the app's own authentication protects them: ${paths.join("; ")}. Review the upstream authentication and public/share routes.`,
|
|
26
|
+
}];
|
|
27
|
+
const prefixes = [...upstreamAuthPaths, ...passthrough, ...optional.flatMap(([, rule]) => rule.prefixes)];
|
|
28
|
+
// Deliberately small, case-sensitive heuristic: a single api, v<digits> or
|
|
29
|
+
// graphql segment, with an optional trailing slash. Nested routes are excluded.
|
|
30
|
+
for (const path of new Set(prefixes.map(prefix => prefix.replace(/\/$/, "")))) {
|
|
31
|
+
if (!/^\/(?:api|v[0-9]+|graphql)$/.test(path))
|
|
32
|
+
continue;
|
|
33
|
+
notices.push({
|
|
34
|
+
severity: "warning",
|
|
35
|
+
code: "GATEWAY_BROAD_AUTH_PREFIX",
|
|
36
|
+
path,
|
|
37
|
+
message: `${path} looks like a whole API root without DSM sign-in; narrow it to the routes the upstream really authenticates. This review warning does not block builds.`,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
...(upstreamAuthPaths.length ? { upstreamAuthPaths } : {}),
|
|
42
|
+
...(passthrough.length ? { passthrough } : {}),
|
|
43
|
+
...(optional.length ? {
|
|
44
|
+
optionalPassthrough: Object.fromEntries(optional.map(([id, rule]) => [id, { prefixes: rule.prefixes, defaultEnabled: false }])),
|
|
45
|
+
} : {}),
|
|
46
|
+
...(g.access === "public" ? { access: "public" } : {}),
|
|
47
|
+
...(g.upstream_access === "public" ? { upstreamAccess: "public" } : {}),
|
|
48
|
+
notices,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export function formatGatewayReview(report) {
|
|
52
|
+
return report?.notices.map(n => `${n.severity.toUpperCase()} ${n.code}${n.path ? ` ${n.path}` : ""}: ${n.message}`) ?? [];
|
|
53
|
+
}
|
|
@@ -2,6 +2,7 @@ import { type PackageDependencies } from "./package-dependencies.js";
|
|
|
2
2
|
import { type InstallSettings } from './install-settings.js';
|
|
3
3
|
import { type WebLaunchMode } from "../contract/web-launch.js";
|
|
4
4
|
import { type ComposeApp } from "./compose.js";
|
|
5
|
+
import { type GatewayReviewReport } from "./gateway-review.js";
|
|
5
6
|
import { type ExecutorInspection } from "../runtime/executor-inspect.js";
|
|
6
7
|
import { type AppScriptName } from "./app-scripts.js";
|
|
7
8
|
import { type HyperBackup } from "./hyper-backup.js";
|
|
@@ -15,6 +16,8 @@ export interface SpkInspection {
|
|
|
15
16
|
/** Hyper Backup application backup, as sdk-package.json records it. */
|
|
16
17
|
hyperBackup?: HyperBackup;
|
|
17
18
|
identityGateway?: GatewayAdmissionReport;
|
|
19
|
+
/** DSM sign-in exceptions from the packaged gateway configuration; nonblocking. */
|
|
20
|
+
gateway?: GatewayReviewReport;
|
|
18
21
|
kind?: SpkKind;
|
|
19
22
|
package?: string;
|
|
20
23
|
version?: string;
|
|
@@ -14,6 +14,7 @@ import { dsmLauncherType } from "../contract/app-launch.js";
|
|
|
14
14
|
import { isWebLaunchMode, resolvedWebLaunch, trustedAppEntryPath, usesAuthGateway, } from "../contract/web-launch.js";
|
|
15
15
|
import { loadContract } from "../contract/load.js";
|
|
16
16
|
import { readComposeApp, composeSource, dsmComposeProblem, COMPOSE_READINESS_LIMITATION, COMPOSE_HOST_READINESS_LIMITATION, } from "./compose.js";
|
|
17
|
+
import { gatewayReviewReport } from "./gateway-review.js";
|
|
17
18
|
import { createHash } from "node:crypto";
|
|
18
19
|
import { inspectNativeLayout } from "./native-layout.js";
|
|
19
20
|
import { checkBridgeApp, checkBridgeExecutor } from "./inspect-bridge.js";
|
|
@@ -168,7 +169,7 @@ export async function inspectSpk(spkPath, expectedKind) {
|
|
|
168
169
|
await inspectModuleUi(dir, paths, metadata.ui_module, findings);
|
|
169
170
|
if (metadata.daemon_restart !== undefined && (metadata.compose !== undefined || !paths.has("daemon/control")))
|
|
170
171
|
findings.push("DAEMON_RESTART_INVALID daemon restart requires a native daemon controller, without Compose supervision");
|
|
171
|
-
const identityGateway = await
|
|
172
|
+
const { identityGateway, gateway } = await inspectGatewayAdmission(dir, paths, metadata.provider_only_oidc, findings);
|
|
172
173
|
await inspectExternalGateway(dir, paths, payload, metadata.gateway_external, findings);
|
|
173
174
|
const installSettings = await inspectInstallSettings(dir, payload, metadata, findings);
|
|
174
175
|
const hyperBackup = metadataText === undefined ? undefined : await inspectHyperBackup(dir, async () => {
|
|
@@ -191,6 +192,8 @@ export async function inspectSpk(spkPath, expectedKind) {
|
|
|
191
192
|
result.hyperBackup = hyperBackup;
|
|
192
193
|
if (identityGateway)
|
|
193
194
|
result.identityGateway = identityGateway;
|
|
195
|
+
if (gateway)
|
|
196
|
+
result.gateway = gateway;
|
|
194
197
|
result.icon = inspectPackageIcons(dir, findings);
|
|
195
198
|
return result;
|
|
196
199
|
}
|
|
@@ -352,6 +355,7 @@ export async function inspectSpk(spkPath, expectedKind) {
|
|
|
352
355
|
...(dependencies ? { dependencies } : {}),
|
|
353
356
|
kind,
|
|
354
357
|
...(identityGateway ? { identityGateway } : {}),
|
|
358
|
+
...(gateway ? { gateway } : {}),
|
|
355
359
|
...(installSettings ? { installSettings } : {}),
|
|
356
360
|
...(hyperBackup ? { hyperBackup } : {}),
|
|
357
361
|
...(launch ? { launch } : {}),
|
|
@@ -1198,23 +1202,24 @@ async function checkContainerExposure(dir, packageTgz, findings) {
|
|
|
1198
1202
|
function readOptional(path) {
|
|
1199
1203
|
return existsSync(path) ? readFileSync(path, "utf8") : undefined;
|
|
1200
1204
|
}
|
|
1201
|
-
async function
|
|
1205
|
+
async function inspectGatewayAdmission(dir, paths, saved, findings) {
|
|
1202
1206
|
try {
|
|
1203
1207
|
if (!paths.has("sso/gateway.json")) {
|
|
1204
1208
|
if (saved !== undefined)
|
|
1205
1209
|
throw new Error("OIDC admission policy has no gateway configuration");
|
|
1206
|
-
return;
|
|
1210
|
+
return {};
|
|
1207
1211
|
}
|
|
1208
1212
|
const root = join(dir, "gateway-admission-inspection");
|
|
1209
1213
|
mkdirSync(root);
|
|
1210
1214
|
await tar.x({ file: join(dir, "package.tgz"), cwd: root, filter: p => p.replace(/^\.\//, "") === "sso/gateway.json" });
|
|
1211
1215
|
const cfg = JSON.parse(readFileSync(join(root, "sso/gateway.json"), "utf8"));
|
|
1216
|
+
const gateway = gatewayReviewReport(cfg);
|
|
1212
1217
|
if (cfg.upstream_access !== undefined && !["public", "protected"].includes(cfg.upstream_access))
|
|
1213
1218
|
throw new Error("invalid OIDC upstream admission policy");
|
|
1214
1219
|
if (cfg.upstream_access !== "public") {
|
|
1215
1220
|
if (saved !== undefined)
|
|
1216
1221
|
throw new Error("OIDC admission policy differs from its build declaration");
|
|
1217
|
-
return;
|
|
1222
|
+
return gateway ? { gateway } : {};
|
|
1218
1223
|
}
|
|
1219
1224
|
if (cfg.mode !== "oidc" || !["dsm-users", "dsm-admins", "dsm-groups"].includes(cfg.access)
|
|
1220
1225
|
|| cfg.entry !== undefined || cfg.compose_blocked
|
|
@@ -1225,11 +1230,11 @@ async function inspectProviderOnlyAdmission(dir, paths, saved, findings) {
|
|
|
1225
1230
|
const report = gatewayAdmissionReport(cfg, cfg.entry);
|
|
1226
1231
|
if (!isDeepStrictEqual(gatewayAdmissionPolicy(cfg, cfg.entry), saved))
|
|
1227
1232
|
throw new Error("OIDC admission policy differs from its build declaration");
|
|
1228
|
-
return report;
|
|
1233
|
+
return { identityGateway: report, ...(gateway ? { gateway } : {}) };
|
|
1229
1234
|
}
|
|
1230
1235
|
catch (e) {
|
|
1231
1236
|
findings.push(e.message);
|
|
1232
|
-
return;
|
|
1237
|
+
return {};
|
|
1233
1238
|
}
|
|
1234
1239
|
}
|
|
1235
1240
|
/** External settings are the same package-account gateway binary as the existing CGI entries. */
|
package/package.json
CHANGED
|
@@ -20,6 +20,15 @@ SDK RPC methods cannot use this exception. The CLI checks matching SDK capabilit
|
|
|
20
20
|
and links the gateway policy digest; editing the static paths requires rebuilding.
|
|
21
21
|
See [the App entry contract](../../docs/app-entry.md) for the complete contract.
|
|
22
22
|
|
|
23
|
+
`inspect` lists paths that do not require DSM sign-in in its human output and
|
|
24
|
+
JSON `gateway` field: upstream-auth paths, permanent passthrough, default-off
|
|
25
|
+
optional passthrough, and public gateway/upstream access. Review the App's own
|
|
26
|
+
authentication and public/share routes. `check` shows the same nonblocking INFO
|
|
27
|
+
notice. The small breadth heuristic warns only for a single `/api`, `/v` followed
|
|
28
|
+
by digits, or `/graphql` segment, with an optional trailing slash; narrow these
|
|
29
|
+
to the routes the upstream really authenticates. These WARNING notices never
|
|
30
|
+
block builds.
|
|
31
|
+
|
|
23
32
|
A plugin page in an iframe with `sandbox="allow-scripts"` has an opaque origin
|
|
24
33
|
and may request resources without DSM cookies. The frame can stay on "Opening…",
|
|
25
34
|
show broken images (`naturalWidth === 0`) and lack its upstream JavaScript global,
|