spawnfile 0.1.12 → 0.1.14
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/README.md +58 -12
- package/dist/audit/auditCli.d.ts +19 -0
- package/dist/audit/auditCli.js +63 -0
- package/dist/audit/checks.d.ts +100 -0
- package/dist/audit/checks.js +279 -0
- package/dist/audit/checksShared.d.ts +74 -0
- package/dist/audit/checksShared.js +37 -0
- package/dist/audit/generateAudit.d.ts +19 -0
- package/dist/audit/generateAudit.js +122 -0
- package/dist/audit/index.d.ts +4 -0
- package/dist/audit/index.js +4 -0
- package/dist/audit/readAudit.d.ts +50 -0
- package/dist/audit/readAudit.js +59 -0
- package/dist/audit/types.d.ts +40 -0
- package/dist/audit/types.js +8 -0
- package/dist/auth/credentialEnvFile.d.ts +11 -0
- package/dist/auth/credentialEnvFile.js +60 -0
- package/dist/auth/credentialProvisioning.d.ts +15 -0
- package/dist/auth/credentialProvisioning.js +75 -0
- package/dist/auth/credentialProvisioningReceipt.d.ts +28 -0
- package/dist/auth/credentialProvisioningReceipt.js +70 -0
- package/dist/auth/credentialProvisioningRequest.d.ts +51 -0
- package/dist/auth/credentialProvisioningRequest.js +169 -0
- package/dist/auth/credentialWorldBindings.d.ts +21 -0
- package/dist/auth/credentialWorldBindings.js +104 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/index.js +7 -0
- package/dist/auth/paths.d.ts +11 -0
- package/dist/auth/paths.js +21 -0
- package/dist/auth/runtimeCredentials.js +18 -2
- package/dist/auth/targetSecretSourceAuthor.d.ts +18 -0
- package/dist/auth/targetSecretSourceAuthor.js +52 -0
- package/dist/auth/targetSecretSourceFsPublish.d.ts +15 -0
- package/dist/auth/targetSecretSourceFsPublish.js +49 -0
- package/dist/auth/targetSecretSourceFsPublishImmutable.d.ts +16 -0
- package/dist/auth/targetSecretSourceFsPublishImmutable.js +435 -0
- package/dist/auth/targetSecretSourceFsRead.d.ts +14 -0
- package/dist/auth/targetSecretSourceFsRead.js +198 -0
- package/dist/auth/targetSecretSourceGrant.d.ts +16 -0
- package/dist/auth/targetSecretSourceGrant.js +99 -0
- package/dist/auth/targetSecretSourceGrantRecords.d.ts +84 -0
- package/dist/auth/targetSecretSourceGrantRecords.js +214 -0
- package/dist/auth/targetSecretSourceLifecycle.d.ts +30 -0
- package/dist/auth/targetSecretSourceLifecycle.js +52 -0
- package/dist/auth/targetSecretSourceOwnerEntropy.d.ts +6 -0
- package/dist/auth/targetSecretSourceOwnerEntropy.js +28 -0
- package/dist/auth/targetSecretSourceRecordCommon.d.ts +14 -0
- package/dist/auth/targetSecretSourceRecordCommon.js +100 -0
- package/dist/auth/targetSecretSourceRecordPublish.d.ts +10 -0
- package/dist/auth/targetSecretSourceRecordPublish.js +104 -0
- package/dist/auth/targetSecretSourceResolver.d.ts +10 -0
- package/dist/auth/targetSecretSourceResolver.js +137 -0
- package/dist/auth/targetSecretSourceRevoke.d.ts +20 -0
- package/dist/auth/targetSecretSourceRevoke.js +92 -0
- package/dist/auth/targetSecretSourceRotate.d.ts +19 -0
- package/dist/auth/targetSecretSourceRotate.js +121 -0
- package/dist/auth/targetSecretSourceVersionRecords.d.ts +49 -0
- package/dist/auth/targetSecretSourceVersionRecords.js +166 -0
- package/dist/cli/artifactsCommands.d.ts +27 -0
- package/dist/cli/artifactsCommands.js +132 -0
- package/dist/cli/authCommands.d.ts +5 -0
- package/dist/cli/authCommands.js +221 -0
- package/dist/cli/compileBuildCommands.d.ts +3 -0
- package/dist/cli/compileBuildCommands.js +35 -0
- package/dist/cli/containerBundleCommand.d.ts +6 -0
- package/dist/cli/containerBundleCommand.js +116 -0
- package/dist/cli/devCommands.d.ts +3 -0
- package/dist/cli/devCommands.js +115 -0
- package/dist/cli/downCommand.d.ts +25 -0
- package/dist/cli/downCommand.js +134 -0
- package/dist/cli/index.js +6 -3
- package/dist/cli/lifecycleCommands.d.ts +1 -1
- package/dist/cli/lifecycleCommands.js +11 -179
- package/dist/cli/lifecycleMachine.d.ts +19 -0
- package/dist/cli/lifecycleMachine.js +78 -0
- package/dist/cli/lifecyclePlan.d.ts +35 -0
- package/dist/cli/lifecyclePlan.js +240 -0
- package/dist/cli/lifecyclePlanningCommands.d.ts +3 -0
- package/dist/cli/lifecyclePlanningCommands.js +30 -0
- package/dist/cli/runCli.d.ts +15 -2
- package/dist/cli/runCli.js +31 -71
- package/dist/cli/runPublishCommands.d.ts +3 -0
- package/dist/cli/runPublishCommands.js +70 -0
- package/dist/cli/statusCommand.d.ts +3 -32
- package/dist/cli/statusCommand.js +37 -233
- package/dist/cli/statusCommandLive.d.ts +20 -0
- package/dist/cli/statusCommandLive.js +188 -0
- package/dist/cli/statusCommandOptions.d.ts +40 -0
- package/dist/cli/statusCommandOptions.js +42 -0
- package/dist/cli/targetCliRoute.d.ts +2 -0
- package/dist/cli/targetCliRoute.js +30 -0
- package/dist/cli/targetCommands.d.ts +33 -0
- package/dist/cli/targetCommands.js +257 -0
- package/dist/cli/targetComposedPreparationCommand.d.ts +6 -0
- package/dist/cli/targetComposedPreparationCommand.js +39 -0
- package/dist/cli/targetDefaultArtifactAuthority.d.ts +5 -0
- package/dist/cli/targetDefaultArtifactAuthority.js +28 -0
- package/dist/cli/targetDefaultAuthorities.d.ts +53 -0
- package/dist/cli/targetDefaultAuthorities.js +210 -0
- package/dist/cli/targetDefaultConfig.d.ts +68 -0
- package/dist/cli/targetDefaultConfig.js +317 -0
- package/dist/cli/targetDefaultConfigStdin.d.ts +13 -0
- package/dist/cli/targetDefaultConfigStdin.js +215 -0
- package/dist/cli/targetDefaultEnvelope.d.ts +1 -0
- package/dist/cli/targetDefaultEnvelope.js +13 -0
- package/dist/cli/targetDefaultHandlerFactory.d.ts +28 -0
- package/dist/cli/targetDefaultHandlerFactory.js +247 -0
- package/dist/cli/targetDefaultHandlers.d.ts +21 -0
- package/dist/cli/targetDefaultHandlers.js +72 -0
- package/dist/cli/targetDefaultJournalAuthority.d.ts +35 -0
- package/dist/cli/targetDefaultJournalAuthority.js +135 -0
- package/dist/cli/targetDefaultWorldClock.d.ts +4 -0
- package/dist/cli/targetDefaultWorldClock.js +14 -0
- package/dist/cli/targetDefaultWorldQueries.d.ts +5 -0
- package/dist/cli/targetDefaultWorldQueries.js +11 -0
- package/dist/cli/targetDefaultWorldReadiness.d.ts +4 -0
- package/dist/cli/targetDefaultWorldReadiness.js +17 -0
- package/dist/cli/targetEvidenceHelperResolution.d.ts +14 -0
- package/dist/cli/targetEvidenceHelperResolution.js +23 -0
- package/dist/cli/targetLookupCli.d.ts +3 -0
- package/dist/cli/targetLookupCli.js +31 -0
- package/dist/cli/targetLookupCommands.d.ts +12 -0
- package/dist/cli/targetLookupCommands.js +69 -0
- package/dist/cli/targetOperationDispatch.d.ts +58 -0
- package/dist/cli/targetOperationDispatch.js +21 -0
- package/dist/cli/targetReceiptOutput.d.ts +14 -0
- package/dist/cli/targetReceiptOutput.js +21 -0
- package/dist/cli/targetRequestFile.d.ts +14 -0
- package/dist/cli/targetRequestFile.js +63 -0
- package/dist/cli/targetSecretSourceInput.d.ts +28 -0
- package/dist/cli/targetSecretSourceInput.js +121 -0
- package/dist/cli/targetWorldClockCommand.d.ts +10 -0
- package/dist/cli/targetWorldClockCommand.js +42 -0
- package/dist/cli/targetWorldClockCrossProcess.test-helper.d.ts +13 -0
- package/dist/cli/targetWorldClockCrossProcess.test-helper.js +109 -0
- package/dist/cli/targetWorldReadinessCommand.d.ts +10 -0
- package/dist/cli/targetWorldReadinessCommand.js +43 -0
- package/dist/cli/upCommand.d.ts +3 -0
- package/dist/cli/upCommand.js +133 -0
- package/dist/cli/upImageCommand.d.ts +11 -0
- package/dist/cli/upImageCommand.js +41 -0
- package/dist/cli/upLifecycleInvocation.d.ts +41 -0
- package/dist/cli/upLifecycleInvocation.js +48 -0
- package/dist/cli/upLifecycleRecovery.d.ts +4 -0
- package/dist/cli/upLifecycleRecovery.js +53 -0
- package/dist/compiler/agentNodeMerge.d.ts +2 -0
- package/dist/compiler/agentNodeMerge.js +79 -0
- package/dist/compiler/agentSurfaces.js +11 -1
- package/dist/compiler/buildCompilePlan.js +17 -0
- package/dist/compiler/buildCompilePlanAgent.d.ts +11 -0
- package/dist/compiler/buildCompilePlanAgent.js +56 -0
- package/dist/compiler/buildCompilePlanTeams.d.ts +1 -0
- package/dist/compiler/buildCompilePlanTeams.js +4 -1
- package/dist/compiler/buildCompilePlanTraversal.js +75 -82
- package/dist/compiler/buildProject.d.ts +20 -1
- package/dist/compiler/buildProject.js +121 -7
- package/dist/compiler/compilePlanHelpers.js +2 -0
- package/dist/compiler/compileProject.d.ts +15 -0
- package/dist/compiler/compileProject.js +29 -75
- package/dist/compiler/compileProjectPolicy.d.ts +5 -0
- package/dist/compiler/compileProjectPolicy.js +21 -0
- package/dist/compiler/compileProjectReports.d.ts +9 -0
- package/dist/compiler/compileProjectReports.js +52 -0
- package/dist/compiler/containerArtifactSummaries.d.ts +7 -0
- package/dist/compiler/containerArtifactSummaries.js +138 -0
- package/dist/compiler/containerArtifacts.d.ts +10 -0
- package/dist/compiler/containerArtifacts.js +126 -125
- package/dist/compiler/containerArtifactsPlans.d.ts +5 -3
- package/dist/compiler/containerArtifactsPlans.js +31 -118
- package/dist/compiler/containerArtifactsRender.d.ts +3 -1
- package/dist/compiler/containerArtifactsRender.js +40 -81
- package/dist/compiler/containerArtifactsTypes.d.ts +12 -0
- package/dist/compiler/containerConfigEnvRender.d.ts +3 -0
- package/dist/compiler/containerConfigEnvRender.js +54 -0
- package/dist/compiler/containerEntrypointRender.d.ts +1 -0
- package/dist/compiler/containerEntrypointRender.js +60 -53
- package/dist/compiler/containerEntrypointShell.d.ts +5 -0
- package/dist/compiler/containerEntrypointShell.js +29 -0
- package/dist/compiler/containerPackageOverrides.d.ts +27 -0
- package/dist/compiler/containerPackageOverrides.js +63 -0
- package/dist/compiler/containerPackageRender.d.ts +15 -0
- package/dist/compiler/containerPackageRender.js +63 -0
- package/dist/compiler/containerTargetPlanResolution.d.ts +20 -0
- package/dist/compiler/containerTargetPlanResolution.js +97 -0
- package/dist/compiler/containerTargetResources.js +3 -1
- package/dist/compiler/daimonTelemetryArtifacts.d.ts +22 -0
- package/dist/compiler/daimonTelemetryArtifacts.js +61 -0
- package/dist/compiler/dockerBuildContext.d.ts +16 -0
- package/dist/compiler/dockerBuildContext.js +159 -0
- package/dist/compiler/dockerBuildSkip.d.ts +30 -0
- package/dist/compiler/dockerBuildSkip.js +81 -0
- package/dist/compiler/index.d.ts +4 -0
- package/dist/compiler/index.js +4 -0
- package/dist/compiler/memoryArtifacts.d.ts +26 -0
- package/dist/compiler/memoryArtifacts.js +134 -0
- package/dist/compiler/memoryResolution.d.ts +4 -0
- package/dist/compiler/memoryResolution.js +147 -0
- package/dist/compiler/modelEnv.d.ts +2 -0
- package/dist/compiler/modelEnv.js +6 -0
- package/dist/compiler/moltnetAllowedWakeSendersValidation.d.ts +2 -0
- package/dist/compiler/moltnetAllowedWakeSendersValidation.js +42 -0
- package/dist/compiler/moltnetArtifactPaths.d.ts +26 -0
- package/dist/compiler/moltnetArtifactPaths.js +49 -0
- package/dist/compiler/moltnetArtifactTypes.d.ts +46 -0
- package/dist/compiler/moltnetArtifactTypes.js +1 -0
- package/dist/compiler/moltnetArtifacts.d.ts +2 -40
- package/dist/compiler/moltnetArtifacts.js +56 -95
- package/dist/compiler/moltnetBinaries.d.ts +21 -1
- package/dist/compiler/moltnetBinaries.js +156 -28
- package/dist/compiler/moltnetClientConfig.js +18 -2
- package/dist/compiler/moltnetConfigLowering.d.ts +16 -1
- package/dist/compiler/moltnetConfigLowering.js +67 -5
- package/dist/compiler/moltnetExternalParticipantArtifact.d.ts +38 -0
- package/dist/compiler/moltnetExternalParticipantArtifact.js +188 -0
- package/dist/compiler/moltnetNodeConfig.js +7 -2
- package/dist/compiler/moltnetReleaseAuthority.d.ts +17 -0
- package/dist/compiler/moltnetReleaseAuthority.js +73 -0
- package/dist/compiler/moltnetReleaseDownload.d.ts +12 -0
- package/dist/compiler/moltnetReleaseDownload.js +85 -0
- package/dist/compiler/moltnetRepresentativeResolution.d.ts +1 -0
- package/dist/compiler/moltnetRepresentativeResolution.js +16 -2
- package/dist/compiler/moltnetResolution.js +72 -20
- package/dist/compiler/moltnetRoomMemberships.js +37 -9
- package/dist/compiler/moltnetRuntimeConfig.js +11 -0
- package/dist/compiler/moltnetServerPlans.d.ts +9 -0
- package/dist/compiler/moltnetServerPlans.js +132 -0
- package/dist/compiler/organizationIdentity.d.ts +27 -0
- package/dist/compiler/organizationIdentity.js +297 -0
- package/dist/compiler/organizationReadyEvidence.d.ts +49 -0
- package/dist/compiler/organizationReadyEvidence.js +261 -0
- package/dist/compiler/projectManifestGraph.d.ts +4 -0
- package/dist/compiler/projectManifestGraph.js +24 -0
- package/dist/compiler/runProject.d.ts +4 -0
- package/dist/compiler/runProject.js +37 -22
- package/dist/compiler/runProjectAuth.d.ts +7 -1
- package/dist/compiler/runProjectAuth.js +87 -9
- package/dist/compiler/runProjectDocker.d.ts +7 -0
- package/dist/compiler/runProjectDocker.js +187 -19
- package/dist/compiler/runProjectLifecycle.d.ts +7 -0
- package/dist/compiler/runProjectLifecycle.js +40 -0
- package/dist/compiler/syncProjectAuth.js +4 -1
- package/dist/compiler/teamContextActiveEnvironments.d.ts +13 -0
- package/dist/compiler/teamContextActiveEnvironments.js +255 -0
- package/dist/compiler/teamContextSupport.js +32 -40
- package/dist/compiler/teamContextTypes.d.ts +2 -0
- package/dist/compiler/types.d.ts +82 -1
- package/dist/compiler/upProject.d.ts +5 -0
- package/dist/compiler/upProject.js +257 -20
- package/dist/compiler/upReceipt.d.ts +36 -0
- package/dist/compiler/upReceipt.js +82 -0
- package/dist/compiler/updateProjectModels.js +42 -60
- package/dist/compiler/updateProjectRuntime.js +22 -35
- package/dist/compiler/updateProjectSurfaces.js +53 -47
- package/dist/compiler/worldBindings.d.ts +39 -0
- package/dist/compiler/worldBindings.js +247 -0
- package/dist/compiler/worldBindingsFile.d.ts +5 -0
- package/dist/compiler/worldBindingsFile.js +162 -0
- package/dist/deployment/artifactsExport.d.ts +49 -0
- package/dist/deployment/artifactsExport.js +217 -0
- package/dist/deployment/artifactsExportDocker.d.ts +48 -0
- package/dist/deployment/artifactsExportDocker.js +91 -0
- package/dist/deployment/artifactsExportPlan.d.ts +24 -0
- package/dist/deployment/artifactsExportPlan.js +135 -0
- package/dist/deployment/artifactsExportTypes.d.ts +50 -0
- package/dist/deployment/artifactsExportTypes.js +52 -0
- package/dist/deployment/buildImageCacheStore.d.ts +23 -0
- package/dist/deployment/buildImageCacheStore.js +54 -0
- package/dist/deployment/deploymentLifecycleCorrelation.d.ts +11 -0
- package/dist/deployment/deploymentLifecycleCorrelation.js +33 -0
- package/dist/deployment/dockerInspect.d.ts +9 -0
- package/dist/deployment/dockerInspect.js +24 -1
- package/dist/deployment/dockerLabels.d.ts +2 -0
- package/dist/deployment/dockerLabels.js +2 -0
- package/dist/deployment/dockerLogs.js +2 -10
- package/dist/deployment/dockerManager.d.ts +51 -0
- package/dist/deployment/dockerManager.js +118 -1
- package/dist/deployment/dockerProbeGateway.js +64 -5
- package/dist/deployment/dockerRecover.d.ts +17 -0
- package/dist/deployment/dockerRecover.js +137 -0
- package/dist/deployment/dockerTeardown.d.ts +32 -0
- package/dist/deployment/dockerTeardown.js +61 -0
- package/dist/deployment/downDeployment.d.ts +34 -0
- package/dist/deployment/downDeployment.js +147 -0
- package/dist/deployment/downReceiptTypes.d.ts +21 -0
- package/dist/deployment/downReceiptTypes.js +30 -0
- package/dist/deployment/index.d.ts +17 -0
- package/dist/deployment/index.js +18 -0
- package/dist/deployment/lifecycleCompletion.d.ts +37 -0
- package/dist/deployment/lifecycleCompletion.js +236 -0
- package/dist/deployment/lifecycleCompletionContracts.d.ts +158 -0
- package/dist/deployment/lifecycleCompletionContracts.js +106 -0
- package/dist/deployment/lifecycleCompletionHeartbeat.d.ts +2 -0
- package/dist/deployment/lifecycleCompletionHeartbeat.js +50 -0
- package/dist/deployment/lifecycleCompletionLookup.d.ts +18 -0
- package/dist/deployment/lifecycleCompletionLookup.js +88 -0
- package/dist/deployment/lifecycleCompletionOwner.d.ts +8 -0
- package/dist/deployment/lifecycleCompletionOwner.js +31 -0
- package/dist/deployment/lifecycleCompletionParsing.d.ts +12 -0
- package/dist/deployment/lifecycleCompletionParsing.js +108 -0
- package/dist/deployment/lifecycleCompletionPaths.d.ts +9 -0
- package/dist/deployment/lifecycleCompletionPaths.js +16 -0
- package/dist/deployment/lifecycleCompletionPublication.d.ts +5 -0
- package/dist/deployment/lifecycleCompletionPublication.js +35 -0
- package/dist/deployment/lifecycleCompletionRecovery.d.ts +21 -0
- package/dist/deployment/lifecycleCompletionRecovery.js +56 -0
- package/dist/deployment/lifecycleCompletionRoot.d.ts +21 -0
- package/dist/deployment/lifecycleCompletionRoot.js +243 -0
- package/dist/deployment/lifecycleCompletionStore.d.ts +6 -0
- package/dist/deployment/lifecycleCompletionStore.js +151 -0
- package/dist/deployment/organizationHandoffAuthorityFsClient.d.ts +17 -0
- package/dist/deployment/organizationHandoffAuthorityFsClient.js +132 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorker.d.ts +1 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorker.js +285 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorkerParent.fixture.d.ts +1 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorkerParent.fixture.js +26 -0
- package/dist/deployment/organizationHandoffAuthorityStore.d.ts +41 -0
- package/dist/deployment/organizationHandoffAuthorityStore.js +348 -0
- package/dist/deployment/organizationHandoffAuthorityTypes.d.ts +76 -0
- package/dist/deployment/organizationHandoffAuthorityTypes.js +148 -0
- package/dist/deployment/organizationHandoffTypes.d.ts +29 -0
- package/dist/deployment/organizationHandoffTypes.js +80 -0
- package/dist/deployment/organizationReady.d.ts +52 -0
- package/dist/deployment/organizationReady.js +200 -0
- package/dist/deployment/privateArtifactsExport.d.ts +18 -0
- package/dist/deployment/privateArtifactsExport.js +80 -0
- package/dist/deployment/providerRuntimeBoundaryScanner.test-helper.d.ts +8 -0
- package/dist/deployment/providerRuntimeBoundaryScanner.test-helper.js +60 -0
- package/dist/deployment/record.d.ts +26 -1
- package/dist/deployment/record.js +49 -4
- package/dist/deployment/simfileFixtureBoundary.test-helper.d.ts +8 -0
- package/dist/deployment/simfileFixtureBoundary.test-helper.js +103 -0
- package/dist/deployment/target.d.ts +1 -35
- package/dist/deployment/target.js +1 -96
- package/dist/deployment/upReceiptTypes.d.ts +111 -0
- package/dist/deployment/upReceiptTypes.js +164 -0
- package/dist/dev/activity.d.ts +14 -0
- package/dist/dev/activity.js +48 -0
- package/dist/dev/docker.d.ts +16 -0
- package/dist/dev/docker.js +71 -0
- package/dist/dev/index.d.ts +2 -0
- package/dist/dev/index.js +2 -0
- package/dist/dev/project.d.ts +35 -0
- package/dist/dev/project.js +170 -0
- package/dist/distribution/buildDistributionReport.d.ts +2 -1
- package/dist/distribution/buildDistributionReport.js +2 -1
- package/dist/distribution/distributionReportSchema.d.ts +5 -0
- package/dist/distribution/distributionReportSchema.js +7 -2
- package/dist/distribution/index.d.ts +2 -2
- package/dist/distribution/index.js +1 -1
- package/dist/distribution/types.d.ts +7 -0
- package/dist/distribution/types.js +1 -0
- package/dist/filesystem/paths.js +10 -1
- package/dist/ledger/causalConformanceCli.d.ts +1 -0
- package/dist/ledger/causalConformanceCli.js +41 -0
- package/dist/ledger/causeNamespace.d.ts +8 -0
- package/dist/ledger/causeNamespace.js +24 -0
- package/dist/ledger/conformance.d.ts +83 -0
- package/dist/ledger/conformance.js +259 -0
- package/dist/ledger/emitters.d.ts +76 -0
- package/dist/ledger/emitters.js +188 -0
- package/dist/ledger/index.d.ts +4 -0
- package/dist/ledger/index.js +4 -0
- package/dist/ledger/principal.d.ts +96 -0
- package/dist/ledger/principal.js +121 -0
- package/dist/manifest/externalParticipantSchemas.d.ts +18 -0
- package/dist/manifest/externalParticipantSchemas.js +17 -0
- package/dist/manifest/index.d.ts +1 -0
- package/dist/manifest/index.js +1 -0
- package/dist/manifest/inlineAgentMember.d.ts +2 -0
- package/dist/manifest/inlineAgentMember.js +9 -0
- package/dist/manifest/loadManifest.js +14 -8
- package/dist/manifest/mcpSchemas.d.ts +17 -0
- package/dist/manifest/mcpSchemas.js +41 -0
- package/dist/manifest/memorySchemas.d.ts +245 -0
- package/dist/manifest/memorySchemas.js +148 -0
- package/dist/manifest/renderSpawnfile.js +22 -131
- package/dist/manifest/renderSpawnfileNetworks.js +9 -2
- package/dist/manifest/renderSpawnfileSurfaces.d.ts +2 -0
- package/dist/manifest/renderSpawnfileSurfaces.js +134 -0
- package/dist/manifest/schemas.d.ts +1868 -99
- package/dist/manifest/schemas.js +78 -32
- package/dist/manifest/surfaceSchemas.d.ts +17 -0
- package/dist/manifest/surfaceSchemas.js +24 -1
- package/dist/manifest/teamNetworkAccessSchemas.d.ts +1 -1
- package/dist/manifest/teamNetworkAuthSchemas.d.ts +48 -0
- package/dist/manifest/teamNetworkAuthSchemas.js +103 -0
- package/dist/manifest/teamNetworkSchemas.d.ts +8 -187
- package/dist/manifest/teamNetworkSchemas.js +3 -317
- package/dist/manifest/teamNetworkServerSchemas.d.ts +150 -0
- package/dist/manifest/teamNetworkServerSchemas.js +199 -0
- package/dist/ownership/siblingBuildFreshness.d.ts +20 -0
- package/dist/ownership/siblingBuildFreshness.js +20 -0
- package/dist/ownership/simfileRunOperatorInputs.d.ts +103 -0
- package/dist/ownership/simfileRunOperatorInputs.js +139 -0
- package/dist/report/types.d.ts +142 -0
- package/dist/runtime/common.d.ts +37 -0
- package/dist/runtime/common.js +56 -1
- package/dist/runtime/container.d.ts +29 -1
- package/dist/runtime/container.js +127 -11
- package/dist/runtime/containerPackageOverrides.d.ts +37 -0
- package/dist/runtime/containerPackageOverrides.js +33 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +2 -0
- package/dist/runtime/install.d.ts +1 -1
- package/dist/runtime/install.js +43 -1
- package/dist/runtime/mnemeMcp.d.ts +15 -0
- package/dist/runtime/mnemeMcp.js +109 -0
- package/dist/runtime/openclaw/adapter.js +15 -4
- package/dist/runtime/openclaw/mcp.d.ts +10 -0
- package/dist/runtime/openclaw/mcp.js +69 -0
- package/dist/runtime/openclaw/runAuth.js +2 -2
- package/dist/runtime/openclaw/scaffold.js +1 -1
- package/dist/runtime/openclaw/schedules.d.ts +38 -0
- package/dist/runtime/openclaw/schedules.js +74 -0
- package/dist/runtime/pi/adapter.d.ts +4 -0
- package/dist/runtime/pi/adapter.js +231 -0
- package/dist/runtime/pi/appActivitySource.d.ts +1 -0
- package/dist/runtime/pi/appActivitySource.js +199 -0
- package/dist/runtime/pi/appAgentConfig.d.ts +11 -0
- package/dist/runtime/pi/appAgentConfig.js +264 -0
- package/dist/runtime/pi/appCliEnginesSource.d.ts +1 -0
- package/dist/runtime/pi/appCliEnginesSource.js +183 -0
- package/dist/runtime/pi/appCliSource.d.ts +1 -0
- package/dist/runtime/pi/appCliSource.js +353 -0
- package/dist/runtime/pi/appControlSource.d.ts +1 -0
- package/dist/runtime/pi/appControlSource.js +390 -0
- package/dist/runtime/pi/appControlWakeIdentitySource.d.ts +1 -0
- package/dist/runtime/pi/appControlWakeIdentitySource.js +19 -0
- package/dist/runtime/pi/appCoreSource.d.ts +4 -0
- package/dist/runtime/pi/appCoreSource.js +244 -0
- package/dist/runtime/pi/appPreludeSource.d.ts +1 -0
- package/dist/runtime/pi/appPreludeSource.js +191 -0
- package/dist/runtime/pi/appScheduleSource.d.ts +1 -0
- package/dist/runtime/pi/appScheduleSource.js +80 -0
- package/dist/runtime/pi/appScriptedEngine.d.ts +31 -0
- package/dist/runtime/pi/appScriptedEngine.js +42 -0
- package/dist/runtime/pi/appSource.d.ts +4 -0
- package/dist/runtime/pi/appSource.js +12 -0
- package/dist/runtime/pi/appTemplate.d.ts +14 -0
- package/dist/runtime/pi/appTemplate.js +27 -0
- package/dist/runtime/pi/appTemplateTypes.d.ts +64 -0
- package/dist/runtime/pi/appTemplateTypes.js +18 -0
- package/dist/runtime/pi/appWakeContextSource.d.ts +1 -0
- package/dist/runtime/pi/appWakeContextSource.js +398 -0
- package/dist/runtime/pi/containerTargets.d.ts +4 -0
- package/dist/runtime/pi/containerTargets.js +57 -0
- package/dist/runtime/pi/runAuth.d.ts +2 -0
- package/dist/runtime/pi/runAuth.js +185 -0
- package/dist/runtime/pi/testHelpers.d.ts +2 -0
- package/dist/runtime/pi/testHelpers.js +40 -0
- package/dist/runtime/picoclaw/adapter.js +23 -27
- package/dist/runtime/picoclaw/mcp.d.ts +4 -0
- package/dist/runtime/picoclaw/mcp.js +43 -0
- package/dist/runtime/picoclaw/memory.d.ts +7 -0
- package/dist/runtime/picoclaw/memory.js +17 -0
- package/dist/runtime/picoclaw/runAuth.js +1 -1
- package/dist/runtime/picoclaw/scaffold.js +1 -1
- package/dist/runtime/picoclaw/schedules.d.ts +26 -0
- package/dist/runtime/picoclaw/schedules.js +62 -3
- package/dist/runtime/registry.js +3 -0
- package/dist/runtime/scheduleUtils.d.ts +2 -0
- package/dist/runtime/scheduleUtils.js +15 -0
- package/dist/runtime/types.d.ts +26 -2
- package/dist/shared/errors.d.ts +1 -1
- package/dist/shared/errors.js +2 -2
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -0
- package/dist/shared/redaction.d.ts +2 -0
- package/dist/shared/redaction.js +10 -0
- package/dist/status/buildStatus.d.ts +1 -0
- package/dist/status/buildStatus.js +2 -0
- package/dist/status/compileReport.d.ts +22 -0
- package/dist/status/compileReport.js +16 -2
- package/dist/status/compiledProbeCollection.d.ts +21 -0
- package/dist/status/compiledProbeCollection.js +27 -0
- package/dist/status/deployments.js +5 -12
- package/dist/status/imageStatusReport.js +6 -0
- package/dist/status/index.d.ts +3 -0
- package/dist/status/index.js +3 -0
- package/dist/status/lifecycleProbes.d.ts +19 -0
- package/dist/status/lifecycleProbes.js +174 -0
- package/dist/status/moltnetProbes.d.ts +7 -8
- package/dist/status/moltnetProbes.js +27 -198
- package/dist/status/moltnetWiringProbes.d.ts +19 -0
- package/dist/status/moltnetWiringProbes.js +178 -0
- package/dist/target/cleanupRun.d.ts +41 -0
- package/dist/target/cleanupRun.js +139 -0
- package/dist/target/cleanupRunDocker.d.ts +16 -0
- package/dist/target/cleanupRunDocker.js +66 -0
- package/dist/target/cleanupRunDocker.test-helper.d.ts +67 -0
- package/dist/target/cleanupRunDocker.test-helper.js +238 -0
- package/dist/target/cleanupRunDockerPreflight.d.ts +17 -0
- package/dist/target/cleanupRunDockerPreflight.js +224 -0
- package/dist/target/composedPreparation.d.ts +205 -0
- package/dist/target/composedPreparation.js +223 -0
- package/dist/target/containerBundle.d.ts +82 -0
- package/dist/target/containerBundle.js +243 -0
- package/dist/target/containerBundleArchive.d.ts +31 -0
- package/dist/target/containerBundleArchive.js +140 -0
- package/dist/target/containerBundleAuthority.d.ts +25 -0
- package/dist/target/containerBundleAuthority.js +65 -0
- package/dist/target/containerBundleContracts.d.ts +114 -0
- package/dist/target/containerBundleContracts.js +173 -0
- package/dist/target/containerBundleFilesystemStore.d.ts +3 -0
- package/dist/target/containerBundleFilesystemStore.js +247 -0
- package/dist/target/containerBundlePolicy.d.ts +33 -0
- package/dist/target/containerBundlePolicy.js +64 -0
- package/dist/target/containerBundleStore.d.ts +127 -0
- package/dist/target/containerBundleStore.js +284 -0
- package/dist/target/contracts.d.ts +538 -0
- package/dist/target/contracts.js +373 -0
- package/dist/target/dockerArtifactIdentityTypes.d.ts +56 -0
- package/dist/target/dockerArtifactIdentityTypes.js +1 -0
- package/dist/target/dockerArtifactInspection.d.ts +40 -0
- package/dist/target/dockerArtifactInspection.js +125 -0
- package/dist/target/dockerArtifacts.d.ts +21 -0
- package/dist/target/dockerArtifacts.js +110 -0
- package/dist/target/dockerArtifactsProvider.d.ts +41 -0
- package/dist/target/dockerArtifactsProvider.js +449 -0
- package/dist/target/dockerCommandExecutor.d.ts +27 -0
- package/dist/target/dockerCommandExecutor.js +200 -0
- package/dist/target/dockerCommandExecutorCore.d.ts +34 -0
- package/dist/target/dockerCommandExecutorCore.js +273 -0
- package/dist/target/dockerContainerBundleBuilder.d.ts +8 -0
- package/dist/target/dockerContainerBundleBuilder.js +256 -0
- package/dist/target/dockerContextSnapshot.d.ts +21 -0
- package/dist/target/dockerContextSnapshot.js +158 -0
- package/dist/target/dockerEndpointFingerprint.d.ts +1 -0
- package/dist/target/dockerEndpointFingerprint.js +9 -0
- package/dist/target/dockerPreparedArtifact.d.ts +48 -0
- package/dist/target/dockerPreparedArtifact.js +131 -0
- package/dist/target/dockerProjectionJson.d.ts +1 -0
- package/dist/target/dockerProjectionJson.js +80 -0
- package/dist/target/dockerPublicArtifactSnapshot.d.ts +17 -0
- package/dist/target/dockerPublicArtifactSnapshot.js +99 -0
- package/dist/target/dockerResources.d.ts +26 -0
- package/dist/target/dockerResources.js +162 -0
- package/dist/target/dockerResourcesProvider.d.ts +44 -0
- package/dist/target/dockerResourcesProvider.js +207 -0
- package/dist/target/dockerSecrets.d.ts +39 -0
- package/dist/target/dockerSecrets.js +249 -0
- package/dist/target/dockerSecretsAuthority.d.ts +26 -0
- package/dist/target/dockerSecretsAuthority.js +216 -0
- package/dist/target/dockerSecretsLifecycle.d.ts +25 -0
- package/dist/target/dockerSecretsLifecycle.js +133 -0
- package/dist/target/dockerSecretsProvider.d.ts +68 -0
- package/dist/target/dockerSecretsProvider.js +329 -0
- package/dist/target/dockerTarget.d.ts +52 -0
- package/dist/target/dockerTarget.js +48 -0
- package/dist/target/dockerTargetBinding.d.ts +14 -0
- package/dist/target/dockerTargetBinding.js +96 -0
- package/dist/target/dockerWorldClock.d.ts +17 -0
- package/dist/target/dockerWorldClock.js +111 -0
- package/dist/target/dockerWorldReadiness.d.ts +17 -0
- package/dist/target/dockerWorldReadiness.js +119 -0
- package/dist/target/dockerWorldService.d.ts +23 -0
- package/dist/target/dockerWorldService.js +216 -0
- package/dist/target/dockerWorldServiceAuthority.d.ts +80 -0
- package/dist/target/dockerWorldServiceAuthority.js +182 -0
- package/dist/target/dockerWorldServiceLifecycle.d.ts +41 -0
- package/dist/target/dockerWorldServiceLifecycle.js +275 -0
- package/dist/target/dockerWorldServiceProvider.d.ts +60 -0
- package/dist/target/dockerWorldServiceProvider.js +318 -0
- package/dist/target/dockerWorldServiceStore.d.ts +73 -0
- package/dist/target/dockerWorldServiceStore.js +367 -0
- package/dist/target/evidenceExport.d.ts +55 -0
- package/dist/target/evidenceExport.js +518 -0
- package/dist/target/evidenceExportArchive.d.ts +10 -0
- package/dist/target/evidenceExportArchive.js +302 -0
- package/dist/target/evidenceExportContract.d.ts +27 -0
- package/dist/target/evidenceExportContract.js +40 -0
- package/dist/target/evidenceExportOperationsTestKit.d.ts +87 -0
- package/dist/target/evidenceExportOperationsTestKit.js +312 -0
- package/dist/target/evidenceExportProvider.d.ts +85 -0
- package/dist/target/evidenceExportProvider.js +187 -0
- package/dist/target/evidenceExportPublicationTypes.d.ts +16 -0
- package/dist/target/evidenceExportPublicationTypes.js +1 -0
- package/dist/target/evidenceExportStore.d.ts +70 -0
- package/dist/target/evidenceExportStore.js +498 -0
- package/dist/target/evidenceExportStorePublication.d.ts +7 -0
- package/dist/target/evidenceExportStorePublication.js +395 -0
- package/dist/target/handles.d.ts +20 -0
- package/dist/target/handles.js +56 -0
- package/dist/target/index.d.ts +12 -0
- package/dist/target/index.js +11 -0
- package/dist/target/journal.d.ts +59 -0
- package/dist/target/journal.js +529 -0
- package/dist/target/journalFilesystem.d.ts +3 -0
- package/dist/target/journalFilesystem.js +111 -0
- package/dist/target/journalRoot.d.ts +4 -0
- package/dist/target/journalRoot.js +6 -0
- package/dist/target/organizationAttachment.d.ts +23 -0
- package/dist/target/organizationAttachment.js +263 -0
- package/dist/target/organizationAttachmentAuthority.d.ts +65 -0
- package/dist/target/organizationAttachmentAuthority.js +161 -0
- package/dist/target/organizationAttachmentLifecycle.d.ts +17 -0
- package/dist/target/organizationAttachmentLifecycle.js +101 -0
- package/dist/target/organizationAttachmentProvider.d.ts +76 -0
- package/dist/target/organizationAttachmentProvider.js +289 -0
- package/dist/target/organizationAttachmentStore.d.ts +51 -0
- package/dist/target/organizationAttachmentStore.js +316 -0
- package/dist/target/publicArtifactSnapshot.d.ts +41 -0
- package/dist/target/publicArtifactSnapshot.js +150 -0
- package/dist/target/topologyActivation.d.ts +51 -0
- package/dist/target/topologyActivation.js +149 -0
- package/dist/target/topologyAttestation.d.ts +37 -0
- package/dist/target/topologyAttestation.js +300 -0
- package/dist/target/topologyAttestationErrors.d.ts +1 -0
- package/dist/target/topologyAttestationErrors.js +1 -0
- package/dist/target/worldClock.d.ts +60 -0
- package/dist/target/worldClock.js +129 -0
- package/dist/target/worldReadiness.d.ts +103 -0
- package/dist/target/worldReadiness.js +153 -0
- package/moltnet-releases.json +20 -0
- package/package.json +29 -8
- package/runtimes.yaml +28 -27
- package/dist/runtime/openclaw/scaffold-assets/CLAUDE.md +0 -5
- package/dist/runtime/picoclaw/scaffold-assets/CLAUDE.md +0 -5
- /package/dist/runtime/openclaw/scaffold-assets/{AGENTS.md → WORKSPACE_AGENTS.md} +0 -0
- /package/dist/runtime/picoclaw/scaffold-assets/{AGENTS.md → WORKSPACE_AGENTS.md} +0 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { mkdtemp, realpath, rm } from "node:fs/promises";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { EVIDENCE_EXPORT_MOUNT, EVIDENCE_EXPORT_HELPER_CMD, EVIDENCE_EXPORT_HELPER_CONTRACT, EVIDENCE_EXPORT_HELPER_CONTRACT_LABEL, EVIDENCE_EXPORT_HELPER_ENTRYPOINT, EVIDENCE_EXPORT_HELPER_USER, createEvidenceExportHelper, parseEvidenceVolumeAuthority } from "./evidenceExportProvider.js";
|
|
5
|
+
import { createDockerArtifactSpec, initializeDockerArtifactIdentityStore } from "./dockerArtifactsProvider.js";
|
|
6
|
+
import { initializeEvidenceExportAuthorityStore } from "./evidenceExportStore.js";
|
|
7
|
+
import { createDockerResourceSpec } from "./dockerResourcesProvider.js";
|
|
8
|
+
import { createEvidenceExportOperations } from "./evidenceExport.js";
|
|
9
|
+
import { initializeTargetJournal } from "./journal.js";
|
|
10
|
+
import { selectTarget } from "./dockerTarget.js";
|
|
11
|
+
import { createTargetReceiptDigest } from "./handles.js";
|
|
12
|
+
import { parseOpaqueTargetHandle, TARGET_RESOURCE_REQUEST_VERSION } from "./contracts.js";
|
|
13
|
+
const roots = [];
|
|
14
|
+
export const root = async () => {
|
|
15
|
+
const value = await realpath(await mkdtemp(path.join(os.tmpdir(), "spawnfile-export-")));
|
|
16
|
+
roots.push(value);
|
|
17
|
+
return value;
|
|
18
|
+
};
|
|
19
|
+
export const cleanupTestRoots = async () => {
|
|
20
|
+
await Promise.all(roots.splice(0).map((value) => rm(value, { force: true, recursive: true })));
|
|
21
|
+
};
|
|
22
|
+
const admission = () => {
|
|
23
|
+
const selectedTargetHandle = parseOpaqueTargetHandle("opaque_dddddddddddddddd");
|
|
24
|
+
const volume = createDockerResourceSpec({ kind: "evidence_volume", operationHandle: parseOpaqueTargetHandle("opaque_eeeeeeeeeeeeeeee"), requestDigest: `sha256:${"f".repeat(64)}`, runId: "run-one", selectedTargetHandle });
|
|
25
|
+
return ({
|
|
26
|
+
descriptor_digest: `sha256:${"a".repeat(64)}`,
|
|
27
|
+
evidence_volume: parseEvidenceVolumeAuthority({ labels: volume.labels, name: volume.name, resultHandle: volume.resultHandle }),
|
|
28
|
+
helper: createEvidenceExportHelper({
|
|
29
|
+
artifactManifestDigest: `sha256:${"b".repeat(64)}`,
|
|
30
|
+
imageDigest: `sha256:${"c".repeat(64)}`,
|
|
31
|
+
imageReference: `registry.example/export@sha256:${"c".repeat(64)}`,
|
|
32
|
+
resultHandle: parseOpaqueTargetHandle("opaque_bbbbbbbbbbbbbbbb")
|
|
33
|
+
}),
|
|
34
|
+
helper_contract: EVIDENCE_EXPORT_HELPER_CONTRACT,
|
|
35
|
+
operation_handle: parseOpaqueTargetHandle("opaque_cccccccccccccccc"),
|
|
36
|
+
request_digest: `sha256:${"d".repeat(64)}`,
|
|
37
|
+
run_id: "run-one",
|
|
38
|
+
selected_target: { fingerprint: `sha256:${"e".repeat(32)}`, handle: selectedTargetHandle },
|
|
39
|
+
version: "spawnfile.target-evidence-export.private.v1"
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
export { admission };
|
|
43
|
+
const complete = async (journal, claim, request, spec) => {
|
|
44
|
+
const raw = { cleanup_state: "not_requested", descriptor_digest: request.descriptor_digest, export_state: "not_requested", labels: Object.entries(spec.labels).map(([key, value]) => ({ key, value })), operation: request.operation, operation_handle: claim.operationHandle, receipt_digest: `sha256:${"0".repeat(64)}`, request_digest: claim.requestDigest, result_handle: spec.resultHandle, resulting_revision: (await journal.read()).revision + 1, run_id: request.run_id, selected_target: request.selected_target, version: "spawnfile.target-resource.receipt.v1" };
|
|
45
|
+
await journal.complete(claim, { ...raw, receipt_digest: createTargetReceiptDigest(raw) });
|
|
46
|
+
};
|
|
47
|
+
export { complete };
|
|
48
|
+
const octalField = (value, length) => {
|
|
49
|
+
const raw = value.toString(8);
|
|
50
|
+
if (raw.length > length - 1)
|
|
51
|
+
throw new Error("field overflow");
|
|
52
|
+
return `${raw.padStart(length - 1, "0")}\0`;
|
|
53
|
+
};
|
|
54
|
+
export const header = (name, data) => {
|
|
55
|
+
const out = Buffer.alloc(512);
|
|
56
|
+
out.write(name);
|
|
57
|
+
out.write(octalField(0o644, 8), 100);
|
|
58
|
+
out.write(octalField(0, 8), 108);
|
|
59
|
+
out.write(octalField(0, 8), 116);
|
|
60
|
+
out.write(octalField(data.byteLength, 12), 124);
|
|
61
|
+
out.write(octalField(0, 12), 136);
|
|
62
|
+
out.fill(32, 148, 156);
|
|
63
|
+
out.write("0", 156);
|
|
64
|
+
out.write("ustar\0", 257);
|
|
65
|
+
out.write("00", 263);
|
|
66
|
+
out.write(octalField(0, 8), 329);
|
|
67
|
+
out.write(octalField(0, 8), 337);
|
|
68
|
+
const checksum = out.reduce((sum, value) => sum + value, 0).toString(8).padStart(6, "0");
|
|
69
|
+
if (checksum.length > 6)
|
|
70
|
+
throw new Error("checksum overflow");
|
|
71
|
+
out.write(`${checksum}\0 `, 148);
|
|
72
|
+
return out;
|
|
73
|
+
};
|
|
74
|
+
export const runLifecycleExport = async (input = {}) => {
|
|
75
|
+
const directory = await root();
|
|
76
|
+
const context = "test_context";
|
|
77
|
+
const calls = [];
|
|
78
|
+
const descriptor = `sha256:${"a".repeat(64)}`;
|
|
79
|
+
const manifest = `sha256:${"b".repeat(64)}`;
|
|
80
|
+
const image = `sha256:${"c".repeat(64)}`;
|
|
81
|
+
const reference = `registry.example/export@${image}`;
|
|
82
|
+
const payload = input.payload ?? new Uint8Array([...header("ball", Buffer.from("kick")), ...Buffer.from("kick"), ...Buffer.alloc(508), ...Buffer.alloc(1024)]);
|
|
83
|
+
let volume;
|
|
84
|
+
let created = [];
|
|
85
|
+
let exportCalls = 0;
|
|
86
|
+
let removeCalls = 0;
|
|
87
|
+
let helperInspectionDrift = false;
|
|
88
|
+
let volumeInspectionDrift = false;
|
|
89
|
+
const projection = JSON.stringify([{
|
|
90
|
+
RepoDigests: [reference],
|
|
91
|
+
Config: {
|
|
92
|
+
Entrypoint: EVIDENCE_EXPORT_HELPER_ENTRYPOINT,
|
|
93
|
+
Cmd: EVIDENCE_EXPORT_HELPER_CMD,
|
|
94
|
+
Labels: { [EVIDENCE_EXPORT_HELPER_CONTRACT_LABEL]: "v1" },
|
|
95
|
+
Env: null,
|
|
96
|
+
ExposedPorts: null,
|
|
97
|
+
Healthcheck: null,
|
|
98
|
+
User: EVIDENCE_EXPORT_HELPER_USER,
|
|
99
|
+
Volumes: null
|
|
100
|
+
}
|
|
101
|
+
}]);
|
|
102
|
+
const imageLabels = { [EVIDENCE_EXPORT_HELPER_CONTRACT_LABEL]: "v1" };
|
|
103
|
+
const containerProjectionLabels = { ...imageLabels };
|
|
104
|
+
const removeCallArgs = [];
|
|
105
|
+
const executor = async (_file, args) => {
|
|
106
|
+
calls.push(args);
|
|
107
|
+
if (args[0] === "context")
|
|
108
|
+
return { stderr: "", stdout: JSON.stringify("unix:///private/test.sock") };
|
|
109
|
+
if (args[2] === "volume" && args[3] === "inspect")
|
|
110
|
+
return { stderr: "", stdout: JSON.stringify([{ Labels: volumeInspectionDrift ? { ...volume.labels, "spawnfile.target.drift": "true" } : volume.labels, Name: volume.name }]) };
|
|
111
|
+
if (args[2] === "image" && args[3] === "inspect")
|
|
112
|
+
return { stderr: "", stdout: helperInspectionDrift ? projection.replace("65534:65534", "0:0") : projection };
|
|
113
|
+
if (args[2] === "container" && args[3] === "create") {
|
|
114
|
+
created = args;
|
|
115
|
+
if (input.createShouldFail)
|
|
116
|
+
throw new Error("create transport failed");
|
|
117
|
+
return { stderr: "", stdout: "container" };
|
|
118
|
+
}
|
|
119
|
+
if (args[2] === "container" && args[3] === "inspect") {
|
|
120
|
+
if (input.foreignInspect === "transport")
|
|
121
|
+
throw new Error("inspect transport failed");
|
|
122
|
+
return {
|
|
123
|
+
stderr: "",
|
|
124
|
+
stdout: helperProjection(created, volume.name, containerProjectionLabels, input.foreignInspect === "projection"
|
|
125
|
+
? (projection) => { projection.Config = { ...projection.Config, User: "0:0" }; }
|
|
126
|
+
: undefined)
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
if (args[2] === "container" && args[3] === "rm") {
|
|
130
|
+
removeCallArgs.push(args);
|
|
131
|
+
removeCalls += 1;
|
|
132
|
+
if (input.cleanupShouldFail)
|
|
133
|
+
throw new Error("rm failed");
|
|
134
|
+
return { stderr: "", stdout: "removed" };
|
|
135
|
+
}
|
|
136
|
+
throw new Error(`unexpected docker invocation: ${args.join(" ")}`);
|
|
137
|
+
};
|
|
138
|
+
const selected = await selectTarget({ context, execFile: executor });
|
|
139
|
+
const journal = await initializeTargetJournal({ context, descriptorDigest: descriptor, root: path.join(directory, "journal"), runId: "run-one", selectedTarget: selected });
|
|
140
|
+
const envelope = (expected_revision, idempotency_key) => ({ descriptor_digest: descriptor, expected_revision, idempotency_key, run_id: "run-one", selected_target: { fingerprint: selected.fingerprint, handle: selected.handle }, version: TARGET_RESOURCE_REQUEST_VERSION });
|
|
141
|
+
const artifactRequest = { ...envelope(0, "idem_aaaaaaaaaaaaaaaa"), artifact_manifest_digest: manifest, operation: "resolve_world_artifact" };
|
|
142
|
+
const artifactClaim = await journal.reserve(artifactRequest);
|
|
143
|
+
if (artifactClaim.kind !== "owner")
|
|
144
|
+
throw new Error("artifact reservation failed");
|
|
145
|
+
const artifact = createDockerArtifactSpec({ artifactManifestDigest: manifest, imageDigest: image, imageReference: reference, operationHandle: artifactClaim.claim.operationHandle, requestDigest: artifactClaim.claim.requestDigest, selectedTargetHandle: selected.handle });
|
|
146
|
+
await complete(journal, artifactClaim.claim, artifactRequest, artifact);
|
|
147
|
+
const identities = await initializeDockerArtifactIdentityStore(path.join(directory, "identities"));
|
|
148
|
+
await identities.bind({ artifactManifestDigest: manifest, imageDigest: image, imageReference: reference, operationHandle: artifactClaim.claim.operationHandle, requestDigest: artifactClaim.claim.requestDigest, resultHandle: artifact.resultHandle, selectedTargetHandle: selected.handle });
|
|
149
|
+
const volumeRequest = { ...envelope(1, "idem_bbbbbbbbbbbbbbbb"), operation: "create_evidence_volume" };
|
|
150
|
+
const volumeClaim = await journal.reserve(volumeRequest);
|
|
151
|
+
if (volumeClaim.kind !== "owner")
|
|
152
|
+
throw new Error("volume reservation failed");
|
|
153
|
+
volume = createDockerResourceSpec({ kind: "evidence_volume", operationHandle: volumeClaim.claim.operationHandle, requestDigest: volumeClaim.claim.requestDigest, runId: "run-one", selectedTargetHandle: selected.handle });
|
|
154
|
+
await complete(journal, volumeClaim.claim, volumeRequest, volume);
|
|
155
|
+
const exportRequest = { ...envelope(2, "idem_cccccccccccccccc"), evidence_volume_handle: volume.resultHandle, operation: "export_evidence_volume" };
|
|
156
|
+
const destination = path.join(directory, "match.tar");
|
|
157
|
+
const authorityStore = await initializeEvidenceExportAuthorityStore(path.join(directory, "export-store"), input.createDestinationStoreOptions);
|
|
158
|
+
const observedAuthorityStore = input.onLoadIndex ? {
|
|
159
|
+
bindAdmission: authorityStore.bindAdmission.bind(authorityStore),
|
|
160
|
+
bindDestination: authorityStore.bindDestination.bind(authorityStore),
|
|
161
|
+
bindIndex: authorityStore.bindIndex.bind(authorityStore),
|
|
162
|
+
claimExport: authorityStore.claimExport.bind(authorityStore),
|
|
163
|
+
clearStaleExportClaim: authorityStore.clearStaleExportClaim.bind(authorityStore),
|
|
164
|
+
loadAdmission: authorityStore.loadAdmission.bind(authorityStore),
|
|
165
|
+
loadIndex: async (value) => {
|
|
166
|
+
await input.onLoadIndex();
|
|
167
|
+
return authorityStore.loadIndex(value);
|
|
168
|
+
},
|
|
169
|
+
releaseExport: authorityStore.releaseExport.bind(authorityStore),
|
|
170
|
+
requireDestination: authorityStore.requireDestination.bind(authorityStore)
|
|
171
|
+
} : authorityStore;
|
|
172
|
+
const operationOptions = {
|
|
173
|
+
authorityStore: observedAuthorityStore,
|
|
174
|
+
artifactIdentityStore: identities,
|
|
175
|
+
context,
|
|
176
|
+
executor,
|
|
177
|
+
exportExecutor: async () => {
|
|
178
|
+
exportCalls += 1;
|
|
179
|
+
if (input.startShouldFail)
|
|
180
|
+
throw new Error("start failed");
|
|
181
|
+
return { bytes: payload };
|
|
182
|
+
},
|
|
183
|
+
helperArtifactBundle: { operation_handle: artifactClaim.claim.operationHandle, request_digest: artifactClaim.claim.requestDigest, result_handle: artifact.resultHandle },
|
|
184
|
+
helperArtifactManifestDigest: manifest,
|
|
185
|
+
helperArtifactContract: EVIDENCE_EXPORT_HELPER_CONTRACT,
|
|
186
|
+
journal,
|
|
187
|
+
testHooks: {
|
|
188
|
+
beforeBindAdmission: input.boundaryFailures?.beforeBindAdmission,
|
|
189
|
+
beforeBindDestination: input.boundaryFailures?.beforeBindDestination,
|
|
190
|
+
beforeIndexLoad: input.boundaryFailures?.beforeIndexLoad,
|
|
191
|
+
beforeIndexBind: input.boundaryFailures?.beforeIndexBind,
|
|
192
|
+
beforeArchive: input.boundaryFailures?.beforeArchive,
|
|
193
|
+
beforePublishTempWrite: input.boundaryFailures?.beforePublishTempWrite,
|
|
194
|
+
beforePublishTempOpen: input.boundaryFailures?.beforePublishTempOpen,
|
|
195
|
+
beforePublishTempSync: input.boundaryFailures?.beforePublishTempSync,
|
|
196
|
+
beforePublishFinalLink: input.boundaryFailures?.beforePublishFinalLink,
|
|
197
|
+
beforePublishDirectorySync: input.boundaryFailures?.beforePublishDirectorySync,
|
|
198
|
+
beforeJournalComplete: input.boundaryFailures?.beforeJournalComplete,
|
|
199
|
+
beforeRequireDestination: input.boundaryFailures?.beforeRequireDestination
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
const operations = createEvidenceExportOperations(operationOptions);
|
|
203
|
+
const execute = async (destinationValue) => operations.execute(exportRequest, destinationValue ?? destination);
|
|
204
|
+
const executeDistinct = async (destinationValue) => operations.execute({ ...exportRequest, evidence_volume_handle: artifact.resultHandle }, destinationValue ?? destination);
|
|
205
|
+
const executeReplayWithBlockedExecutors = async (destinationValue) => {
|
|
206
|
+
let dockerCalls = 0;
|
|
207
|
+
let blockedExportCalls = 0;
|
|
208
|
+
const replay = createEvidenceExportOperations({
|
|
209
|
+
...operationOptions,
|
|
210
|
+
executor: async () => { dockerCalls += 1; throw new Error("completed replay touched Docker"); },
|
|
211
|
+
exportExecutor: async () => { blockedExportCalls += 1; throw new Error("completed replay exported evidence"); }
|
|
212
|
+
});
|
|
213
|
+
const result = await replay.execute(exportRequest, destinationValue ?? destination);
|
|
214
|
+
return { dockerCalls, exportCalls: blockedExportCalls, result };
|
|
215
|
+
};
|
|
216
|
+
const rejectReplayWithWrongHelperRequest = async (destinationValue) => {
|
|
217
|
+
let dockerCalls = 0;
|
|
218
|
+
let blockedExportCalls = 0;
|
|
219
|
+
const replay = createEvidenceExportOperations({
|
|
220
|
+
...operationOptions,
|
|
221
|
+
executor: async () => { dockerCalls += 1; throw new Error("completed replay touched Docker"); },
|
|
222
|
+
exportExecutor: async () => { blockedExportCalls += 1; throw new Error("completed replay exported evidence"); },
|
|
223
|
+
helperArtifactBundle: { ...operationOptions.helperArtifactBundle, request_digest: `sha256:${"f".repeat(64)}` }
|
|
224
|
+
});
|
|
225
|
+
let error;
|
|
226
|
+
try {
|
|
227
|
+
await replay.execute(exportRequest, destinationValue ?? destination);
|
|
228
|
+
}
|
|
229
|
+
catch (caught) {
|
|
230
|
+
error = caught;
|
|
231
|
+
}
|
|
232
|
+
return { dockerCalls, error, exportCalls: blockedExportCalls };
|
|
233
|
+
};
|
|
234
|
+
const pendingExport = async () => {
|
|
235
|
+
const entry = (await journal.read()).entries.find((value) => value.operation === "export_evidence_volume" && value.state === "pending");
|
|
236
|
+
if (!entry)
|
|
237
|
+
throw new Error("pending export missing");
|
|
238
|
+
return entry;
|
|
239
|
+
};
|
|
240
|
+
const recoveryRequest = async (distinct = false) => {
|
|
241
|
+
const entry = await pendingExport();
|
|
242
|
+
return { ...envelope((await journal.read()).revision, distinct ? "idem_eeeeeeeeeeeeeeee" : "idem_dddddddddddddddd"), operation: "recover_operation", operation_handle: entry.operation_handle };
|
|
243
|
+
};
|
|
244
|
+
const recover = async (destinationValue) => operations.recover(await recoveryRequest(), destinationValue ?? destination);
|
|
245
|
+
const recoverDistinct = async (destinationValue) => operations.recover(await recoveryRequest(true), destinationValue ?? destination);
|
|
246
|
+
const recoverPeer = async (destinationValue) => createEvidenceExportOperations(operationOptions).recover(await recoveryRequest(), destinationValue ?? destination);
|
|
247
|
+
const seedStaleExportClaim = async () => {
|
|
248
|
+
const entry = await pendingExport();
|
|
249
|
+
const admission = await authorityStore.loadAdmission(entry.operation_handle);
|
|
250
|
+
if (await authorityStore.claimExport(admission) === null)
|
|
251
|
+
throw new Error("export claim unavailable");
|
|
252
|
+
};
|
|
253
|
+
const getContainerName = () => {
|
|
254
|
+
const create = calls.find((args) => args[2] === "container" && args[3] === "create");
|
|
255
|
+
if (!create)
|
|
256
|
+
return undefined;
|
|
257
|
+
const name = create[create.indexOf("--name") + 1];
|
|
258
|
+
return typeof name === "string" ? name : undefined;
|
|
259
|
+
};
|
|
260
|
+
return { calls, directory, execute, executeDistinct, executeReplayWithBlockedExecutors, rejectReplayWithWrongHelperRequest, recover, recoverDistinct, recoverPeer, seedStaleExportClaim, setHelperInspectionDrift: (value) => { helperInspectionDrift = value; }, setVolumeInspectionDrift: (value) => { volumeInspectionDrift = value; }, getContainerName, getExportCalls: () => exportCalls, getRemoveCalls: () => removeCalls, getRemoveArgs: () => [...removeCallArgs], getExportStorePath: () => path.join(directory, "export-store"), readJournalRevision: async () => (await journal.read()).revision };
|
|
261
|
+
};
|
|
262
|
+
export const helperProjection = (args, volumeName, imageLabels, mutate) => {
|
|
263
|
+
const image = args[args.length - 1];
|
|
264
|
+
const containerName = args[args.indexOf("--name") + 1];
|
|
265
|
+
const labels = Object.fromEntries(args.filter((_, index) => args[index - 1] === "--label").map((value) => value.split("=", 2)));
|
|
266
|
+
const projection = {
|
|
267
|
+
Name: `/${containerName}`,
|
|
268
|
+
Config: {
|
|
269
|
+
Entrypoint: EVIDENCE_EXPORT_HELPER_ENTRYPOINT,
|
|
270
|
+
Cmd: EVIDENCE_EXPORT_HELPER_CMD,
|
|
271
|
+
Env: null,
|
|
272
|
+
ExposedPorts: null,
|
|
273
|
+
Healthcheck: null,
|
|
274
|
+
Image: image,
|
|
275
|
+
Labels: { ...imageLabels, ...labels },
|
|
276
|
+
User: EVIDENCE_EXPORT_HELPER_USER,
|
|
277
|
+
Volumes: null
|
|
278
|
+
},
|
|
279
|
+
HostConfig: {
|
|
280
|
+
AutoRemove: false,
|
|
281
|
+
NetworkMode: "none",
|
|
282
|
+
ReadonlyRootfs: true,
|
|
283
|
+
Privileged: false,
|
|
284
|
+
CapAdd: null,
|
|
285
|
+
CapDrop: ["ALL"],
|
|
286
|
+
SecurityOpt: ["no-new-privileges=true"],
|
|
287
|
+
PidsLimit: 64,
|
|
288
|
+
Memory: 134217728,
|
|
289
|
+
NanoCpus: 250000000,
|
|
290
|
+
IpcMode: "none",
|
|
291
|
+
PidMode: "",
|
|
292
|
+
UTSMode: "",
|
|
293
|
+
UsernsMode: "",
|
|
294
|
+
CgroupnsMode: "private",
|
|
295
|
+
Binds: null,
|
|
296
|
+
VolumesFrom: null,
|
|
297
|
+
ExtraHosts: null,
|
|
298
|
+
Dns: null,
|
|
299
|
+
Links: null,
|
|
300
|
+
GroupAdd: null,
|
|
301
|
+
Devices: null,
|
|
302
|
+
DeviceRequests: null,
|
|
303
|
+
PortBindings: null,
|
|
304
|
+
PublishAllPorts: false,
|
|
305
|
+
RestartPolicy: { Name: "no", MaximumRetryCount: 0 },
|
|
306
|
+
LogConfig: { Type: "none", Config: {} }
|
|
307
|
+
},
|
|
308
|
+
Mounts: [{ Type: "volume", Name: volumeName, Destination: EVIDENCE_EXPORT_MOUNT, RW: false }]
|
|
309
|
+
};
|
|
310
|
+
mutate?.(projection);
|
|
311
|
+
return JSON.stringify([projection]);
|
|
312
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type OpaqueTargetHandle } from "./contracts.js";
|
|
2
|
+
export declare const EVIDENCE_EXPORT_ERROR = "Evidence-volume export failed";
|
|
3
|
+
export declare const EVIDENCE_EXPORT_MOUNT: "/spawnfile/evidence";
|
|
4
|
+
export declare const EVIDENCE_EXPORT_HELPER_CONTRACT: "spawnfile.target-evidence-export.helper.v1";
|
|
5
|
+
export declare const EVIDENCE_EXPORT_HELPER_CONTRACT_VERSION: "v1";
|
|
6
|
+
export declare const EVIDENCE_EXPORT_HELPER_CONTRACT_LABEL: "spawnfile.target.evidence-export.helper-contract";
|
|
7
|
+
export declare const EVIDENCE_EXPORT_HELPER_ENTRYPOINT: readonly string[];
|
|
8
|
+
export declare const EVIDENCE_EXPORT_HELPER_CMD: readonly string[];
|
|
9
|
+
export declare const EVIDENCE_EXPORT_HELPER_USER: "65534:65534";
|
|
10
|
+
export interface DockerEvidenceExportExecutor {
|
|
11
|
+
(file: string, args: readonly string[], options: {
|
|
12
|
+
readonly signal?: AbortSignal;
|
|
13
|
+
readonly timeout: number;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
readonly bytes: Uint8Array;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
export interface DockerEvidenceInspectionExecutor {
|
|
19
|
+
(file: string, args: string[], options: {
|
|
20
|
+
readonly signal?: AbortSignal;
|
|
21
|
+
readonly timeout: number;
|
|
22
|
+
}): Promise<{
|
|
23
|
+
readonly stderr: string;
|
|
24
|
+
readonly stdout: string;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
export interface EvidenceVolumeAuthority {
|
|
28
|
+
readonly labels: Readonly<Record<string, string>>;
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly resultHandle: OpaqueTargetHandle;
|
|
31
|
+
}
|
|
32
|
+
/** Resolved only from B91's private immutable artifact identity store. */
|
|
33
|
+
export interface EvidenceExportHelper {
|
|
34
|
+
readonly artifactManifestDigest: string;
|
|
35
|
+
readonly image_digest: string;
|
|
36
|
+
readonly image_reference: string;
|
|
37
|
+
readonly result_handle: OpaqueTargetHandle;
|
|
38
|
+
}
|
|
39
|
+
export interface EvidenceExportHelperImageInspection {
|
|
40
|
+
readonly labels: Readonly<Record<string, string>>;
|
|
41
|
+
}
|
|
42
|
+
export interface EvidenceExportHelperSpec {
|
|
43
|
+
readonly containerName: string;
|
|
44
|
+
readonly createArgs: readonly string[];
|
|
45
|
+
readonly imageLabels: Readonly<Record<string, string>>;
|
|
46
|
+
readonly imageReference: string;
|
|
47
|
+
readonly inspectionFormat: string;
|
|
48
|
+
}
|
|
49
|
+
export declare const createEvidenceExportHelper: (raw: {
|
|
50
|
+
artifactManifestDigest: unknown;
|
|
51
|
+
imageDigest: unknown;
|
|
52
|
+
imageReference: unknown;
|
|
53
|
+
resultHandle: unknown;
|
|
54
|
+
}) => EvidenceExportHelper;
|
|
55
|
+
export declare const parseEvidenceVolumeAuthority: (raw: unknown) => EvidenceVolumeAuthority;
|
|
56
|
+
export declare const createEvidenceExportHandle: (input: {
|
|
57
|
+
readonly evidenceVolumeHandle: unknown;
|
|
58
|
+
readonly operationHandle: unknown;
|
|
59
|
+
readonly requestDigest: unknown;
|
|
60
|
+
}) => OpaqueTargetHandle;
|
|
61
|
+
export declare const evidenceDigest: (bytes: Uint8Array) => `sha256:${string}`;
|
|
62
|
+
export declare const evidenceReceiptLabels: (authority: EvidenceVolumeAuthority) => Array<{
|
|
63
|
+
key: string;
|
|
64
|
+
value: string;
|
|
65
|
+
}>;
|
|
66
|
+
export declare const assertExportRun: (authority: EvidenceVolumeAuthority, input: {
|
|
67
|
+
readonly runId: unknown;
|
|
68
|
+
readonly selectedTargetHandle: unknown;
|
|
69
|
+
}) => void;
|
|
70
|
+
export declare const createEvidenceExportHelperSpec: (input: {
|
|
71
|
+
readonly authority: EvidenceVolumeAuthority;
|
|
72
|
+
readonly helper: EvidenceExportHelper;
|
|
73
|
+
readonly imageLabels: Readonly<Record<string, string>>;
|
|
74
|
+
readonly operationHandle: OpaqueTargetHandle;
|
|
75
|
+
readonly requestDigest: string;
|
|
76
|
+
}) => EvidenceExportHelperSpec;
|
|
77
|
+
export declare const parseEvidenceExportImageInspection: (stdout: string, helper: EvidenceExportHelper) => EvidenceExportHelperImageInspection;
|
|
78
|
+
export declare const isExpectedEvidenceExportImage: (stdout: string, helper: EvidenceExportHelper) => boolean;
|
|
79
|
+
export declare const isExpectedEvidenceExportHelper: (stdout: string, spec: EvidenceExportHelperSpec) => boolean;
|
|
80
|
+
export declare const executeEvidenceExport: (input: {
|
|
81
|
+
readonly args: readonly string[];
|
|
82
|
+
readonly executor: DockerEvidenceExportExecutor;
|
|
83
|
+
readonly signal?: AbortSignal;
|
|
84
|
+
readonly timeoutMs: number;
|
|
85
|
+
}) => Promise<Uint8Array>;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { parseOpaqueTargetHandle, parseRunId } from "./contracts.js";
|
|
4
|
+
import { isImmutableDockerImageReference } from "./dockerArtifactsProvider.js";
|
|
5
|
+
import { boundedRedactedText } from "../shared/index.js";
|
|
6
|
+
export const EVIDENCE_EXPORT_ERROR = "Evidence-volume export failed";
|
|
7
|
+
export const EVIDENCE_EXPORT_MOUNT = "/spawnfile/evidence";
|
|
8
|
+
export const EVIDENCE_EXPORT_HELPER_CONTRACT = "spawnfile.target-evidence-export.helper.v1";
|
|
9
|
+
export const EVIDENCE_EXPORT_HELPER_CONTRACT_VERSION = "v1";
|
|
10
|
+
export const EVIDENCE_EXPORT_HELPER_CONTRACT_LABEL = "spawnfile.target.evidence-export.helper-contract";
|
|
11
|
+
export const EVIDENCE_EXPORT_HELPER_ENTRYPOINT = Object.freeze(["/bin/spawnfile-export-helper"]);
|
|
12
|
+
export const EVIDENCE_EXPORT_HELPER_CMD = Object.freeze([]);
|
|
13
|
+
export const EVIDENCE_EXPORT_HELPER_USER = "65534:65534";
|
|
14
|
+
const DIGEST = /^sha256:[a-f0-9]{64}$/u;
|
|
15
|
+
const NAME = /^spfe_[a-f0-9]{58}$/u;
|
|
16
|
+
const MAX_OUTPUT_BYTES = 67_108_864;
|
|
17
|
+
const fail = (reason) => { throw new Error(`${EVIDENCE_EXPORT_ERROR}${reason === undefined ? "" : ` (${reason})`}`); };
|
|
18
|
+
const hash = (domain, value) => createHash("sha256").update(`spawnfile.target-evidence-export.${domain}.v1\0`).update(value).digest("hex");
|
|
19
|
+
const exact = (raw, keys) => raw !== null && typeof raw === "object" && !Array.isArray(raw) && Object.getPrototypeOf(raw) === Object.prototype && Object.keys(raw).sort().join("\0") === [...keys].sort().join("\0");
|
|
20
|
+
const record = (raw) => {
|
|
21
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw) || Object.getPrototypeOf(raw) !== Object.prototype)
|
|
22
|
+
return fail();
|
|
23
|
+
const value = raw;
|
|
24
|
+
const out = {};
|
|
25
|
+
for (const [key, candidate] of Object.entries(value)) {
|
|
26
|
+
if (!utf8(key) || typeof candidate !== "string" || !utf8(candidate))
|
|
27
|
+
return fail();
|
|
28
|
+
out[key] = candidate;
|
|
29
|
+
}
|
|
30
|
+
return Object.freeze(out);
|
|
31
|
+
};
|
|
32
|
+
const utf8 = (value) => typeof value === "string" && Buffer.from(value, "utf8").toString("utf8") === value && Buffer.byteLength(value, "utf8") <= 32_768;
|
|
33
|
+
const json = (raw) => { if (!utf8(raw))
|
|
34
|
+
return fail(); try {
|
|
35
|
+
return JSON.parse(raw);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return fail();
|
|
39
|
+
} };
|
|
40
|
+
export const createEvidenceExportHelper = (raw) => {
|
|
41
|
+
if (typeof raw.artifactManifestDigest !== "string" || !DIGEST.test(raw.artifactManifestDigest) || typeof raw.imageDigest !== "string" || !DIGEST.test(raw.imageDigest) || typeof raw.imageReference !== "string" || !isImmutableDockerImageReference(raw.imageReference) || !raw.imageReference.endsWith(`@${raw.imageDigest}`))
|
|
42
|
+
return fail();
|
|
43
|
+
return Object.freeze({ artifactManifestDigest: raw.artifactManifestDigest, image_digest: raw.imageDigest, image_reference: raw.imageReference, result_handle: parseOpaqueTargetHandle(raw.resultHandle) });
|
|
44
|
+
};
|
|
45
|
+
export const parseEvidenceVolumeAuthority = (raw) => {
|
|
46
|
+
if (!exact(raw, ["labels", "name", "resultHandle"]) || typeof raw.name !== "string" || !/^spfv_[a-f0-9]{58}$/u.test(raw.name) || !exact(raw.labels, ["spawnfile_resource_v1_kind", "spawnfile_resource_v1_operation", "spawnfile_resource_v1_run", "spawnfile_resource_v1_target", "spawnfile_resource_v1_version"]))
|
|
47
|
+
return fail();
|
|
48
|
+
const labels = raw.labels;
|
|
49
|
+
if (labels.spawnfile_resource_v1_kind !== "evidence_volume" || labels.spawnfile_resource_v1_version !== "v1" || Object.values(labels).some((value) => typeof value !== "string" || !/^[a-z][a-z0-9_-]{0,63}$/u.test(value)))
|
|
50
|
+
return fail();
|
|
51
|
+
return Object.freeze({ labels: Object.freeze({ ...labels }), name: raw.name, resultHandle: parseOpaqueTargetHandle(raw.resultHandle) });
|
|
52
|
+
};
|
|
53
|
+
export const createEvidenceExportHandle = (input) => {
|
|
54
|
+
if (typeof input.requestDigest !== "string" || !DIGEST.test(input.requestDigest))
|
|
55
|
+
return fail();
|
|
56
|
+
return parseOpaqueTargetHandle(`opaque_${hash("result", `${parseOpaqueTargetHandle(input.evidenceVolumeHandle)}\0${parseOpaqueTargetHandle(input.operationHandle)}\0${input.requestDigest}`)}`);
|
|
57
|
+
};
|
|
58
|
+
export const evidenceDigest = (bytes) => `sha256:${createHash("sha256").update(bytes).digest("hex")}`;
|
|
59
|
+
export const evidenceReceiptLabels = (authority) => Object.entries(parseEvidenceVolumeAuthority(authority).labels).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, value]) => ({ key, value }));
|
|
60
|
+
export const assertExportRun = (authority, input) => {
|
|
61
|
+
const parsed = parseEvidenceVolumeAuthority(authority);
|
|
62
|
+
const label = (prefix, value) => `${prefix}${createHash("sha256").update("spawnfile.target-resource.docker-resource-label.v1\0").update(value).digest("hex").slice(0, 63)}`;
|
|
63
|
+
if (parsed.labels.spawnfile_resource_v1_run !== label("r", parseRunId(input.runId)) || parsed.labels.spawnfile_resource_v1_target !== label("t", parseOpaqueTargetHandle(input.selectedTargetHandle)))
|
|
64
|
+
return fail();
|
|
65
|
+
};
|
|
66
|
+
export const createEvidenceExportHelperSpec = (input) => {
|
|
67
|
+
const authority = parseEvidenceVolumeAuthority(input.authority);
|
|
68
|
+
const helper = createEvidenceExportHelper({ artifactManifestDigest: input.helper.artifactManifestDigest, imageDigest: input.helper.image_digest, imageReference: input.helper.image_reference, resultHandle: input.helper.result_handle });
|
|
69
|
+
const imageLabels = record(input.imageLabels);
|
|
70
|
+
if (!exact(imageLabels, [EVIDENCE_EXPORT_HELPER_CONTRACT_LABEL]))
|
|
71
|
+
return fail();
|
|
72
|
+
if (imageLabels[EVIDENCE_EXPORT_HELPER_CONTRACT_LABEL] !== EVIDENCE_EXPORT_HELPER_CONTRACT_VERSION)
|
|
73
|
+
return fail();
|
|
74
|
+
if (!DIGEST.test(input.requestDigest))
|
|
75
|
+
return fail();
|
|
76
|
+
const containerName = `spfe_${hash("container", `${helper.result_handle}\0${input.operationHandle}\0${input.requestDigest}`).slice(0, 58)}`;
|
|
77
|
+
if (!NAME.test(containerName))
|
|
78
|
+
return fail();
|
|
79
|
+
const labels = [`spawnfile_evidence_export_v1_helper=${hash("label", helper.result_handle).slice(0, 63)}`, `spawnfile_evidence_export_v1_operation=${hash("label", `${input.operationHandle}\0${input.requestDigest}`).slice(0, 63)}`, "spawnfile_evidence_export_v1_version=v1"];
|
|
80
|
+
return Object.freeze({
|
|
81
|
+
containerName,
|
|
82
|
+
imageReference: helper.image_reference,
|
|
83
|
+
imageLabels,
|
|
84
|
+
inspectionFormat: "[{\"Name\":{{json .Name}},\"Config\":{\"Env\":{{json .Config.Env}},\"Entrypoint\":{{json .Config.Entrypoint}},\"Cmd\":{{json .Config.Cmd}},\"ExposedPorts\":{{json (index .Config \"ExposedPorts\")}},\"Healthcheck\":{{json (index .Config \"Healthcheck\")}},\"Image\":{{json .Config.Image}},\"Labels\":{{json .Config.Labels}},\"User\":{{json .Config.User}},\"Volumes\":{{json .Config.Volumes}}},\"HostConfig\":{\"AutoRemove\":{{json .HostConfig.AutoRemove}},\"NetworkMode\":{{json .HostConfig.NetworkMode}},\"ReadonlyRootfs\":{{json .HostConfig.ReadonlyRootfs}},\"Privileged\":{{json .HostConfig.Privileged}},\"CapAdd\":{{json .HostConfig.CapAdd}},\"CapDrop\":{{json .HostConfig.CapDrop}},\"SecurityOpt\":{{json .HostConfig.SecurityOpt}},\"PidsLimit\":{{json .HostConfig.PidsLimit}},\"Memory\":{{json .HostConfig.Memory}},\"NanoCpus\":{{json .HostConfig.NanoCpus}},\"IpcMode\":{{json .HostConfig.IpcMode}},\"PidMode\":{{json .HostConfig.PidMode}},\"UTSMode\":{{json .HostConfig.UTSMode}},\"UsernsMode\":{{json .HostConfig.UsernsMode}},\"CgroupnsMode\":{{json .HostConfig.CgroupnsMode}},\"Binds\":{{json .HostConfig.Binds}},\"VolumesFrom\":{{json .HostConfig.VolumesFrom}},\"ExtraHosts\":{{json .HostConfig.ExtraHosts}},\"Dns\":{{json .HostConfig.Dns}},\"Links\":{{json .HostConfig.Links}},\"GroupAdd\":{{json .HostConfig.GroupAdd}},\"Devices\":{{json .HostConfig.Devices}},\"DeviceRequests\":{{json .HostConfig.DeviceRequests}},\"PortBindings\":{{json .HostConfig.PortBindings}},\"PublishAllPorts\":{{json .HostConfig.PublishAllPorts}},\"RestartPolicy\":{{json .HostConfig.RestartPolicy}},\"LogConfig\":{{json .HostConfig.LogConfig}}},\"Mounts\":[{{range $index,$mount := .Mounts}}{{if $index}},{{end}}{\"Destination\":{{json $mount.Destination}},\"Name\":{{json $mount.Name}},\"RW\":{{json $mount.RW}},\"Type\":{{json $mount.Type}}}{{end}}]}]",
|
|
85
|
+
createArgs: Object.freeze(["container", "create", "--pull", "never", "--name", containerName, "--network", "none", "--restart", "no", "--privileged=false", "--log-driver", "none", "--read-only", "--cap-drop", "ALL", "--security-opt", "no-new-privileges=true", "--pids-limit", "64", "--memory", "128m", "--cpus", "0.25", "--ipc", "none", "--cgroupns", "private", "--label", labels[0], "--label", labels[1], "--label", labels[2], "--mount", `type=volume,src=${authority.name},dst=${EVIDENCE_EXPORT_MOUNT},readonly,volume-nocopy`, helper.image_reference])
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
export const parseEvidenceExportImageInspection = (stdout, helper) => {
|
|
89
|
+
const value = json(stdout);
|
|
90
|
+
const prepared = createEvidenceExportHelper({ artifactManifestDigest: helper.artifactManifestDigest, imageDigest: helper.image_digest, imageReference: helper.image_reference, resultHandle: helper.result_handle });
|
|
91
|
+
if (!Array.isArray(value) || value.length !== 1 || !exact(value[0], ["Config", "RepoDigests"]))
|
|
92
|
+
return fail();
|
|
93
|
+
const image = value[0];
|
|
94
|
+
if (!Array.isArray(image.RepoDigests) || image.RepoDigests.length < 1 || image.RepoDigests.length > 32 || image.RepoDigests.some((value) => !isImmutableDockerImageReference(value)))
|
|
95
|
+
return fail();
|
|
96
|
+
if (!exact(image.Config, ["Cmd", "Entrypoint", "Env", "ExposedPorts", "Healthcheck", "Labels", "User", "Volumes"]))
|
|
97
|
+
return fail();
|
|
98
|
+
const config = image.Config;
|
|
99
|
+
const labels = record(config.Labels);
|
|
100
|
+
if (!exact(labels, [EVIDENCE_EXPORT_HELPER_CONTRACT_LABEL]) || labels[EVIDENCE_EXPORT_HELPER_CONTRACT_LABEL] !== EVIDENCE_EXPORT_HELPER_CONTRACT_VERSION)
|
|
101
|
+
return fail();
|
|
102
|
+
if (!Array.isArray(config.Entrypoint) || JSON.stringify(config.Entrypoint) !== JSON.stringify(EVIDENCE_EXPORT_HELPER_ENTRYPOINT))
|
|
103
|
+
return fail();
|
|
104
|
+
if (config.Cmd !== null && !(Array.isArray(config.Cmd) && config.Cmd.length === 0))
|
|
105
|
+
return fail();
|
|
106
|
+
if (config.User !== EVIDENCE_EXPORT_HELPER_USER)
|
|
107
|
+
return fail();
|
|
108
|
+
if (config.Env !== null || config.ExposedPorts !== null || config.Healthcheck !== null || config.Volumes !== null)
|
|
109
|
+
return fail();
|
|
110
|
+
if (!image.RepoDigests.includes(prepared.image_reference))
|
|
111
|
+
return fail();
|
|
112
|
+
return { labels: Object.freeze({ ...labels }) };
|
|
113
|
+
};
|
|
114
|
+
export const isExpectedEvidenceExportImage = (stdout, helper) => {
|
|
115
|
+
try {
|
|
116
|
+
parseEvidenceExportImageInspection(stdout, helper);
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
export const isExpectedEvidenceExportHelper = (stdout, spec) => {
|
|
124
|
+
try {
|
|
125
|
+
const value = json(stdout);
|
|
126
|
+
if (!Array.isArray(value) || value.length !== 1 || !exact(value[0], ["Config", "HostConfig", "Mounts", "Name"]))
|
|
127
|
+
return false;
|
|
128
|
+
const item = value[0];
|
|
129
|
+
const config = item.Config;
|
|
130
|
+
const host = item.HostConfig;
|
|
131
|
+
const mounts = item.Mounts;
|
|
132
|
+
if (!exact(config, ["Cmd", "Entrypoint", "Env", "ExposedPorts", "Healthcheck", "Image", "Labels", "User", "Volumes"]) || !exact(host, ["AutoRemove", "Binds", "CapAdd", "CapDrop", "CgroupnsMode", "DeviceRequests", "Devices", "Dns", "ExtraHosts", "GroupAdd", "IpcMode", "Links", "LogConfig", "Memory", "NanoCpus", "NetworkMode", "PidMode", "PidsLimit", "PortBindings", "Privileged", "PublishAllPorts", "ReadonlyRootfs", "RestartPolicy", "SecurityOpt", "UTSMode", "UsernsMode", "VolumesFrom"]) || !Array.isArray(mounts) || mounts.length !== 1 || !exact(mounts[0], ["Destination", "Name", "RW", "Type"]))
|
|
133
|
+
return false;
|
|
134
|
+
const labels = spec.createArgs.filter((value, index) => spec.createArgs[index - 1] === "--label").map((value) => value.split("=", 2));
|
|
135
|
+
const runtimeLabels = Object.fromEntries(labels);
|
|
136
|
+
const expectedLabels = { ...spec.imageLabels, ...runtimeLabels };
|
|
137
|
+
const mounted = mounts[0];
|
|
138
|
+
const command = spec.createArgs[spec.createArgs.indexOf(spec.imageReference) + 1];
|
|
139
|
+
const cmd = config.Cmd;
|
|
140
|
+
return item.Name === `/${spec.containerName}` && config.Image === spec.imageReference
|
|
141
|
+
&& JSON.stringify(config.Entrypoint) === JSON.stringify(EVIDENCE_EXPORT_HELPER_ENTRYPOINT)
|
|
142
|
+
&& (cmd === null || (Array.isArray(cmd) && cmd.length === 0))
|
|
143
|
+
&& config.Env === null && config.ExposedPorts === null && config.Healthcheck === null && config.Volumes === null
|
|
144
|
+
&& config.User === EVIDENCE_EXPORT_HELPER_USER
|
|
145
|
+
&& exact(config.Labels, Object.keys(expectedLabels))
|
|
146
|
+
&& Object.entries(expectedLabels).every(([key, value]) => config.Labels !== null && config.Labels[key] === value)
|
|
147
|
+
&& command === undefined
|
|
148
|
+
&& host.AutoRemove === false && host.NetworkMode === "none" && host.ReadonlyRootfs === true
|
|
149
|
+
&& host.Privileged === false && JSON.stringify(host.CapAdd) === JSON.stringify(null)
|
|
150
|
+
&& JSON.stringify(host.CapDrop) === JSON.stringify(["ALL"]) && JSON.stringify(host.SecurityOpt) === JSON.stringify(["no-new-privileges=true"])
|
|
151
|
+
&& host.PidsLimit === 64 && host.Memory === 134217728 && host.NanoCpus === 250_000_000
|
|
152
|
+
&& host.IpcMode === "none" && host.PidMode === "" && host.UTSMode === ""
|
|
153
|
+
&& host.UsernsMode === "" && host.CgroupnsMode === "private"
|
|
154
|
+
&& [host.Binds, host.VolumesFrom, host.ExtraHosts, host.Dns, host.Links, host.GroupAdd, host.DeviceRequests].every((value) => value === null)
|
|
155
|
+
&& (host.Devices === null || Array.isArray(host.Devices) && host.Devices.length === 0)
|
|
156
|
+
&& (host.PortBindings === null || exact(host.PortBindings, []))
|
|
157
|
+
&& host.PublishAllPorts === false && exact(host.RestartPolicy, ["MaximumRetryCount", "Name"]) && host.RestartPolicy.Name === "no"
|
|
158
|
+
&& host.RestartPolicy.MaximumRetryCount === 0
|
|
159
|
+
&& exact(host.LogConfig, ["Config", "Type"]) && host.LogConfig.Type === "none"
|
|
160
|
+
&& JSON.stringify(host.LogConfig.Config) === JSON.stringify({})
|
|
161
|
+
&& mounted.Type === "volume" && mounted.Destination === EVIDENCE_EXPORT_MOUNT && mounted.RW === false
|
|
162
|
+
&& typeof mounted.Name === "string" && mounted.Name.length > 0
|
|
163
|
+
&& spec.createArgs.some((arg) => arg.startsWith(`type=volume,src=${mounted.Name},`));
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
export const executeEvidenceExport = async (input) => {
|
|
170
|
+
const argv = boundedRedactedText(input.args.join(" "));
|
|
171
|
+
let output;
|
|
172
|
+
try {
|
|
173
|
+
output = await input.executor("docker", input.args, { signal: input.signal, timeout: input.timeoutMs });
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
const name = error instanceof Error ? error.name : typeof error;
|
|
177
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
178
|
+
return fail(`thrown failure: ${name}: ${boundedRedactedText(message)}; docker argv: ${argv}`);
|
|
179
|
+
}
|
|
180
|
+
if (!output)
|
|
181
|
+
return fail(`shape failure: missing output; docker argv: ${argv}`);
|
|
182
|
+
if (!(output.bytes instanceof Uint8Array))
|
|
183
|
+
return fail(`shape failure: output.bytes is not a Uint8Array; docker argv: ${argv}`);
|
|
184
|
+
if (output.bytes.byteLength > MAX_OUTPUT_BYTES)
|
|
185
|
+
return fail(`shape failure: output.bytes exceeds MAX_OUTPUT_BYTES (${output.bytes.byteLength} bytes); docker argv: ${argv}`);
|
|
186
|
+
return new Uint8Array(output.bytes);
|
|
187
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface EvidenceExportPublicationOptions {
|
|
2
|
+
readonly beforeImmutableTempOpen?: (temporary: string) => Promise<void>;
|
|
3
|
+
readonly afterImmutableTempIdentity?: (temporary: string) => Promise<void>;
|
|
4
|
+
readonly afterImmutableFinalLinkBeforeTempUnlink?: () => Promise<void>;
|
|
5
|
+
readonly beforeDestinationKeyTempOpen?: (temporary: string) => Promise<void>;
|
|
6
|
+
readonly afterDestinationKeyTempIdentity?: (temporary: string) => Promise<void>;
|
|
7
|
+
readonly afterImmutableTransientRead?: () => Promise<void>;
|
|
8
|
+
readonly beforeDestinationKeyLink?: () => Promise<void>;
|
|
9
|
+
readonly afterDestinationKeyInitialFinalAbsent?: () => Promise<void>;
|
|
10
|
+
readonly afterDestinationKeyLinkBeforePendingUnlink?: () => Promise<void>;
|
|
11
|
+
readonly afterDestinationKeyPendingLinkBeforeTempUnlink?: () => Promise<void>;
|
|
12
|
+
readonly afterDestinationKeyPendingLstatBeforeOpen?: () => Promise<void>;
|
|
13
|
+
readonly afterDestinationKeyPendingLink?: () => Promise<void>;
|
|
14
|
+
readonly afterDestinationKeyRecovered?: () => Promise<void>;
|
|
15
|
+
readonly afterDestinationKeyFinalSnapshot?: () => Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|