@uns-kit/core 3.0.28 → 3.0.31
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/MIGRATIONS.md +118 -0
- package/README.md +10 -0
- package/dist/config/app-config.d.ts +15 -0
- package/dist/config/app-config.d.ts.map +1 -1
- package/dist/config/app-config.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/runtime/configuration-group-authorization.d.ts +50 -0
- package/dist/runtime/configuration-group-authorization.d.ts.map +1 -0
- package/dist/runtime/configuration-group-authorization.js +113 -0
- package/dist/runtime/configuration-group-authorization.js.map +1 -0
- package/dist/runtime/configuration-group-contract.d.ts +75 -0
- package/dist/runtime/configuration-group-contract.d.ts.map +1 -0
- package/dist/runtime/configuration-group-contract.js +233 -0
- package/dist/runtime/configuration-group-contract.js.map +1 -0
- package/dist/runtime/mqtt-output-state-contract.d.ts +27 -0
- package/dist/runtime/mqtt-output-state-contract.d.ts.map +1 -0
- package/dist/runtime/mqtt-output-state-contract.js +32 -0
- package/dist/runtime/mqtt-output-state-contract.js.map +1 -0
- package/dist/runtime/mqtt-output-state-contract.json +8 -0
- package/dist/runtime/mqtt-output-state-program.d.mts +28 -0
- package/dist/runtime/mqtt-output-state-program.mjs +511 -0
- package/dist/runtime/process-group-authorization.d.ts +2 -0
- package/dist/runtime/process-group-authorization.d.ts.map +1 -1
- package/dist/runtime/process-group-authorization.js +34 -12
- package/dist/runtime/process-group-authorization.js.map +1 -1
- package/dist/runtime/process-group-backup-contract.d.ts +22 -0
- package/dist/runtime/process-group-backup-contract.d.ts.map +1 -0
- package/dist/runtime/process-group-backup-contract.js +20 -0
- package/dist/runtime/process-group-backup-contract.js.map +1 -0
- package/dist/runtime/process-group-backup-contract.json +7 -0
- package/dist/runtime/process-group-configured-upgrade.d.ts +4 -0
- package/dist/runtime/process-group-configured-upgrade.d.ts.map +1 -0
- package/dist/runtime/process-group-configured-upgrade.js +107 -0
- package/dist/runtime/process-group-configured-upgrade.js.map +1 -0
- package/dist/runtime/process-group-generation.d.ts +166 -0
- package/dist/runtime/process-group-generation.d.ts.map +1 -0
- package/dist/runtime/process-group-generation.js +278 -0
- package/dist/runtime/process-group-generation.js.map +1 -0
- package/dist/runtime/process-group-inspection.d.ts +2 -0
- package/dist/runtime/process-group-inspection.d.ts.map +1 -1
- package/dist/runtime/process-group-inspection.js +120 -40
- package/dist/runtime/process-group-inspection.js.map +1 -1
- package/dist/runtime/process-group-resources.d.ts +1 -0
- package/dist/runtime/process-group-resources.d.ts.map +1 -1
- package/dist/runtime/process-group-resources.js +8 -0
- package/dist/runtime/process-group-resources.js.map +1 -1
- package/dist/runtime/process-group-runtime-selection.d.ts +14 -0
- package/dist/runtime/process-group-runtime-selection.d.ts.map +1 -0
- package/dist/runtime/process-group-runtime-selection.js +29 -0
- package/dist/runtime/process-group-runtime-selection.js.map +1 -0
- package/dist/runtime/process-group-snapshot.mjs +60 -8
- package/dist/runtime/process-group-staging.d.ts +2 -2
- package/dist/runtime/process-group-staging.d.ts.map +1 -1
- package/dist/runtime/process-group-staging.js +6 -4
- package/dist/runtime/process-group-staging.js.map +1 -1
- package/dist/runtime/process-group-supervision.d.ts +2 -2
- package/dist/runtime/process-group-supervision.d.ts.map +1 -1
- package/dist/runtime/process-group-supervision.js +3 -2
- package/dist/runtime/process-group-supervision.js.map +1 -1
- package/dist/runtime/process-group-upgrade.d.ts +76 -6
- package/dist/runtime/process-group-upgrade.d.ts.map +1 -1
- package/dist/runtime/process-group-upgrade.js +7 -1
- package/dist/runtime/process-group-upgrade.js.map +1 -1
- package/dist/uns/uns-interfaces.d.ts +3 -0
- package/dist/uns/uns-interfaces.d.ts.map +1 -1
- package/dist/uns/uns-interfaces.js.map +1 -1
- package/dist/uns/uns-proxy-process.d.ts.map +1 -1
- package/dist/uns/uns-proxy-process.js +3 -0
- package/dist/uns/uns-proxy-process.js.map +1 -1
- package/dist/uns-config/config-schema.d.ts +20 -0
- package/dist/uns-config/config-schema.d.ts.map +1 -1
- package/dist/uns-config/mqtt-channel.d.ts +1 -1
- package/dist/uns-config/mqtt-channel.d.ts.map +1 -1
- package/dist/uns-config/mqtt-channel.js +3 -0
- package/dist/uns-config/mqtt-channel.js.map +1 -1
- package/dist/uns-config/uns-core-schema.d.ts +145 -0
- package/dist/uns-config/uns-core-schema.d.ts.map +1 -1
- package/dist/uns-config/uns-core-schema.js +6 -1
- package/dist/uns-config/uns-core-schema.js.map +1 -1
- package/dist/uns-mqtt/mqtt-interfaces.d.ts +5 -0
- package/dist/uns-mqtt/mqtt-interfaces.d.ts.map +1 -1
- package/dist/uns-mqtt/mqtt-interfaces.js.map +1 -1
- package/dist/uns-mqtt/mqtt-proxy.d.ts +3 -0
- package/dist/uns-mqtt/mqtt-proxy.d.ts.map +1 -1
- package/dist/uns-mqtt/mqtt-proxy.js +26 -1
- package/dist/uns-mqtt/mqtt-proxy.js.map +1 -1
- package/dist/uns-mqtt/mqtt-worker.d.ts +3 -1
- package/dist/uns-mqtt/mqtt-worker.d.ts.map +1 -1
- package/dist/uns-mqtt/mqtt-worker.js +45 -8
- package/dist/uns-mqtt/mqtt-worker.js.map +1 -1
- package/dist/uns-mqtt/publish-queue-contract.d.ts +37 -0
- package/dist/uns-mqtt/publish-queue-contract.d.ts.map +1 -0
- package/dist/uns-mqtt/publish-queue-contract.js +19 -0
- package/dist/uns-mqtt/publish-queue-contract.js.map +1 -0
- package/dist/uns-mqtt/publish-queue-store.d.ts +34 -0
- package/dist/uns-mqtt/publish-queue-store.d.ts.map +1 -0
- package/dist/uns-mqtt/publish-queue-store.js +176 -0
- package/dist/uns-mqtt/publish-queue-store.js.map +1 -0
- package/dist/uns-mqtt/publish-queue.d.ts +43 -0
- package/dist/uns-mqtt/publish-queue.d.ts.map +1 -0
- package/dist/uns-mqtt/publish-queue.js +235 -0
- package/dist/uns-mqtt/publish-queue.js.map +1 -0
- package/dist/uns-mqtt/uns-mqtt-proxy.d.ts +7 -0
- package/dist/uns-mqtt/uns-mqtt-proxy.d.ts.map +1 -1
- package/dist/uns-mqtt/uns-mqtt-proxy.js +98 -5
- package/dist/uns-mqtt/uns-mqtt-proxy.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-group-authorization.js","sourceRoot":"","sources":["../../src/runtime/process-group-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,MAAM,MAAM,+CAA+C,CAAC;AACxE,OAAO,EAEL,kCAAkC,EAClC,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,8BAA8B,EAC9B,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,IAAI,IAAI,EAChC,MAAM,IAAI,GAAG,GACd,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,8BAA8B,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEpH,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,4BAA4B,CAAC;AAChF,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAC/C,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAClD,MAAM,QAAQ,GAAG,CAAC;KACf,MAAM,EAAE;KACR,GAAG,CAAC,GAAG,CAAC;KACR,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9D,MAAM,SAAS,GAA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QAC7F,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,gCAAgC,CAAC,EAAE,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9F,IACE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,OAAO;YACjD,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO;YAC9C,CAAC,CAAC,WAAW,KAAK,WAAW;YAC7B,CAAC,CAAC,IAAI,KAAK,QAAQ;YACnB,CAAC,CAAC,UAAU,EAAE,QAAQ,KAAK,QAAQ;YACnC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,OAAO;YAC7D,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,OAAO;YAElD,MAAM,KAAK,EAAE,CAAC;IAClB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,KAAK,CAAC,0EAA0E,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC;AACD,MAAM,CAAC,MAAM,oBAAoB,GAAG,8BAA8B,CAAC","sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { z } from \"zod\";\n\nimport * as legacy from \"./compatibility/energenti-authorization-v1.js\";\nimport {\n type ProcessGroupRuntimeDescriptor,\n normalizeProcessGroupConfiguration,\n processGroupDescriptor,\n resolvedProcessGroupChannels,\n} from \"./process-group-contract.js\";\nimport {\n configurationAuthorizationHash,\n groupArtifactHash,\n groupChannelsHash,\n readProcessGroupResource as read,\n sha256 as sha,\n} from \"./process-group-resources.js\";\n\nexport { configurationAuthorizationHash, groupArtifactHash, groupChannelsHash } from \"./process-group-resources.js\";\n\nexport const hasProcessGroupAuthorization = legacy.hasProcessGroupAuthorization;\nconst digest = z.string().regex(/^[a-f0-9]{64}$/),\n id = z.string().regex(/^[a-z][a-z0-9-]{0,99}$/);\nconst absolute = z\n .string()\n .max(512)\n .refine((v) => path.isAbsolute(v) && path.resolve(v) === v);\nconst placement = z.strictObject({\n instanceId: z.string().regex(/^[a-zA-Z0-9-]{1,100}$/),\n processName: id,\n role: z.enum([\"source\", \"target\", \"receiver\"]),\n configurationSha256: digest,\n});\nexport const processGroupAuthorizationSchema = z.strictObject({\n schemaVersion: z.literal(3),\n kind: z.literal(\"uns-process-group-runtime-authorization\"),\n protocolVersion: z.literal(1),\n packageName: z.string().min(1).max(214),\n namespace: id,\n groupId: id,\n descriptorSha256: digest,\n controllerName: z.string().min(1).max(100),\n packageRoot: absolute,\n artifactSha256: digest,\n groupManifestSha256: digest,\n channelsSha256: digest,\n stateRoot: absolute,\n directory: absolute,\n journalId: z.string().uuid().nullable(),\n placements: z.array(placement).min(4).max(18),\n});\nexport type ProcessGroupAuthorizationPolicy = z.infer<typeof processGroupAuthorizationSchema>;\nexport const processGroupManifestSchema = z.strictObject({\n schemaVersion: z.literal(1),\n id,\n inputTopic: z\n .string()\n .min(1)\n .max(512)\n .regex(/^[^#+\\0]+$/),\n processName: id,\n profiles: z\n .array(z.strictObject({ id, processName: id, mappingFile: z.string().min(1).max(512), mappingSha256: digest, dataGroup: id }))\n .min(2)\n .max(16),\n});\ninterface GenericAuthorization {\n readonly sha256: string;\n readonly file: string;\n readonly directory: string;\n readonly journalId: string | null;\n readonly role: \"source\" | \"target\" | \"receiver\";\n readonly groupId: string;\n readonly groupProcessName: string;\n readonly namespace: string;\n}\nexport type ProcessGroupAuthorization = legacy.HvAuthorization | GenericAuthorization;\nexport type HvAuthorization = ProcessGroupAuthorization;\nexport type HvAuthorizationPolicy = legacy.HvAuthorizationPolicy;\nexport const hvAuthorizationSchema = legacy.hvAuthorizationSchema;\nexport const productionGroupIds = legacy.productionGroupIds;\nconst issued = new WeakSet<object>();\nfunction privateDirectory(dir: string): void {\n for (let p = dir; p !== path.dirname(p); p = path.dirname(p)) if (fs.lstatSync(p).isSymbolicLink()) throw Error(\"Linked policy directory\");\n const s = fs.lstatSync(dir);\n if (!s.isDirectory() || s.uid !== process.getuid?.() || (s.mode & 0o077) !== 0) throw Error(\"Insecure policy directory\");\n}\nfunction registryRoot(root: string, dir: string): string {\n if (!path.isAbsolute(root) || path.resolve(root) !== root || path.resolve(dir) !== dir) throw Error(\"Invalid policy registry\");\n privateDirectory(root);\n if (dir === root) return \"*\"; // Explicit collection of independently owned namespaces.\n const relative = path.relative(root, dir);\n if (!path.isAbsolute(root) || path.resolve(root) !== root || !/^([a-z][a-z0-9-]{0,99})\\/authorizations$/.test(relative))\n throw Error(\"Invalid policy registry\");\n privateDirectory(root);\n privateDirectory(dir);\n return relative.split(\"/\")[0]!;\n}\nfunction selectedFile(pkg: string, raw: Record<string, unknown>, root: string, explicit?: string): string {\n const descriptor = processGroupDescriptor(pkg);\n if (!descriptor) throw Error(\"Missing runtime contract\");\n const c = normalizeProcessGroupConfiguration(raw, descriptor),\n journal = c.journal as Record<string, unknown> | undefined;\n const manifest = descriptor.manifests.find((m) => m.file === journal?.[\"groupManifest\"]);\n if (!manifest) throw Error(\"Unregistered group manifest\");\n const dir = process.env[\"UNS_PROCESS_GROUP_AUTHORIZATION_DIRECTORY\"];\n if (explicit) return explicit;\n if (dir) {\n const selected = registryRoot(root, dir);\n if (selected !== \"*\" && selected !== descriptor.namespace) throw Error(\"Foreign runtime registry\");\n const registry = selected === \"*\" ? path.join(root, descriptor.namespace, \"authorizations\") : dir;\n privateDirectory(registry);\n return path.join(registry, manifest.id + \".json\");\n }\n const single = process.env[\"UNS_PROCESS_GROUP_AUTHORIZATION_FILE\"];\n if (!single) throw Error(\"No selected policy\");\n return single;\n}\n/** Bounded private registry enumeration; retained state without its policy fails closed.\n * New groups are operator-owned data and never a release-time enum in the Controller.\n */\nexport function configuredGroupProcessNames(): Set<string> {\n if (!hasProcessGroupAuthorization()) return new Set();\n try {\n const root = process.env[\"UNS_PROCESS_GROUP_STATE_ROOT\"];\n if (!root) throw Error();\n const files = new Set<string>();\n const single = process.env[\"UNS_PROCESS_GROUP_AUTHORIZATION_FILE\"];\n if (single) files.add(single);\n const dir = process.env[\"UNS_PROCESS_GROUP_AUTHORIZATION_DIRECTORY\"];\n if (dir) {\n const selected = registryRoot(root, dir);\n let registries: { namespace: string; directory: string }[];\n if (selected === \"*\") {\n const namespaces = fs.readdirSync(root, { withFileTypes: true });\n if (namespaces.length > 64 || namespaces.some((e) => e.isSymbolicLink())) throw Error(\"Registry namespace budget or link violation\");\n registries = namespaces\n .filter((e) => e.isDirectory())\n .map((e) => {\n if (!id.safeParse(e.name).success) throw Error(\"Invalid registry namespace\");\n privateDirectory(path.join(root, e.name));\n return { namespace: e.name, directory: path.join(root, e.name, \"authorizations\") };\n });\n } else registries = [{ namespace: selected, directory: dir }];\n for (const registry of registries) {\n let entries: fs.Dirent[] = [];\n try {\n privateDirectory(registry.directory);\n entries = fs.readdirSync(registry.directory, { withFileTypes: true });\n } catch (e) {\n if ((e as NodeJS.ErrnoException).code !== \"ENOENT\") throw e;\n }\n if (entries.length > 64) throw Error(\"Policy registry budget exceeded\");\n for (const entry of entries)\n if (entry.name.endsWith(\".json\")) {\n if (!/^[a-z][a-z0-9-]{0,99}\\.json$/.test(entry.name)) throw Error(\"Invalid registry entry\");\n files.add(path.join(registry.directory, entry.name));\n if (files.size > 64) throw Error(\"Total policy registry budget exceeded\");\n }\n const journals = path.join(root, registry.namespace, \"admission\");\n try {\n // Root/registry permissions already protect visibility; retain old parent modes.\n for (let parent = journals; parent !== path.dirname(parent); parent = path.dirname(parent))\n if (fs.lstatSync(parent).isSymbolicLink()) throw Error(\"Linked journal registry\");\n const retained = fs.readdirSync(journals, { withFileTypes: true });\n if (retained.length > 64) throw Error(\"Retained journal budget exceeded\");\n for (const entry of retained)\n if (\n !id.safeParse(entry.name).success ||\n entry.isSymbolicLink() ||\n !entry.isDirectory() ||\n !files.has(path.join(registry.directory, entry.name + \".json\"))\n )\n throw Error(\"Retained journal has no reviewed policy\");\n } catch (e) {\n if ((e as NodeJS.ErrnoException).code !== \"ENOENT\") throw e;\n }\n }\n }\n const result = new Set<string>();\n for (const file of files) {\n const raw = JSON.parse(read(file, true).toString());\n const p =\n raw.schemaVersion === 3\n ? processGroupAuthorizationSchema.parse(raw)\n : z.union([legacy.hvAuthorizationSchema, legacy.processGroupAuthorizationSchema]).parse(raw);\n const { namespace, group } = p.schemaVersion === 3 ? { namespace: p.namespace, group: p.groupId } : legacy.legacyPolicyIdentity(p);\n if (\n p.stateRoot !== root ||\n file !== path.join(root, namespace, \"authorizations\", group + \".json\") ||\n p.directory !== path.join(root, namespace, \"admission\", group)\n )\n throw Error();\n privateDirectory(root);\n privateDirectory(path.dirname(file));\n for (const role of p.placements) result.add(role.processName);\n }\n return result;\n } catch {\n throw Error(\"Process-group authorization registry is missing, changed or insecure; review required\");\n }\n}\nexport interface ProcessGroupAuthorizationContext {\n packageRoot: string;\n instanceDirectory: string;\n rawConfiguration: Record<string, unknown>;\n channels: unknown[];\n controllerName: string;\n file?: string;\n stateRoot?: string;\n initialize?: boolean;\n}\nfunction verifyRuntimePolicy(context: ProcessGroupAuthorizationContext, candidate?: Buffer): ProcessGroupAuthorization {\n try {\n const root = context.stateRoot ?? process.env[\"UNS_PROCESS_GROUP_STATE_ROOT\"];\n if (!root || !context.controllerName) throw Error();\n const file = selectedFile(context.packageRoot, context.rawConfiguration, root, context.file),\n bytes = candidate ?? read(file, true),\n unparsed = JSON.parse(bytes.toString());\n if (unparsed.schemaVersion !== 3) {\n if (candidate) throw Error(\"Only generic policies can be staged\");\n return legacy.authorizeHvRuntime({ ...context, file, stateRoot: root });\n }\n const p = processGroupAuthorizationSchema.parse(unparsed),\n d = processGroupDescriptor(context.packageRoot);\n if (!d || d.legacy) throw Error(\"Generic runtime descriptor required\");\n const pkg = JSON.parse(read(path.join(context.packageRoot, \"package.json\")).toString());\n const manifest = d.manifests.find((m) => m.id === p.groupId);\n if (\n !manifest ||\n p.packageName !== pkg.name ||\n p.namespace !== d.namespace ||\n p.descriptorSha256 !== configurationAuthorizationHash(pkg.unsDatahub.processGroupRuntime) ||\n p.packageRoot !== context.packageRoot ||\n p.controllerName !== context.controllerName ||\n p.stateRoot !== root ||\n file !== path.join(root, d.namespace, \"authorizations\", p.groupId + \".json\") ||\n p.directory !== path.join(root, d.namespace, \"admission\", p.groupId)\n )\n throw Error();\n privateDirectory(root);\n privateDirectory(path.dirname(file));\n if (groupArtifactHash(context.packageRoot) !== p.artifactSha256 || groupChannelsHash(context.channels) !== p.channelsSha256) throw Error();\n const manifestBytes = read(path.join(context.packageRoot, manifest.file));\n if (sha(manifestBytes) !== p.groupManifestSha256) throw Error();\n const m = processGroupManifestSchema.parse(JSON.parse(manifestBytes.toString()));\n if (m.id !== p.groupId) throw Error();\n const receiver = m.processName + \"-admission\";\n if (\n new Set(m.profiles.map((x) => x.id)).size !== m.profiles.length ||\n new Set(m.profiles.map((x) => x.processName)).size !== m.profiles.length ||\n m.profiles.some((x) => x.processName === m.processName || x.processName === receiver)\n )\n throw Error();\n for (const member of m.profiles) {\n const f = path.resolve(context.packageRoot, path.dirname(manifest.file), member.mappingFile);\n if (!f.startsWith(context.packageRoot + path.sep) || sha(read(f)) !== member.mappingSha256) throw Error();\n }\n const expected = new Map([\n ...m.profiles.map((x) => [x.processName, \"source\"] as const),\n [m.processName, \"target\"] as const,\n [receiver, \"receiver\"] as const,\n ]);\n if (\n p.placements.length !== expected.size ||\n new Set(p.placements.map((x) => x.instanceId)).size !== expected.size ||\n new Set(p.placements.map((x) => x.processName)).size !== expected.size ||\n p.placements.some((x) => expected.get(x.processName) !== x.role)\n )\n throw Error();\n const entry = p.placements.find((x) => context.instanceDirectory === path.join(context.packageRoot, \"instances\", x.instanceId));\n const c = normalizeProcessGroupConfiguration(context.rawConfiguration, d),\n j = c.journal as Record<string, unknown> | undefined,\n k = c.publisher;\n if (\n !entry ||\n !c.matches ||\n entry.processName !== c.uns?.[\"processName\"] ||\n entry.configurationSha256 !== configurationAuthorizationHash(context.rawConfiguration) ||\n !j ||\n j[\"directory\"] !== p.directory ||\n (j[\"journalId\"] ?? null) !== p.journalId ||\n j[\"groupManifest\"] !== manifest.file\n )\n throw Error();\n if (context.initialize ? p.journalId !== null || entry.role !== \"receiver\" : p.journalId === null) throw Error();\n if (entry.role === \"receiver\" ? c.runtimeRole !== \"admission\" : c.runtimeRole !== undefined && c.runtimeRole !== \"publisher\") throw Error();\n const member = m.profiles.find((x) => x.processName === entry.processName),\n mapping = path.resolve(context.packageRoot, String(k[\"mappingFile\"]));\n if (\n entry.role !== \"source\"\n ? k[\"groupManifest\"] !== manifest.file\n : k[\"groupManifest\"] !== undefined ||\n k[\"dataGroup\"] !== member?.dataGroup ||\n !mapping.startsWith(context.packageRoot + path.sep) ||\n sha(read(mapping)) !== member?.mappingSha256\n )\n throw Error();\n const result = Object.freeze({\n sha256: sha(bytes),\n file,\n directory: p.directory,\n journalId: p.journalId,\n role: entry.role,\n groupId: p.groupId,\n groupProcessName: m.processName,\n namespace: d.namespace,\n });\n if (!candidate) issued.add(result);\n return result;\n } catch {\n throw Error(\"Process-group runtime authorization is missing, changed or does not match this installed placement; review required\");\n }\n}\n/** Live authority always comes from the current canonical private policy. */\nexport function authorizeProcessGroupRuntime(context: ProcessGroupAuthorizationContext): ProcessGroupAuthorization {\n return verifyRuntimePolicy(context);\n}\n/** Review only: never issues an authorization accepted by runtime/launch checks. */\nexport function validateProcessGroupPolicyCandidate(context: ProcessGroupAuthorizationContext, bytes: Buffer): void {\n verifyRuntimePolicy(context, bytes);\n}\nexport function processGroupAuthorizationFile(context: ProcessGroupAuthorizationContext): string {\n const root = context.stateRoot ?? process.env[\"UNS_PROCESS_GROUP_STATE_ROOT\"];\n if (!root) throw Error(\"Missing process-group state root\");\n return selectedFile(context.packageRoot, context.rawConfiguration, root, context.file);\n}\nexport const authorizeHvRuntime = authorizeProcessGroupRuntime;\nexport function authorizeConfiguredProcessGroupRuntime(\n pkg: string,\n dir: string,\n raw: Record<string, unknown>,\n controllerName: string,\n initialize = false,\n) {\n return authorizeProcessGroupRuntime({\n packageRoot: pkg,\n instanceDirectory: dir,\n rawConfiguration: raw,\n channels: resolvedProcessGroupChannels(raw),\n controllerName,\n initialize,\n });\n}\nexport function assertProcessGroupJournalAuthorization(\n value: ProcessGroupAuthorization | undefined,\n directory: string,\n journalId: string | undefined,\n): void {\n if (value && issued.has(value)) {\n if (value.directory !== directory || value.journalId !== (journalId ?? null) || sha(read(value.file, true)) !== value.sha256)\n throw Error(\"Exact reviewed process-group authorization required\");\n return;\n }\n legacy.assertHvJournalAuthorization(value as legacy.HvAuthorization | undefined, directory, journalId);\n}\nexport const assertHvJournalAuthorization = assertProcessGroupJournalAuthorization;\nexport function assertProcessGroupStateMount(value: ProcessGroupAuthorization, root: string): void {\n if (!issued.has(value)) {\n legacy.assertHvStateMount(value as legacy.HvAuthorization, root);\n return;\n }\n assertProcessGroupJournalAuthorization(value, value.directory, value.journalId ?? undefined);\n if (process.platform !== \"linux\" || !(\"namespace\" in value) || value.directory !== path.join(root, value.namespace, \"admission\", value.groupId))\n throw Error(\"Process group requires its reviewed Linux state mount\");\n const mount = fs\n .readFileSync(\"/proc/self/mountinfo\", \"utf8\")\n .split(\"\\n\")\n .map((l) => l.split(\" \"))\n .filter((f) => f[4] === root)\n .at(-1);\n if (!mount || !mount[5]?.split(\",\").includes(\"rw\") || ![\"xfs\", \"ext4\", \"btrfs\", \"zfs\"].includes(mount[mount.indexOf(\"-\") + 1] ?? \"\"))\n throw Error(\"Process-group state root must be an explicit writable local Linux filesystem mount\");\n}\nexport const assertHvStateMount = assertProcessGroupStateMount;\nexport function assertProcessGroupTargetLaunch(\n value: ProcessGroupAuthorization,\n dir: string,\n operationId: string | undefined,\n launchId: string | undefined,\n): void {\n if (!issued.has(value)) {\n legacy.assertHvTargetLaunch(value as legacy.HvAuthorization, dir, operationId, launchId);\n return;\n }\n if (value.role !== \"target\") return;\n try {\n assertProcessGroupJournalAuthorization(value, value.directory, value.journalId ?? undefined);\n const r = JSON.parse(read(path.join(dir, \"process-group-reservation.json\"), true).toString());\n if (\n !z.string().uuid().safeParse(operationId).success ||\n !z.string().uuid().safeParse(launchId).success ||\n r.operationId !== operationId ||\n r.role !== \"target\" ||\n r.lastLaunch?.launchId !== launchId ||\n !z.string().uuid().safeParse(r.lastLaunch?.requestId).success ||\n !digest.safeParse(r.configurationChecksum).success\n )\n throw Error();\n } catch {\n throw Error(\"Target requires its exact reviewed group reservation and launch identity\");\n }\n}\nexport const assertHvTargetLaunch = assertProcessGroupTargetLaunch;\n"]}
|
|
1
|
+
{"version":3,"file":"process-group-authorization.js","sourceRoot":"","sources":["../../src/runtime/process-group-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,MAAM,MAAM,+CAA+C,CAAC;AACxE,OAAO,EAAE,qCAAqC,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AACjK,OAAO,EAEL,kCAAkC,EAClC,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,8BAA8B,EAC9B,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,IAAI,IAAI,EAChC,MAAM,IAAI,GAAG,EACb,kCAAkC,GACnC,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,8BAA8B,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEpH,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,4BAA4B,CAAC;AAChF,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,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AAC,SAAS,IAAI,SAAS,CAAC,CAAC;QAC7F,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,gCAAgC,CAAC,EAAE,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9F,IACE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,OAAO;YACjD,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO;YAC9C,CAAC,CAAC,WAAW,KAAK,WAAW;YAC7B,CAAC,CAAC,IAAI,KAAK,QAAQ;YACnB,CAAC,CAAC,UAAU,EAAE,QAAQ,KAAK,QAAQ;YACnC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,OAAO;YAC7D,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,OAAO;YAElD,MAAM,KAAK,EAAE,CAAC;QAChB,IAAI,0BAA0B,IAAI,KAAK,IAAI,KAAK,CAAC,wBAAwB,KAAK,SAAS;YACrF,CAAC,CAAC,CAAC,wBAAwB,KAAK,KAAK,CAAC,wBAAwB,IAAI,CAAC,CAAC,YAAY,KAAK,KAAK,CAAC,YAAY,CAAC;YAAE,MAAM,KAAK,EAAE,CAAC;IAC5H,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,KAAK,CAAC,0EAA0E,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC;AACD,MAAM,CAAC,MAAM,oBAAoB,GAAG,8BAA8B,CAAC","sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { z } from \"zod\";\n\nimport * as legacy from \"./compatibility/energenti-authorization-v1.js\";\nimport { configurationGroupAuthorizationSchema, configurationGroupPolicyIdentity, verifyConfigurationGroupPolicy } from \"./configuration-group-authorization.js\";\nimport {\n type ProcessGroupRuntimeDescriptor,\n normalizeProcessGroupConfiguration,\n processGroupDescriptor,\n resolvedProcessGroupChannels,\n} from \"./process-group-contract.js\";\nimport {\n configurationAuthorizationHash,\n groupArtifactHash,\n groupChannelsHash,\n readProcessGroupResource as read,\n sha256 as sha,\n assertPrivateProcessGroupDirectory,\n} from \"./process-group-resources.js\";\n\nexport { configurationAuthorizationHash, groupArtifactHash, groupChannelsHash } from \"./process-group-resources.js\";\n\nexport const hasProcessGroupAuthorization = legacy.hasProcessGroupAuthorization;\nconst digest = z.string().regex(/^[a-f0-9]{64}$/),\n id = z.string().regex(/^[a-z][a-z0-9-]{0,99}$/);\nconst absolute = z\n .string()\n .max(512)\n .refine((v) => path.isAbsolute(v) && path.resolve(v) === v);\nconst placement = z.strictObject({\n instanceId: z.string().regex(/^[a-zA-Z0-9-]{1,100}$/),\n processName: id,\n role: z.enum([\"source\", \"target\", \"receiver\"]),\n configurationSha256: digest,\n});\nexport const processGroupAuthorizationSchema = z.strictObject({\n schemaVersion: z.literal(3),\n kind: z.literal(\"uns-process-group-runtime-authorization\"),\n protocolVersion: z.literal(1),\n packageName: z.string().min(1).max(214),\n namespace: id,\n groupId: id,\n descriptorSha256: digest,\n controllerName: z.string().min(1).max(100),\n packageRoot: absolute,\n artifactSha256: digest,\n groupManifestSha256: digest,\n channelsSha256: digest,\n stateRoot: absolute,\n directory: absolute,\n journalId: z.string().uuid().nullable(),\n placements: z.array(placement).min(4).max(18),\n});\nexport type ProcessGroupAuthorizationPolicy = z.infer<typeof processGroupAuthorizationSchema>;\nexport const processGroupManifestSchema = z.strictObject({\n schemaVersion: z.literal(1),\n id,\n inputTopic: z\n .string()\n .min(1)\n .max(512)\n .regex(/^[^#+\\0]+$/),\n processName: id,\n profiles: z\n .array(z.strictObject({ id, processName: id, mappingFile: z.string().min(1).max(512), mappingSha256: digest, dataGroup: id }))\n .min(2)\n .max(16),\n});\ninterface GenericAuthorization {\n readonly sha256: string;\n readonly file: string;\n readonly directory: string;\n readonly journalId: string | null;\n readonly role: \"source\" | \"target\" | \"receiver\";\n readonly groupId: string;\n readonly groupProcessName: string;\n readonly namespace: string;\n readonly generationId?: string;\n readonly configurationGroupSha256?: string;\n}\nexport type ProcessGroupAuthorization = legacy.HvAuthorization | GenericAuthorization;\nexport type HvAuthorization = ProcessGroupAuthorization;\nexport type HvAuthorizationPolicy = legacy.HvAuthorizationPolicy;\nexport const hvAuthorizationSchema = legacy.hvAuthorizationSchema;\nexport const productionGroupIds = legacy.productionGroupIds;\nconst issued = new WeakSet<object>();\nconst privateDirectory = assertPrivateProcessGroupDirectory;\nfunction registryRoot(root: string, dir: string): string {\n if (!path.isAbsolute(root) || path.resolve(root) !== root || path.resolve(dir) !== dir) throw Error(\"Invalid policy registry\");\n privateDirectory(root);\n if (dir === root) return \"*\"; // Explicit collection of independently owned namespaces.\n const relative = path.relative(root, dir);\n if (!path.isAbsolute(root) || path.resolve(root) !== root || !/^([a-z][a-z0-9-]{0,99})\\/authorizations$/.test(relative))\n throw Error(\"Invalid policy registry\");\n privateDirectory(root);\n privateDirectory(dir);\n return relative.split(\"/\")[0]!;\n}\nfunction selectedFile(pkg: string, raw: Record<string, unknown>, root: string, explicit?: string): string {\n const configured = configurationGroupPolicyIdentity(pkg, raw);\n if (configured) {\n if (explicit) return explicit;\n const directory = process.env[\"UNS_PROCESS_GROUP_AUTHORIZATION_DIRECTORY\"];\n if (directory) {\n const selected = registryRoot(root, directory);\n if (selected !== \"*\" && selected !== configured.namespace) throw Error(\"Foreign runtime registry\");\n const registry = selected === \"*\" ? path.join(root, configured.namespace, \"authorizations\") : directory;\n privateDirectory(registry);\n return path.join(registry, configured.generationId + \".json\");\n }\n const single = process.env[\"UNS_PROCESS_GROUP_AUTHORIZATION_FILE\"];\n if (!single) throw Error(\"No selected policy\");\n return single;\n }\n const descriptor = processGroupDescriptor(pkg);\n if (!descriptor) throw Error(\"Missing runtime contract\");\n const c = normalizeProcessGroupConfiguration(raw, descriptor),\n journal = c.journal as Record<string, unknown> | undefined;\n const manifest = descriptor.manifests.find((m) => m.file === journal?.[\"groupManifest\"]);\n if (!manifest) throw Error(\"Unregistered group manifest\");\n const dir = process.env[\"UNS_PROCESS_GROUP_AUTHORIZATION_DIRECTORY\"];\n if (explicit) return explicit;\n if (dir) {\n const selected = registryRoot(root, dir);\n if (selected !== \"*\" && selected !== descriptor.namespace) throw Error(\"Foreign runtime registry\");\n const registry = selected === \"*\" ? path.join(root, descriptor.namespace, \"authorizations\") : dir;\n privateDirectory(registry);\n return path.join(registry, manifest.id + \".json\");\n }\n const single = process.env[\"UNS_PROCESS_GROUP_AUTHORIZATION_FILE\"];\n if (!single) throw Error(\"No selected policy\");\n return single;\n}\n/** Bounded private registry enumeration; retained state without its policy fails closed.\n * New groups are operator-owned data and never a release-time enum in the Controller.\n */\nexport function configuredGroupProcessNames(): Set<string> {\n if (!hasProcessGroupAuthorization()) return new Set();\n try {\n const root = process.env[\"UNS_PROCESS_GROUP_STATE_ROOT\"];\n if (!root) throw Error();\n const files = new Set<string>();\n const single = process.env[\"UNS_PROCESS_GROUP_AUTHORIZATION_FILE\"];\n if (single) files.add(single);\n const dir = process.env[\"UNS_PROCESS_GROUP_AUTHORIZATION_DIRECTORY\"];\n if (dir) {\n const selected = registryRoot(root, dir);\n let registries: { namespace: string; directory: string }[];\n if (selected === \"*\") {\n const namespaces = fs.readdirSync(root, { withFileTypes: true });\n if (namespaces.length > 64 || namespaces.some((e) => e.isSymbolicLink())) throw Error(\"Registry namespace budget or link violation\");\n registries = namespaces\n .filter((e) => e.isDirectory())\n .map((e) => {\n if (!id.safeParse(e.name).success) throw Error(\"Invalid registry namespace\");\n privateDirectory(path.join(root, e.name));\n return { namespace: e.name, directory: path.join(root, e.name, \"authorizations\") };\n });\n } else registries = [{ namespace: selected, directory: dir }];\n for (const registry of registries) {\n let entries: fs.Dirent[] = [];\n try {\n privateDirectory(registry.directory);\n entries = fs.readdirSync(registry.directory, { withFileTypes: true });\n } catch (e) {\n if ((e as NodeJS.ErrnoException).code !== \"ENOENT\") throw e;\n }\n if (entries.length > 64) throw Error(\"Policy registry budget exceeded\");\n for (const entry of entries)\n if (entry.name.endsWith(\".json\")) {\n if (!/^[a-z][a-z0-9-]{0,99}\\.json$/.test(entry.name)) throw Error(\"Invalid registry entry\");\n files.add(path.join(registry.directory, entry.name));\n if (files.size > 64) throw Error(\"Total policy registry budget exceeded\");\n }\n const journals = path.join(root, registry.namespace, \"admission\");\n try {\n // Root/registry permissions already protect visibility; retain old parent modes.\n for (let parent = journals; parent !== path.dirname(parent); parent = path.dirname(parent))\n if (fs.lstatSync(parent).isSymbolicLink()) throw Error(\"Linked journal registry\");\n const retained = fs.readdirSync(journals, { withFileTypes: true });\n if (retained.length > 64) throw Error(\"Retained journal budget exceeded\");\n for (const entry of retained)\n if (\n !id.safeParse(entry.name).success ||\n entry.isSymbolicLink() ||\n !entry.isDirectory() ||\n !files.has(path.join(registry.directory, entry.name + \".json\"))\n )\n throw Error(\"Retained journal has no reviewed policy\");\n } catch (e) {\n if ((e as NodeJS.ErrnoException).code !== \"ENOENT\") throw e;\n }\n }\n }\n const result = new Set<string>();\n for (const file of files) {\n const raw = JSON.parse(read(file, true).toString());\n const p =\n raw.schemaVersion === 4 ? configurationGroupAuthorizationSchema.parse(raw) : raw.schemaVersion === 3\n ? processGroupAuthorizationSchema.parse(raw)\n : z.union([legacy.hvAuthorizationSchema, legacy.processGroupAuthorizationSchema]).parse(raw);\n const { namespace, group } = p.schemaVersion === 4 ? { namespace: p.namespace, group: p.generationId }\n : p.schemaVersion === 3 ? { namespace: p.namespace, group: p.groupId } : legacy.legacyPolicyIdentity(p);\n if (\n p.stateRoot !== root ||\n file !== path.join(root, namespace, \"authorizations\", group + \".json\") ||\n p.directory !== path.join(root, namespace, \"admission\", group)\n )\n throw Error();\n privateDirectory(root);\n privateDirectory(path.dirname(file));\n for (const role of p.placements) result.add(role.processName);\n }\n return result;\n } catch {\n throw Error(\"Process-group authorization registry is missing, changed or insecure; review required\");\n }\n}\nexport interface ProcessGroupAuthorizationContext {\n packageRoot: string;\n instanceDirectory: string;\n rawConfiguration: Record<string, unknown>;\n channels: unknown[];\n controllerName: string;\n file?: string;\n stateRoot?: string;\n initialize?: boolean;\n}\nfunction verifyRuntimePolicy(context: ProcessGroupAuthorizationContext, candidate?: Buffer): ProcessGroupAuthorization {\n try {\n const root = context.stateRoot ?? process.env[\"UNS_PROCESS_GROUP_STATE_ROOT\"];\n if (!root || !context.controllerName) throw Error();\n const file = selectedFile(context.packageRoot, context.rawConfiguration, root, context.file),\n bytes = candidate ?? read(file, true),\n unparsed = JSON.parse(bytes.toString());\n if (unparsed.schemaVersion === 4) {\n const result = verifyConfigurationGroupPolicy(context, bytes, root, file);\n if (!candidate) issued.add(result);\n return result;\n }\n if (unparsed.schemaVersion !== 3) {\n if (candidate) throw Error(\"Only generic policies can be staged\");\n return legacy.authorizeHvRuntime({ ...context, file, stateRoot: root });\n }\n const p = processGroupAuthorizationSchema.parse(unparsed),\n d = processGroupDescriptor(context.packageRoot);\n if (!d || d.legacy) throw Error(\"Generic runtime descriptor required\");\n const pkg = JSON.parse(read(path.join(context.packageRoot, \"package.json\")).toString());\n const manifest = d.manifests.find((m) => m.id === p.groupId);\n if (\n !manifest ||\n p.packageName !== pkg.name ||\n p.namespace !== d.namespace ||\n p.descriptorSha256 !== configurationAuthorizationHash(pkg.unsDatahub.processGroupRuntime) ||\n p.packageRoot !== context.packageRoot ||\n p.controllerName !== context.controllerName ||\n p.stateRoot !== root ||\n file !== path.join(root, d.namespace, \"authorizations\", p.groupId + \".json\") ||\n p.directory !== path.join(root, d.namespace, \"admission\", p.groupId)\n )\n throw Error();\n privateDirectory(root);\n privateDirectory(path.dirname(file));\n if (groupArtifactHash(context.packageRoot) !== p.artifactSha256 || groupChannelsHash(context.channels) !== p.channelsSha256) throw Error();\n const manifestBytes = read(path.join(context.packageRoot, manifest.file));\n if (sha(manifestBytes) !== p.groupManifestSha256) throw Error();\n const m = processGroupManifestSchema.parse(JSON.parse(manifestBytes.toString()));\n if (m.id !== p.groupId) throw Error();\n const receiver = m.processName + \"-admission\";\n if (\n new Set(m.profiles.map((x) => x.id)).size !== m.profiles.length ||\n new Set(m.profiles.map((x) => x.processName)).size !== m.profiles.length ||\n m.profiles.some((x) => x.processName === m.processName || x.processName === receiver)\n )\n throw Error();\n for (const member of m.profiles) {\n const f = path.resolve(context.packageRoot, path.dirname(manifest.file), member.mappingFile);\n if (!f.startsWith(context.packageRoot + path.sep) || sha(read(f)) !== member.mappingSha256) throw Error();\n }\n const expected = new Map([\n ...m.profiles.map((x) => [x.processName, \"source\"] as const),\n [m.processName, \"target\"] as const,\n [receiver, \"receiver\"] as const,\n ]);\n if (\n p.placements.length !== expected.size ||\n new Set(p.placements.map((x) => x.instanceId)).size !== expected.size ||\n new Set(p.placements.map((x) => x.processName)).size !== expected.size ||\n p.placements.some((x) => expected.get(x.processName) !== x.role)\n )\n throw Error();\n const entry = p.placements.find((x) => context.instanceDirectory === path.join(context.packageRoot, \"instances\", x.instanceId));\n const c = normalizeProcessGroupConfiguration(context.rawConfiguration, d),\n j = c.journal as Record<string, unknown> | undefined,\n k = c.publisher;\n if (\n !entry ||\n !c.matches ||\n entry.processName !== c.uns?.[\"processName\"] ||\n entry.configurationSha256 !== configurationAuthorizationHash(context.rawConfiguration) ||\n !j ||\n j[\"directory\"] !== p.directory ||\n (j[\"journalId\"] ?? null) !== p.journalId ||\n j[\"groupManifest\"] !== manifest.file\n )\n throw Error();\n if (context.initialize ? p.journalId !== null || entry.role !== \"receiver\" : p.journalId === null) throw Error();\n if (entry.role === \"receiver\" ? c.runtimeRole !== \"admission\" : c.runtimeRole !== undefined && c.runtimeRole !== \"publisher\") throw Error();\n const member = m.profiles.find((x) => x.processName === entry.processName),\n mapping = path.resolve(context.packageRoot, String(k[\"mappingFile\"]));\n if (\n entry.role !== \"source\"\n ? k[\"groupManifest\"] !== manifest.file\n : k[\"groupManifest\"] !== undefined ||\n k[\"dataGroup\"] !== member?.dataGroup ||\n !mapping.startsWith(context.packageRoot + path.sep) ||\n sha(read(mapping)) !== member?.mappingSha256\n )\n throw Error();\n const result = Object.freeze({\n sha256: sha(bytes),\n file,\n directory: p.directory,\n journalId: p.journalId,\n role: entry.role,\n groupId: p.groupId,\n groupProcessName: m.processName,\n namespace: d.namespace,\n });\n if (!candidate) issued.add(result);\n return result;\n } catch {\n throw Error(\"Process-group runtime authorization is missing, changed or does not match this installed placement; review required\");\n }\n}\n/** Live authority always comes from the current canonical private policy. */\nexport function authorizeProcessGroupRuntime(context: ProcessGroupAuthorizationContext): ProcessGroupAuthorization {\n return verifyRuntimePolicy(context);\n}\n/** Review only: never issues an authorization accepted by runtime/launch checks. */\nexport function validateProcessGroupPolicyCandidate(context: ProcessGroupAuthorizationContext, bytes: Buffer): void {\n verifyRuntimePolicy(context, bytes);\n}\nexport function processGroupAuthorizationFile(context: ProcessGroupAuthorizationContext): string {\n const root = context.stateRoot ?? process.env[\"UNS_PROCESS_GROUP_STATE_ROOT\"];\n if (!root) throw Error(\"Missing process-group state root\");\n return selectedFile(context.packageRoot, context.rawConfiguration, root, context.file);\n}\nexport const authorizeHvRuntime = authorizeProcessGroupRuntime;\nexport function authorizeConfiguredProcessGroupRuntime(\n pkg: string,\n dir: string,\n raw: Record<string, unknown>,\n controllerName: string,\n initialize = false,\n) {\n return authorizeProcessGroupRuntime({\n packageRoot: pkg,\n instanceDirectory: dir,\n rawConfiguration: raw,\n channels: resolvedProcessGroupChannels(raw),\n controllerName,\n initialize,\n });\n}\nexport function assertProcessGroupJournalAuthorization(\n value: ProcessGroupAuthorization | undefined,\n directory: string,\n journalId: string | undefined,\n): void {\n if (value && issued.has(value)) {\n if (value.directory !== directory || value.journalId !== (journalId ?? null) || sha(read(value.file, true)) !== value.sha256)\n throw Error(\"Exact reviewed process-group authorization required\");\n return;\n }\n legacy.assertHvJournalAuthorization(value as legacy.HvAuthorization | undefined, directory, journalId);\n}\nexport const assertHvJournalAuthorization = assertProcessGroupJournalAuthorization;\nexport function assertProcessGroupStateMount(value: ProcessGroupAuthorization, root: string): void {\n if (!issued.has(value)) {\n legacy.assertHvStateMount(value as legacy.HvAuthorization, root);\n return;\n }\n assertProcessGroupJournalAuthorization(value, value.directory, value.journalId ?? undefined);\n if (process.platform !== \"linux\" || !(\"namespace\" in value) || value.directory !== path.join(root, value.namespace, \"admission\", value.generationId ?? value.groupId))\n throw Error(\"Process group requires its reviewed Linux state mount\");\n const mount = fs\n .readFileSync(\"/proc/self/mountinfo\", \"utf8\")\n .split(\"\\n\")\n .map((l) => l.split(\" \"))\n .filter((f) => f[4] === root)\n .at(-1);\n if (!mount || !mount[5]?.split(\",\").includes(\"rw\") || ![\"xfs\", \"ext4\", \"btrfs\", \"zfs\"].includes(mount[mount.indexOf(\"-\") + 1] ?? \"\"))\n throw Error(\"Process-group state root must be an explicit writable local Linux filesystem mount\");\n}\nexport const assertHvStateMount = assertProcessGroupStateMount;\nexport function assertProcessGroupTargetLaunch(\n value: ProcessGroupAuthorization,\n dir: string,\n operationId: string | undefined,\n launchId: string | undefined,\n): void {\n if (!issued.has(value)) {\n legacy.assertHvTargetLaunch(value as legacy.HvAuthorization, dir, operationId, launchId);\n return;\n }\n if (value.role !== \"target\") return;\n try {\n assertProcessGroupJournalAuthorization(value, value.directory, value.journalId ?? undefined);\n const r = JSON.parse(read(path.join(dir, \"process-group-reservation.json\"), true).toString());\n if (\n !z.string().uuid().safeParse(operationId).success ||\n !z.string().uuid().safeParse(launchId).success ||\n r.operationId !== operationId ||\n r.role !== \"target\" ||\n r.lastLaunch?.launchId !== launchId ||\n !z.string().uuid().safeParse(r.lastLaunch?.requestId).success ||\n !digest.safeParse(r.configurationChecksum).success\n )\n throw Error();\n if (\"configurationGroupSha256\" in value && value.configurationGroupSha256 !== undefined &&\n (r.configurationGroupSha256 !== value.configurationGroupSha256 || r.generationId !== value.generationId)) throw Error();\n } catch {\n throw Error(\"Target requires its exact reviewed group reservation and launch identity\");\n }\n}\nexport const assertHvTargetLaunch = assertProcessGroupTargetLaunch;\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** SDK-owned fixed resource budget; hosts never accept it from an operation request. */
|
|
3
|
+
export declare const processGroupBackupLimits: Readonly<{
|
|
4
|
+
schemaVersion: 1;
|
|
5
|
+
maximumJournals: number;
|
|
6
|
+
maximumManifestBytes: 262144;
|
|
7
|
+
maximumSnapshotBytes: 536870912;
|
|
8
|
+
maximumCapsuleBytes: 1073741824;
|
|
9
|
+
}>;
|
|
10
|
+
/** Public coverage only; identities, checkpoints and payloads remain encrypted. */
|
|
11
|
+
export declare const processGroupStateBackupSchema: z.ZodObject<{
|
|
12
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
13
|
+
state: z.ZodEnum<{
|
|
14
|
+
included: "included";
|
|
15
|
+
empty: "empty";
|
|
16
|
+
}>;
|
|
17
|
+
rootSha256: z.ZodString;
|
|
18
|
+
journals: z.ZodNumber;
|
|
19
|
+
bytes: z.ZodNumber;
|
|
20
|
+
sha256: z.ZodString;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
//# sourceMappingURL=process-group-backup-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-group-backup-contract.d.ts","sourceRoot":"","sources":["../../src/runtime/process-group-backup-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,wFAAwF;AACxF,eAAO,MAAM,wBAAwB;;;;;;EAMlB,CAAC;AAEpB,mFAAmF;AACnF,eAAO,MAAM,6BAA6B;;;;;;;;;;kBAOgC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import contract from "./process-group-backup-contract.json" with { type: "json" };
|
|
3
|
+
/** SDK-owned fixed resource budget; hosts never accept it from an operation request. */
|
|
4
|
+
export const processGroupBackupLimits = Object.freeze(z.strictObject({
|
|
5
|
+
schemaVersion: z.literal(1),
|
|
6
|
+
maximumJournals: z.number().int().min(1).max(128),
|
|
7
|
+
maximumManifestBytes: z.literal(262144),
|
|
8
|
+
maximumSnapshotBytes: z.literal(536870912),
|
|
9
|
+
maximumCapsuleBytes: z.literal(1073741824),
|
|
10
|
+
}).parse(contract));
|
|
11
|
+
/** Public coverage only; identities, checkpoints and payloads remain encrypted. */
|
|
12
|
+
export const processGroupStateBackupSchema = z.strictObject({
|
|
13
|
+
schemaVersion: z.literal(1),
|
|
14
|
+
state: z.enum(["included", "empty"]),
|
|
15
|
+
rootSha256: z.string().regex(/^[a-f0-9]{64}$/),
|
|
16
|
+
journals: z.number().int().min(0).max(processGroupBackupLimits.maximumJournals),
|
|
17
|
+
bytes: z.number().int().positive().max(processGroupBackupLimits.maximumCapsuleBytes),
|
|
18
|
+
sha256: z.string().regex(/^[a-f0-9]{64}$/),
|
|
19
|
+
}).refine(v => v.state === "included" ? v.journals > 0 : v.journals === 0);
|
|
20
|
+
//# sourceMappingURL=process-group-backup-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-group-backup-contract.js","sourceRoot":"","sources":["../../src/runtime/process-group-backup-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,QAAQ,MAAM,sCAAsC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAElF,wFAAwF;AACxF,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC;IACnE,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3B,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACjD,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACvC,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAC1C,mBAAmB,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;CAC3C,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;AAEpB,mFAAmF;AACnF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,YAAY,CAAC;IAC1D,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3B,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACpC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAC9C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,wBAAwB,CAAC,eAAe,CAAC;IAC/E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,wBAAwB,CAAC,mBAAmB,CAAC;IACpF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC;CAC3C,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC","sourcesContent":["import { z } from \"zod\";\nimport contract from \"./process-group-backup-contract.json\" with { type: \"json\" };\n\n/** SDK-owned fixed resource budget; hosts never accept it from an operation request. */\nexport const processGroupBackupLimits = Object.freeze(z.strictObject({\n schemaVersion: z.literal(1),\n maximumJournals: z.number().int().min(1).max(128),\n maximumManifestBytes: z.literal(262144),\n maximumSnapshotBytes: z.literal(536870912),\n maximumCapsuleBytes: z.literal(1073741824),\n}).parse(contract));\n\n/** Public coverage only; identities, checkpoints and payloads remain encrypted. */\nexport const processGroupStateBackupSchema = z.strictObject({\n schemaVersion: z.literal(1),\n state: z.enum([\"included\", \"empty\"]),\n rootSha256: z.string().regex(/^[a-f0-9]{64}$/),\n journals: z.number().int().min(0).max(processGroupBackupLimits.maximumJournals),\n bytes: z.number().int().positive().max(processGroupBackupLimits.maximumCapsuleBytes),\n sha256: z.string().regex(/^[a-f0-9]{64}$/),\n}).refine(v => v.state === \"included\" ? v.journals > 0 : v.journals === 0);\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PreparedGroupUpgrade, UpgradeConfigurations } from "./process-group-upgrade.js";
|
|
2
|
+
/** Same generation, different paired artifacts. Never initializes or rewrites the journal. */
|
|
3
|
+
export declare function reviewInstalledConfigurationGroupUpgrade(configs: UpgradeConfigurations, controllerName: string, stateRoot: string, excludedUnsFields?: readonly string[]): PreparedGroupUpgrade;
|
|
4
|
+
//# sourceMappingURL=process-group-configured-upgrade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-group-configured-upgrade.d.ts","sourceRoot":"","sources":["../../src/runtime/process-group-configured-upgrade.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAA6B,oBAAoB,EAAwB,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAE/I,8FAA8F;AAC9F,wBAAgB,wCAAwC,CACtD,OAAO,EAAE,qBAAqB,EAC9B,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,MAAM,EACjB,iBAAiB,GAAE,SAAS,MAAM,EAAO,GACxC,oBAAoB,CAyGtB"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { configurationGroupAuthorizationSchema } from "./configuration-group-authorization.js";
|
|
3
|
+
import { configurationResourceHash } from "./configuration-group-contract.js";
|
|
4
|
+
import { authorizeProcessGroupRuntime, processGroupAuthorizationFile, validateProcessGroupPolicyCandidate } from "./process-group-authorization.js";
|
|
5
|
+
import { resolvedProcessGroupChannels } from "./process-group-contract.js";
|
|
6
|
+
import { describeInstalledProcessGroupGeneration, inspectGenerationJournal } from "./process-group-generation.js";
|
|
7
|
+
import { groupArtifactHash, groupChannelsHash, configurationAuthorizationHash as hash, readProcessGroupResource as read, sha256, } from "./process-group-resources.js";
|
|
8
|
+
/** Same generation, different paired artifacts. Never initializes or rewrites the journal. */
|
|
9
|
+
export function reviewInstalledConfigurationGroupUpgrade(configs, controllerName, stateRoot, excludedUnsFields = []) {
|
|
10
|
+
const context = (c) => ({
|
|
11
|
+
packageRoot: c.packageRoot,
|
|
12
|
+
instanceDirectory: c.instanceDirectory,
|
|
13
|
+
rawConfiguration: c.raw,
|
|
14
|
+
channels: resolvedProcessGroupChannels(c.resolved),
|
|
15
|
+
controllerName,
|
|
16
|
+
stateRoot,
|
|
17
|
+
});
|
|
18
|
+
const source = configs.source.publisher, target = configs.target.publisher, a = describeInstalledProcessGroupGeneration(source), b = describeInstalledProcessGroupGeneration(target);
|
|
19
|
+
if (a.d.protocolVersion !== 2 || b.d.protocolVersion !== 2 || a.d.namespace !== b.d.namespace || hash(a.reference) !== hash(b.reference))
|
|
20
|
+
throw Error("Unchanged configuration generation required; review resource changes as a separate generation");
|
|
21
|
+
const pkg = (c) => JSON.parse(read(path.join(c.packageRoot, "package.json")).toString()), sourcePackage = pkg(source), targetPackage = pkg(target);
|
|
22
|
+
if (!sourcePackage.version || !targetPackage.version || sourcePackage.version === targetPackage.version)
|
|
23
|
+
throw Error("Two different installed paired versions required");
|
|
24
|
+
const old = authorizeProcessGroupRuntime(context(source));
|
|
25
|
+
const sourcePolicy = read(old.file, true), previous = configurationGroupAuthorizationSchema.parse(JSON.parse(sourcePolicy.toString()));
|
|
26
|
+
const portable = (raw) => {
|
|
27
|
+
const copy = structuredClone(raw), uns = { ...copy["uns"] };
|
|
28
|
+
for (const key of excludedUnsFields)
|
|
29
|
+
delete uns[key];
|
|
30
|
+
copy["uns"] = uns;
|
|
31
|
+
return hash(copy);
|
|
32
|
+
};
|
|
33
|
+
const members = [];
|
|
34
|
+
const directories = new Set();
|
|
35
|
+
for (const side of ["source", "target"])
|
|
36
|
+
for (const role of ["publisher", "receiver"]) {
|
|
37
|
+
const c = configs[side][role], g = describeInstalledProcessGroupGeneration(c), installed = pkg(c);
|
|
38
|
+
if (g.d.protocolVersion !== 2 ||
|
|
39
|
+
g.d.namespace !== a.d.namespace ||
|
|
40
|
+
installed.name !== sourcePackage.name ||
|
|
41
|
+
installed.version !== (side === "source" ? sourcePackage.version : targetPackage.version) ||
|
|
42
|
+
c.packageRoot !== configs[side].publisher.packageRoot ||
|
|
43
|
+
directories.has(c.instanceDirectory) ||
|
|
44
|
+
hash(g.reference) !== hash(a.reference) ||
|
|
45
|
+
g.normalized.uns["processName"] !== (role === "publisher" ? a.processName : a.receiverProcessName) ||
|
|
46
|
+
(role === "receiver"
|
|
47
|
+
? g.normalized.runtimeRole !== "admission"
|
|
48
|
+
: g.normalized.runtimeRole !== undefined && g.normalized.runtimeRole !== "publisher") ||
|
|
49
|
+
portable(c.raw) !== portable(configs.source[role].raw) ||
|
|
50
|
+
groupChannelsHash(g.channels) !== groupChannelsHash(a.channels) ||
|
|
51
|
+
processGroupAuthorizationFile(context(c)) !== old.file)
|
|
52
|
+
throw Error("Exact paired configuration, resources, broker identity and retained journal required");
|
|
53
|
+
directories.add(c.instanceDirectory);
|
|
54
|
+
if (side === "source") {
|
|
55
|
+
const proof = authorizeProcessGroupRuntime(context(c));
|
|
56
|
+
if (proof.role !== (role === "publisher" ? "target" : "receiver") || proof.sha256 !== sha256(sourcePolicy))
|
|
57
|
+
throw Error("Exact authorized source pair required");
|
|
58
|
+
}
|
|
59
|
+
members.push({
|
|
60
|
+
side,
|
|
61
|
+
role,
|
|
62
|
+
processName: String(g.normalized.uns["processName"]),
|
|
63
|
+
configurationSha256: hash(c.raw),
|
|
64
|
+
artifactSha256: groupArtifactHash(c.packageRoot),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const policy = configurationGroupAuthorizationSchema.parse({
|
|
68
|
+
...previous,
|
|
69
|
+
packageRoot: target.packageRoot,
|
|
70
|
+
descriptorSha256: configurationResourceHash(targetPackage.unsDatahub.processGroupConfigurationRuntime),
|
|
71
|
+
artifactSha256: groupArtifactHash(target.packageRoot),
|
|
72
|
+
placements: [
|
|
73
|
+
...previous.placements.filter((p) => p.role === "source"),
|
|
74
|
+
...["publisher", "receiver"].map((role) => ({
|
|
75
|
+
instanceId: path.basename(configs.target[role].instanceDirectory),
|
|
76
|
+
processName: members.find((m) => m.side === "target" && m.role === role).processName,
|
|
77
|
+
role: role === "publisher" ? "target" : "receiver",
|
|
78
|
+
configurationSha256: configurationResourceHash(configs.target[role].raw),
|
|
79
|
+
})),
|
|
80
|
+
],
|
|
81
|
+
});
|
|
82
|
+
const targetPolicy = Buffer.from(JSON.stringify(policy));
|
|
83
|
+
for (const role of ["publisher", "receiver"])
|
|
84
|
+
validateProcessGroupPolicyCandidate(context(configs.target[role]), targetPolicy);
|
|
85
|
+
inspectGenerationJournal(a.reference); // Pending, previously completed work is valid and must remain bound.
|
|
86
|
+
if (sha256(read(old.file, true)) !== sha256(sourcePolicy))
|
|
87
|
+
throw Error("Source policy changed during review");
|
|
88
|
+
return {
|
|
89
|
+
review: {
|
|
90
|
+
protocolVersion: 1,
|
|
91
|
+
namespace: a.d.namespace,
|
|
92
|
+
groupId: a.id,
|
|
93
|
+
policyFile: old.file,
|
|
94
|
+
sourcePolicySha256: sha256(sourcePolicy),
|
|
95
|
+
targetPolicySha256: sha256(targetPolicy),
|
|
96
|
+
journalId: a.reference.journalId,
|
|
97
|
+
directory: a.reference.directory,
|
|
98
|
+
journalContractSha256: a.reference.journalContractSha256,
|
|
99
|
+
profiles: a.reference.profiles,
|
|
100
|
+
retainedJournal: a.reference,
|
|
101
|
+
members,
|
|
102
|
+
},
|
|
103
|
+
sourcePolicy,
|
|
104
|
+
targetPolicy,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=process-group-configured-upgrade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-group-configured-upgrade.js","sourceRoot":"","sources":["../../src/runtime/process-group-configured-upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,qCAAqC,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,6BAA6B,EAAE,mCAAmC,EAAE,MAAM,kCAAkC,CAAC;AACpJ,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,uCAAuC,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAClH,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,8BAA8B,IAAI,IAAI,EACtC,wBAAwB,IAAI,IAAI,EAChC,MAAM,GACP,MAAM,8BAA8B,CAAC;AAGtC,8FAA8F;AAC9F,MAAM,UAAU,wCAAwC,CACtD,OAA8B,EAC9B,cAAsB,EACtB,SAAiB,EACjB,oBAAuC,EAAE;IAEzC,MAAM,OAAO,GAAG,CAAC,CAAuB,EAAE,EAAE,CAAC,CAAC;QAC5C,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,iBAAiB,EAAE,CAAC,CAAC,iBAAiB;QACtC,gBAAgB,EAAE,CAAC,CAAC,GAAG;QACvB,QAAQ,EAAE,4BAA4B,CAAC,CAAC,CAAC,QAAQ,CAAC;QAClD,cAAc;QACd,SAAS;KACV,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,EACr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,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IACxI,wBAAwB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,qEAAqE;IAC5G,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,MAAM,CAAC,YAAY,CAAC;QAAE,MAAM,KAAK,CAAC,qCAAqC,CAAC,CAAC;IAC9G,OAAO;QACL,MAAM,EAAE;YACN,eAAe,EAAE,CAAC;YAClB,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;YACxB,OAAO,EAAE,CAAC,CAAC,EAAE;YACb,UAAU,EAAE,GAAG,CAAC,IAAI;YACpB,kBAAkB,EAAE,MAAM,CAAC,YAAY,CAAC;YACxC,kBAAkB,EAAE,MAAM,CAAC,YAAY,CAAC;YACxC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,SAAS;YAChC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,SAAS;YAChC,qBAAqB,EAAE,CAAC,CAAC,SAAS,CAAC,qBAAqB;YACxD,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ;YAC9B,eAAe,EAAE,CAAC,CAAC,SAAS;YAC5B,OAAO;SACR;QACD,YAAY;QACZ,YAAY;KACb,CAAC;AACJ,CAAC","sourcesContent":["import path from \"node:path\";\n\nimport { configurationGroupAuthorizationSchema } from \"./configuration-group-authorization.js\";\nimport { configurationResourceHash } from \"./configuration-group-contract.js\";\nimport { authorizeProcessGroupRuntime, processGroupAuthorizationFile, validateProcessGroupPolicyCandidate } from \"./process-group-authorization.js\";\nimport { resolvedProcessGroupChannels } from \"./process-group-contract.js\";\nimport { describeInstalledProcessGroupGeneration, inspectGenerationJournal } from \"./process-group-generation.js\";\nimport {\n groupArtifactHash,\n groupChannelsHash,\n configurationAuthorizationHash as hash,\n readProcessGroupResource as read,\n sha256,\n} from \"./process-group-resources.js\";\nimport type { GroupVersionUpgradeReview, PreparedGroupUpgrade, UpgradeConfiguration, UpgradeConfigurations } from \"./process-group-upgrade.js\";\n\n/** Same generation, different paired artifacts. Never initializes or rewrites the journal. */\nexport function reviewInstalledConfigurationGroupUpgrade(\n configs: UpgradeConfigurations,\n controllerName: string,\n stateRoot: string,\n excludedUnsFields: readonly string[] = [],\n): PreparedGroupUpgrade {\n const context = (c: UpgradeConfiguration) => ({\n packageRoot: c.packageRoot,\n instanceDirectory: c.instanceDirectory,\n rawConfiguration: c.raw,\n channels: resolvedProcessGroupChannels(c.resolved),\n controllerName,\n stateRoot,\n });\n const source = configs.source.publisher,\n target = configs.target.publisher,\n a = describeInstalledProcessGroupGeneration(source),\n b = describeInstalledProcessGroupGeneration(target);\n if (a.d.protocolVersion !== 2 || b.d.protocolVersion !== 2 || a.d.namespace !== b.d.namespace || hash(a.reference) !== hash(b.reference))\n throw Error(\"Unchanged configuration generation required; review resource changes as a separate generation\");\n const pkg = (c: UpgradeConfiguration) => JSON.parse(read(path.join(c.packageRoot, \"package.json\")).toString()),\n sourcePackage = pkg(source),\n targetPackage = pkg(target);\n if (!sourcePackage.version || !targetPackage.version || sourcePackage.version === targetPackage.version)\n throw Error(\"Two different installed paired versions required\");\n const old = authorizeProcessGroupRuntime(context(source));\n const sourcePolicy = read(old.file, true),\n previous = configurationGroupAuthorizationSchema.parse(JSON.parse(sourcePolicy.toString()));\n const portable = (raw: Record<string, unknown>) => {\n const copy = structuredClone(raw),\n uns = { ...(copy[\"uns\"] as Record<string, unknown>) };\n for (const key of excludedUnsFields) delete uns[key];\n copy[\"uns\"] = uns;\n return hash(copy);\n };\n const members: GroupVersionUpgradeReview[\"members\"] = [];\n const directories = new Set<string>();\n for (const side of [\"source\", \"target\"] as const)\n for (const role of [\"publisher\", \"receiver\"] as const) {\n const c = configs[side][role],\n g = describeInstalledProcessGroupGeneration(c),\n installed = pkg(c);\n if (\n g.d.protocolVersion !== 2 ||\n g.d.namespace !== a.d.namespace ||\n installed.name !== sourcePackage.name ||\n installed.version !== (side === \"source\" ? sourcePackage.version : targetPackage.version) ||\n c.packageRoot !== configs[side].publisher.packageRoot ||\n directories.has(c.instanceDirectory) ||\n hash(g.reference) !== hash(a.reference) ||\n g.normalized.uns[\"processName\"] !== (role === \"publisher\" ? a.processName : a.receiverProcessName) ||\n (role === \"receiver\"\n ? g.normalized.runtimeRole !== \"admission\"\n : g.normalized.runtimeRole !== undefined && g.normalized.runtimeRole !== \"publisher\") ||\n portable(c.raw) !== portable(configs.source[role].raw) ||\n groupChannelsHash(g.channels) !== groupChannelsHash(a.channels) ||\n processGroupAuthorizationFile(context(c)) !== old.file\n )\n throw Error(\"Exact paired configuration, resources, broker identity and retained journal required\");\n directories.add(c.instanceDirectory);\n if (side === \"source\") {\n const proof = authorizeProcessGroupRuntime(context(c));\n if (proof.role !== (role === \"publisher\" ? \"target\" : \"receiver\") || proof.sha256 !== sha256(sourcePolicy))\n throw Error(\"Exact authorized source pair required\");\n }\n members.push({\n side,\n role,\n processName: String(g.normalized.uns[\"processName\"]),\n configurationSha256: hash(c.raw),\n artifactSha256: groupArtifactHash(c.packageRoot),\n });\n }\n const policy = configurationGroupAuthorizationSchema.parse({\n ...previous,\n packageRoot: target.packageRoot,\n descriptorSha256: configurationResourceHash(targetPackage.unsDatahub.processGroupConfigurationRuntime),\n artifactSha256: groupArtifactHash(target.packageRoot),\n placements: [\n ...previous.placements.filter((p) => p.role === \"source\"),\n ...([\"publisher\", \"receiver\"] as const).map((role) => ({\n instanceId: path.basename(configs.target[role].instanceDirectory),\n processName: members.find((m) => m.side === \"target\" && m.role === role)!.processName,\n role: role === \"publisher\" ? \"target\" : \"receiver\",\n configurationSha256: configurationResourceHash(configs.target[role].raw),\n })),\n ],\n });\n const targetPolicy = Buffer.from(JSON.stringify(policy));\n for (const role of [\"publisher\", \"receiver\"] as const) validateProcessGroupPolicyCandidate(context(configs.target[role]), targetPolicy);\n inspectGenerationJournal(a.reference); // Pending, previously completed work is valid and must remain bound.\n if (sha256(read(old.file, true)) !== sha256(sourcePolicy)) throw Error(\"Source policy changed during review\");\n return {\n review: {\n protocolVersion: 1,\n namespace: a.d.namespace,\n groupId: a.id,\n policyFile: old.file,\n sourcePolicySha256: sha256(sourcePolicy),\n targetPolicySha256: sha256(targetPolicy),\n journalId: a.reference.journalId,\n directory: a.reference.directory,\n journalContractSha256: a.reference.journalContractSha256,\n profiles: a.reference.profiles,\n retainedJournal: a.reference,\n members,\n },\n sourcePolicy,\n targetPolicy,\n };\n}\n"]}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { GroupVersionUpgradeReview, PreparedGroupUpgrade, UpgradeConfiguration, UpgradeConfigurations } from "./process-group-upgrade.js";
|
|
3
|
+
export declare const processGroupGenerationInputSchema: z.ZodObject<{
|
|
4
|
+
protocolVersion: z.ZodLiteral<2>;
|
|
5
|
+
source: z.ZodObject<{
|
|
6
|
+
publisher: z.ZodObject<{
|
|
7
|
+
controller: z.ZodString;
|
|
8
|
+
rttNode: z.ZodString;
|
|
9
|
+
version: z.ZodString;
|
|
10
|
+
instanceId: z.ZodString;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
receiver: z.ZodObject<{
|
|
13
|
+
controller: z.ZodString;
|
|
14
|
+
rttNode: z.ZodString;
|
|
15
|
+
version: z.ZodString;
|
|
16
|
+
instanceId: z.ZodString;
|
|
17
|
+
}, z.core.$strict>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
target: z.ZodObject<{
|
|
20
|
+
publisher: z.ZodObject<{
|
|
21
|
+
controller: z.ZodString;
|
|
22
|
+
rttNode: z.ZodString;
|
|
23
|
+
version: z.ZodString;
|
|
24
|
+
instanceId: z.ZodString;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
receiver: z.ZodObject<{
|
|
27
|
+
controller: z.ZodString;
|
|
28
|
+
rttNode: z.ZodString;
|
|
29
|
+
version: z.ZodString;
|
|
30
|
+
instanceId: z.ZodString;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
acknowledgeInputPause: z.ZodLiteral<true>;
|
|
34
|
+
acknowledgeResourceReview: z.ZodLiteral<true>;
|
|
35
|
+
acknowledgePossibleReplay: z.ZodLiteral<true>;
|
|
36
|
+
}, z.core.$strict>;
|
|
37
|
+
export type ProcessGroupGenerationInput = z.infer<typeof processGroupGenerationInputSchema>;
|
|
38
|
+
export type GenerationJournalReference = {
|
|
39
|
+
directory: string;
|
|
40
|
+
journalId: string;
|
|
41
|
+
journalContractSha256: string;
|
|
42
|
+
generationId: string;
|
|
43
|
+
groupSha256?: string;
|
|
44
|
+
contractVersion: 1 | 2;
|
|
45
|
+
maxRecords: number;
|
|
46
|
+
maxBytes: number;
|
|
47
|
+
minFreeBytes: number;
|
|
48
|
+
profiles: Array<{
|
|
49
|
+
processName: string;
|
|
50
|
+
mappingSha256: string;
|
|
51
|
+
dataGroup: string;
|
|
52
|
+
}>;
|
|
53
|
+
};
|
|
54
|
+
export type GroupGenerationReview = Omit<GroupVersionUpgradeReview, "protocolVersion"> & {
|
|
55
|
+
protocolVersion: 2;
|
|
56
|
+
sourcePolicyFile: string;
|
|
57
|
+
sourceJournal: GenerationJournalReference;
|
|
58
|
+
targetJournal: GenerationJournalReference;
|
|
59
|
+
delivery: {
|
|
60
|
+
inputPausePossible: true;
|
|
61
|
+
retainedBrokerSessionMayReplay: true;
|
|
62
|
+
exactlyOnceOutput: false;
|
|
63
|
+
};
|
|
64
|
+
resourceChanges: Array<{
|
|
65
|
+
processName: string;
|
|
66
|
+
beforeSha256: string;
|
|
67
|
+
afterSha256: string;
|
|
68
|
+
dataGroup: string;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
/** Bounded read-only storage evidence; no initializer, rewriting or replay. */
|
|
72
|
+
export declare function inspectGenerationJournal(reference: GenerationJournalReference): {
|
|
73
|
+
records: number;
|
|
74
|
+
bytes: number;
|
|
75
|
+
admitted: number;
|
|
76
|
+
completed: number;
|
|
77
|
+
lastSequence: number;
|
|
78
|
+
};
|
|
79
|
+
/** Recheck immediately before the first launch; initialization is never silently reused. */
|
|
80
|
+
export declare function inspectPristineGenerationJournal(reference: GenerationJournalReference): {
|
|
81
|
+
records: number;
|
|
82
|
+
bytes: number;
|
|
83
|
+
admitted: number;
|
|
84
|
+
completed: number;
|
|
85
|
+
lastSequence: number;
|
|
86
|
+
};
|
|
87
|
+
/** Data-only normalized revision and immutable journal contract shared by reviewed transitions. */
|
|
88
|
+
export declare function describeInstalledProcessGroupGeneration(c: UpgradeConfiguration): {
|
|
89
|
+
d: {
|
|
90
|
+
protocolVersion: 2;
|
|
91
|
+
namespace: string;
|
|
92
|
+
publisherPath: string[];
|
|
93
|
+
groupPath: string[];
|
|
94
|
+
memberPath: string[];
|
|
95
|
+
journalPath: string[];
|
|
96
|
+
runtimeRolePath: string[];
|
|
97
|
+
receiverRole: string;
|
|
98
|
+
match?: {
|
|
99
|
+
path: string[];
|
|
100
|
+
value: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
normalized: {
|
|
104
|
+
matches: boolean;
|
|
105
|
+
uns: Record<string, unknown>;
|
|
106
|
+
publisher: Record<string, unknown>;
|
|
107
|
+
journal: unknown;
|
|
108
|
+
runtimeRole: unknown;
|
|
109
|
+
configurationSnapshot: import("./configuration-group-contract.js").ConfigurationGroupSnapshot;
|
|
110
|
+
};
|
|
111
|
+
channels: import("../index.js").ResolvedMqttChannel[];
|
|
112
|
+
id: string;
|
|
113
|
+
processName: string;
|
|
114
|
+
receiverProcessName: string;
|
|
115
|
+
inputTopic: string;
|
|
116
|
+
reference: {
|
|
117
|
+
directory: string;
|
|
118
|
+
journalId: string;
|
|
119
|
+
generationId: string;
|
|
120
|
+
groupSha256: string;
|
|
121
|
+
contractVersion: 2;
|
|
122
|
+
journalContractSha256: string;
|
|
123
|
+
maxRecords: number;
|
|
124
|
+
maxBytes: number;
|
|
125
|
+
minFreeBytes: number;
|
|
126
|
+
profiles: {
|
|
127
|
+
processName: string;
|
|
128
|
+
mappingSha256: string;
|
|
129
|
+
dataGroup: string;
|
|
130
|
+
}[];
|
|
131
|
+
};
|
|
132
|
+
} | {
|
|
133
|
+
d: import("./process-group-contract.js").ProcessGroupRuntimeDescriptor;
|
|
134
|
+
normalized: {
|
|
135
|
+
matches: boolean;
|
|
136
|
+
uns: Record<string, unknown>;
|
|
137
|
+
publisher: Record<string, unknown>;
|
|
138
|
+
journal: unknown;
|
|
139
|
+
runtimeRole: unknown;
|
|
140
|
+
configurationSnapshot: import("./configuration-group-contract.js").ConfigurationGroupSnapshot;
|
|
141
|
+
};
|
|
142
|
+
channels: import("../index.js").ResolvedMqttChannel[];
|
|
143
|
+
id: string;
|
|
144
|
+
processName: string;
|
|
145
|
+
receiverProcessName: string;
|
|
146
|
+
inputTopic: string;
|
|
147
|
+
reference: {
|
|
148
|
+
directory: string;
|
|
149
|
+
journalId: string;
|
|
150
|
+
generationId: string;
|
|
151
|
+
contractVersion: 1;
|
|
152
|
+
journalContractSha256: string;
|
|
153
|
+
maxRecords: number;
|
|
154
|
+
maxBytes: number;
|
|
155
|
+
minFreeBytes: number;
|
|
156
|
+
profiles: {
|
|
157
|
+
processName: string;
|
|
158
|
+
mappingSha256: string;
|
|
159
|
+
dataGroup: string;
|
|
160
|
+
}[];
|
|
161
|
+
groupSha256?: undefined;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
/** Operator reviews opaque before/after digests; business equivalence is application-owned. */
|
|
165
|
+
export declare function reviewInstalledProcessGroupGeneration(configs: UpgradeConfigurations, controllerName: string, stateRoot: string, excludedUnsFields?: readonly string[]): PreparedGroupUpgrade;
|
|
166
|
+
//# sourceMappingURL=process-group-generation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-group-generation.d.ts","sourceRoot":"","sources":["../../src/runtime/process-group-generation.ts"],"names":[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