@adea-ai/app-framework 0.0.0-stage → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +30 -0
- package/README.md +967 -2
- package/dist/app/application.d.ts +47 -0
- package/dist/app/application.js +115 -0
- package/dist/app/create-application.d.ts +13 -0
- package/dist/app/create-application.js +178 -0
- package/dist/app/service-registry.d.ts +44 -0
- package/dist/app/service-registry.js +116 -0
- package/dist/appearance/appearance-host.d.ts +62 -0
- package/dist/appearance/appearance-host.js +115 -0
- package/dist/appearance/appearance-preferences.d.ts +106 -0
- package/dist/appearance/appearance-preferences.js +175 -0
- package/dist/appearance/composition.d.ts +11 -0
- package/dist/appearance/composition.js +16 -0
- package/dist/appearance/custom-theme-import.d.ts +14 -0
- package/dist/appearance/custom-theme-import.js +315 -0
- package/dist/appearance/custom-theme-library.d.ts +146 -0
- package/dist/appearance/custom-theme-library.js +378 -0
- package/dist/appearance/editor.d.ts +20 -0
- package/dist/appearance/editor.js +47 -0
- package/dist/appearance/theme-file-importer.d.ts +23 -0
- package/dist/appearance/theme-file-importer.js +66 -0
- package/dist/appearance/theme-record-adapter.d.ts +26 -0
- package/dist/appearance/theme-record-adapter.js +64 -0
- package/dist/appearance/theme-registry.d.ts +10 -0
- package/dist/appearance/theme-registry.js +16 -0
- package/dist/appearance/window-surface.d.ts +5 -0
- package/dist/appearance/window-surface.js +9 -0
- package/dist/ci/toolchain-identity.d.ts +39 -0
- package/dist/ci/toolchain-identity.js +196 -0
- package/dist/cli/cef-helper-cli.d.ts +2 -0
- package/dist/cli/cef-helper-cli.js +18 -0
- package/dist/cli/cli-runner.d.ts +8 -0
- package/dist/cli/cli-runner.js +23 -0
- package/dist/cli/create-application-cli.d.ts +2 -0
- package/dist/cli/create-application-cli.js +40 -0
- package/dist/cli/electrobun-shortcut-patch-cli.d.ts +2 -0
- package/dist/cli/electrobun-shortcut-patch-cli.js +17 -0
- package/dist/cli/framework-update-cli.d.ts +2 -0
- package/dist/cli/framework-update-cli.js +40 -0
- package/dist/cli/release-assets-plan-cli.d.ts +2 -0
- package/dist/cli/release-assets-plan-cli.js +14 -0
- package/dist/cli/release-cut-cli.d.ts +2 -0
- package/dist/cli/release-cut-cli.js +27 -0
- package/dist/cli/release-descriptor-staging-cli.d.ts +2 -0
- package/dist/cli/release-descriptor-staging-cli.js +45 -0
- package/dist/cli/release-finalize-cli.d.ts +1 -0
- package/dist/cli/release-finalize-cli.js +30 -0
- package/dist/cli/release-promote-cli.d.ts +2 -0
- package/dist/cli/release-promote-cli.js +32 -0
- package/dist/cli/release-publish-cli.d.ts +2 -0
- package/dist/cli/release-publish-cli.js +48 -0
- package/dist/cli/release-sign-cli.d.ts +2 -0
- package/dist/cli/release-sign-cli.js +13 -0
- package/dist/cli/release-step-cli.d.ts +2 -0
- package/dist/cli/release-step-cli.js +44 -0
- package/dist/cli/toolchain-identity-cli.d.ts +2 -0
- package/dist/cli/toolchain-identity-cli.js +10 -0
- package/dist/cli/update-helper-cli.d.ts +1 -0
- package/dist/cli/update-helper-cli.js +10 -0
- package/dist/cli/windows-runtime-patch-cli.d.ts +2 -0
- package/dist/cli/windows-runtime-patch-cli.js +17 -0
- package/dist/desktop/application-command-client.d.ts +15 -0
- package/dist/desktop/application-command-client.js +21 -0
- package/dist/desktop/channel-handshake.d.ts +32 -0
- package/dist/desktop/channel-handshake.js +111 -0
- package/dist/desktop/channel-proof.d.ts +43 -0
- package/dist/desktop/channel-proof.js +85 -0
- package/dist/desktop/client-assets.d.ts +7 -0
- package/dist/desktop/client-assets.js +59 -0
- package/dist/desktop/desktop-client.d.ts +23 -0
- package/dist/desktop/desktop-client.js +231 -0
- package/dist/desktop/desktop-gateway.d.ts +18 -0
- package/dist/desktop/desktop-gateway.js +146 -0
- package/dist/desktop/desktop-host.d.ts +48 -0
- package/dist/desktop/desktop-host.js +208 -0
- package/dist/desktop/desktop-stream.d.ts +36 -0
- package/dist/desktop/desktop-stream.js +231 -0
- package/dist/desktop/loopback-policy.d.ts +19 -0
- package/dist/desktop/loopback-policy.js +23 -0
- package/dist/desktop/open-url-channel.d.ts +15 -0
- package/dist/desktop/open-url-channel.js +55 -0
- package/dist/desktop/string-policy.d.ts +2 -0
- package/dist/desktop/string-policy.js +11 -0
- package/dist/framework-source.json +1 -0
- package/dist/installer/archive-entry.d.ts +6 -0
- package/dist/installer/archive-entry.js +14 -0
- package/dist/installer/command-artifact.d.ts +47 -0
- package/dist/installer/command-artifact.js +261 -0
- package/dist/installer/command-qualification-command.d.ts +12 -0
- package/dist/installer/command-qualification-command.js +71 -0
- package/dist/installer/hosted-runner.d.ts +4 -0
- package/dist/installer/hosted-runner.js +10 -0
- package/dist/installer/installed-payload.d.ts +29 -0
- package/dist/installer/installed-payload.js +312 -0
- package/dist/installer/installer-ci-bootstrap.d.ts +26 -0
- package/dist/installer/installer-ci-bootstrap.js +160 -0
- package/dist/installer/installer-ci-preflight.d.ts +1 -0
- package/dist/installer/installer-ci-preflight.js +49 -0
- package/dist/installer/installer-ci-worker.d.ts +1 -0
- package/dist/installer/installer-ci-worker.js +105 -0
- package/dist/installer/installer-extraction.d.ts +14 -0
- package/dist/installer/installer-extraction.js +289 -0
- package/dist/installer/installer-fetch-guard.d.ts +15 -0
- package/dist/installer/installer-fetch-guard.js +50 -0
- package/dist/installer/installer-identity.d.ts +23 -0
- package/dist/installer/installer-identity.js +286 -0
- package/dist/installer/installer-layout.d.ts +21 -0
- package/dist/installer/installer-layout.js +89 -0
- package/dist/installer/installer-observation.d.ts +64 -0
- package/dist/installer/installer-observation.js +473 -0
- package/dist/installer/installer-process-cleanup.d.ts +18 -0
- package/dist/installer/installer-process-cleanup.js +158 -0
- package/dist/installer/installer-qualification-command.d.ts +11 -0
- package/dist/installer/installer-qualification-command.js +71 -0
- package/dist/installer/installer-renderer-evidence.d.ts +43 -0
- package/dist/installer/installer-renderer-evidence.js +136 -0
- package/dist/installer/installer-upgrade-command.d.ts +37 -0
- package/dist/installer/installer-upgrade-command.js +172 -0
- package/dist/installer/installer-worker-guard.d.ts +21 -0
- package/dist/installer/installer-worker-guard.js +72 -0
- package/dist/installer/native-executable.d.ts +5 -0
- package/dist/installer/native-executable.js +21 -0
- package/dist/installer/upgrade-asset-download.d.ts +13 -0
- package/dist/installer/upgrade-asset-download.js +41 -0
- package/dist/installer/write-all.d.ts +6 -0
- package/dist/installer/write-all.js +11 -0
- package/dist/native/app-bundle.d.ts +28 -0
- package/dist/native/app-bundle.js +60 -0
- package/dist/native/cef-helper.d.ts +28 -0
- package/dist/native/cef-helper.js +402 -0
- package/dist/native/desktop-build-hook.d.ts +7 -0
- package/dist/native/desktop-build-hook.js +20 -0
- package/dist/native/electrobun-source-patch.d.ts +25 -0
- package/dist/native/electrobun-source-patch.js +93 -0
- package/dist/native/linux-cef-links.d.ts +2 -0
- package/dist/native/linux-cef-links.js +15 -0
- package/dist/native/native-secret-store.d.ts +27 -0
- package/dist/native/native-secret-store.js +70 -0
- package/dist/native/native-utilities.d.ts +24 -0
- package/dist/native/native-utilities.js +85 -0
- package/dist/native/partitioned-window.d.ts +34 -0
- package/dist/native/partitioned-window.js +44 -0
- package/dist/native/renderer-profile.d.ts +53 -0
- package/dist/native/renderer-profile.js +30 -0
- package/dist/native/secure-window.d.ts +38 -0
- package/dist/native/secure-window.js +77 -0
- package/dist/native/sidecar-services.d.ts +23 -0
- package/dist/native/sidecar-services.js +46 -0
- package/dist/native/sidecar.d.ts +81 -0
- package/dist/native/sidecar.js +250 -0
- package/dist/native/window-bootstrap.d.ts +24 -0
- package/dist/native/window-bootstrap.js +63 -0
- package/dist/native/window-options.d.ts +32 -0
- package/dist/native/window-options.js +23 -0
- package/dist/native/windows-build-hook-internal.d.ts +2 -0
- package/dist/native/windows-build-hook-internal.js +32 -0
- package/dist/native/windows-build-hook.d.ts +2 -0
- package/dist/native/windows-build-hook.js +12 -0
- package/dist/native/windows-runtime-patch-internal.d.ts +3 -0
- package/dist/native/windows-runtime-patch-internal.js +20 -0
- package/dist/native/windows-runtime-patch.d.ts +4 -0
- package/dist/native/windows-runtime-patch.js +12 -0
- package/dist/release/feed-release-cut.d.ts +23 -0
- package/dist/release/feed-release-cut.js +93 -0
- package/dist/release/feed-state.d.ts +25 -0
- package/dist/release/feed-state.js +81 -0
- package/dist/release/framework-package-publish.d.ts +21 -0
- package/dist/release/framework-package-publish.js +125 -0
- package/dist/release/framework-update.d.ts +30 -0
- package/dist/release/framework-update.js +139 -0
- package/dist/release/github-cli.d.ts +6 -0
- package/dist/release/github-cli.js +16 -0
- package/dist/release/github-release-assets.d.ts +3 -0
- package/dist/release/github-release-assets.js +24 -0
- package/dist/release/github-release-cut.d.ts +14 -0
- package/dist/release/github-release-cut.js +174 -0
- package/dist/release/github-release-lookup.d.ts +7 -0
- package/dist/release/github-release-lookup.js +29 -0
- package/dist/release/github-release-promotion.d.ts +10 -0
- package/dist/release/github-release-promotion.js +78 -0
- package/dist/release/github-release-provenance.d.ts +9 -0
- package/dist/release/github-release-provenance.js +27 -0
- package/dist/release/github-release-publisher.d.ts +9 -0
- package/dist/release/github-release-publisher.js +63 -0
- package/dist/release/github-release-qualification.d.ts +12 -0
- package/dist/release/github-release-qualification.js +80 -0
- package/dist/release/local-provenance.d.ts +24 -0
- package/dist/release/local-provenance.js +72 -0
- package/dist/release/local-release.d.ts +133 -0
- package/dist/release/local-release.js +387 -0
- package/dist/release/macos-dmg.d.ts +22 -0
- package/dist/release/macos-dmg.js +91 -0
- package/dist/release/release-artifact.d.ts +6 -0
- package/dist/release/release-artifact.js +38 -0
- package/dist/release/release-assets-plan.d.ts +14 -0
- package/dist/release/release-assets-plan.js +65 -0
- package/dist/release/release-config.d.ts +76 -0
- package/dist/release/release-config.js +180 -0
- package/dist/release/release-cut-command.d.ts +13 -0
- package/dist/release/release-cut-command.js +39 -0
- package/dist/release/release-cut.d.ts +54 -0
- package/dist/release/release-cut.js +76 -0
- package/dist/release/release-descriptor-staging.d.ts +34 -0
- package/dist/release/release-descriptor-staging.js +147 -0
- package/dist/release/release-finalize.d.ts +16 -0
- package/dist/release/release-finalize.js +104 -0
- package/dist/release/release-promotion-command.d.ts +12 -0
- package/dist/release/release-promotion-command.js +28 -0
- package/dist/release/release-promotion.d.ts +29 -0
- package/dist/release/release-promotion.js +57 -0
- package/dist/release/release-publication.d.ts +33 -0
- package/dist/release/release-publication.js +138 -0
- package/dist/release/release-publish-command.d.ts +7 -0
- package/dist/release/release-publish-command.js +91 -0
- package/dist/release/release-qualification.d.ts +106 -0
- package/dist/release/release-qualification.js +135 -0
- package/dist/release/release-staging.d.ts +9 -0
- package/dist/release/release-staging.js +61 -0
- package/dist/release/release-steps.d.ts +38 -0
- package/dist/release/release-steps.js +147 -0
- package/dist/release/retained-release-build.d.ts +19 -0
- package/dist/release/retained-release-build.js +122 -0
- package/dist/shell/app-shell.d.ts +61 -0
- package/dist/shell/app-shell.js +318 -0
- package/dist/shell/app-utilities.d.ts +122 -0
- package/dist/shell/app-utilities.js +334 -0
- package/dist/shell/application-menu-commands.d.ts +5 -0
- package/dist/shell/application-menu-commands.js +11 -0
- package/dist/shell/application-menu.d.ts +61 -0
- package/dist/shell/application-menu.js +208 -0
- package/dist/shell/help-shortcuts.d.ts +12 -0
- package/dist/shell/help-shortcuts.js +22 -0
- package/dist/shell/settings-sections.d.ts +31 -0
- package/dist/shell/settings-sections.js +50 -0
- package/dist/shell/shortcut-platform.d.ts +17 -0
- package/dist/shell/shortcut-platform.js +25 -0
- package/dist/update-helper.bundle.js +260 -0
- package/dist/updates/channel-update-manager.d.ts +46 -0
- package/dist/updates/channel-update-manager.js +114 -0
- package/dist/updates/desktop-updater.d.ts +104 -0
- package/dist/updates/desktop-updater.js +345 -0
- package/dist/updates/release-feed.d.ts +61 -0
- package/dist/updates/release-feed.js +111 -0
- package/dist/updates/release-location.d.ts +9 -0
- package/dist/updates/release-location.js +80 -0
- package/dist/updates/release-version.d.ts +12 -0
- package/dist/updates/release-version.js +43 -0
- package/dist/updates/signed-release.d.ts +63 -0
- package/dist/updates/signed-release.js +162 -0
- package/dist/updates/stable-file.d.ts +10 -0
- package/dist/updates/stable-file.js +22 -0
- package/dist/updates/update-adapter.d.ts +57 -0
- package/dist/updates/update-adapter.js +72 -0
- package/dist/updates/update-arm.d.ts +24 -0
- package/dist/updates/update-arm.js +95 -0
- package/dist/updates/update-channel-store.d.ts +8 -0
- package/dist/updates/update-channel-store.js +72 -0
- package/dist/updates/update-discovery.d.ts +13 -0
- package/dist/updates/update-discovery.js +56 -0
- package/dist/updates/update-download.d.ts +14 -0
- package/dist/updates/update-download.js +67 -0
- package/dist/updates/update-exclusive-rename.d.ts +2 -0
- package/dist/updates/update-exclusive-rename.js +52 -0
- package/dist/updates/update-extraction.d.ts +18 -0
- package/dist/updates/update-extraction.js +183 -0
- package/dist/updates/update-handoff-plan.d.ts +22 -0
- package/dist/updates/update-handoff-plan.js +28 -0
- package/dist/updates/update-helper.d.ts +24 -0
- package/dist/updates/update-helper.js +56 -0
- package/dist/updates/update-launch.d.ts +5 -0
- package/dist/updates/update-launch.js +27 -0
- package/dist/updates/update-manager.d.ts +40 -0
- package/dist/updates/update-manager.js +83 -0
- package/dist/updates/update-process-fence.d.ts +10 -0
- package/dist/updates/update-process-fence.js +114 -0
- package/dist/updates/update-resume.d.ts +13 -0
- package/dist/updates/update-resume.js +34 -0
- package/dist/updates/update-shutdown.d.ts +15 -0
- package/dist/updates/update-shutdown.js +29 -0
- package/dist/updates/update-state.d.ts +30 -0
- package/dist/updates/update-state.js +18 -0
- package/dist/updates/update-swap-stage.d.ts +27 -0
- package/dist/updates/update-swap-stage.js +58 -0
- package/dist/updates/update-swap.d.ts +10 -0
- package/dist/updates/update-swap.js +30 -0
- package/dist/views/app-about.d.ts +22 -0
- package/dist/views/app-about.js +43 -0
- package/dist/views/app-appearance.d.ts +11 -0
- package/dist/views/app-appearance.js +42 -0
- package/dist/views/app-help.d.ts +17 -0
- package/dist/views/app-help.js +42 -0
- package/dist/views/app-settings.d.ts +26 -0
- package/dist/views/app-settings.js +97 -0
- package/dist/views/appearance-surface.d.ts +9 -0
- package/dist/views/appearance-surface.js +334 -0
- package/dist/views/update-surface.d.ts +34 -0
- package/dist/views/update-surface.js +64 -0
- package/package.json +363 -4
- package/src/app/application.tsx +138 -0
- package/src/app/create-application.ts +245 -0
- package/src/app/service-registry.ts +124 -0
- package/src/appearance/appearance-host.tsx +205 -0
- package/src/appearance/appearance-preferences.ts +287 -0
- package/src/appearance/composition.ts +29 -0
- package/src/appearance/custom-theme-import.ts +424 -0
- package/src/appearance/custom-theme-library.ts +600 -0
- package/src/appearance/editor.ts +94 -0
- package/src/appearance/theme-file-importer.ts +103 -0
- package/src/appearance/theme-record-adapter.ts +106 -0
- package/src/appearance/theme-registry.ts +20 -0
- package/src/appearance/window-surface.ts +18 -0
- package/src/ci/toolchain-identity.ts +244 -0
- package/src/cli/cef-helper-cli.ts +21 -0
- package/src/cli/cli-runner.ts +29 -0
- package/src/cli/create-application-cli.ts +62 -0
- package/src/cli/electrobun-shortcut-patch-cli.ts +24 -0
- package/src/cli/framework-update-cli.ts +41 -0
- package/src/cli/release-assets-plan-cli.ts +14 -0
- package/src/cli/release-cut-cli.ts +41 -0
- package/src/cli/release-descriptor-staging-cli.ts +57 -0
- package/src/cli/release-finalize-cli.ts +34 -0
- package/src/cli/release-promote-cli.ts +31 -0
- package/src/cli/release-publish-cli.ts +46 -0
- package/src/cli/release-sign-cli.ts +24 -0
- package/src/cli/release-step-cli.ts +71 -0
- package/src/cli/toolchain-identity-cli.ts +12 -0
- package/src/cli/update-helper-cli.ts +12 -0
- package/src/cli/windows-runtime-patch-cli.ts +17 -0
- package/src/desktop/application-command-client.ts +43 -0
- package/src/desktop/channel-handshake.ts +136 -0
- package/src/desktop/channel-proof.ts +122 -0
- package/src/desktop/client-assets.ts +75 -0
- package/src/desktop/desktop-client.ts +303 -0
- package/src/desktop/desktop-gateway.ts +189 -0
- package/src/desktop/desktop-host.ts +335 -0
- package/src/desktop/desktop-stream.ts +324 -0
- package/src/desktop/loopback-policy.ts +41 -0
- package/src/desktop/open-url-channel.ts +79 -0
- package/src/desktop/string-policy.ts +9 -0
- package/src/installer/archive-entry.ts +32 -0
- package/src/installer/command-artifact.ts +307 -0
- package/src/installer/command-qualification-command.ts +75 -0
- package/src/installer/hosted-runner.ts +11 -0
- package/src/installer/installed-payload.ts +408 -0
- package/src/installer/installer-ci-bootstrap.ts +199 -0
- package/src/installer/installer-ci-preflight.ts +61 -0
- package/src/installer/installer-ci-worker.ts +105 -0
- package/src/installer/installer-extraction.ts +367 -0
- package/src/installer/installer-fetch-guard.ts +75 -0
- package/src/installer/installer-identity.ts +331 -0
- package/src/installer/installer-layout.ts +167 -0
- package/src/installer/installer-observation.ts +671 -0
- package/src/installer/installer-process-cleanup.ts +167 -0
- package/src/installer/installer-qualification-command.ts +81 -0
- package/src/installer/installer-renderer-evidence.ts +268 -0
- package/src/installer/installer-upgrade-command.ts +226 -0
- package/src/installer/installer-worker-guard.ts +112 -0
- package/src/installer/native-executable.ts +37 -0
- package/src/installer/upgrade-asset-download.ts +72 -0
- package/src/installer/write-all.ts +19 -0
- package/src/native/app-bundle.ts +86 -0
- package/src/native/cef-helper.ts +471 -0
- package/src/native/desktop-build-hook.ts +21 -0
- package/src/native/electrobun-cef-main-frame-bridges.patch +63 -0
- package/src/native/electrobun-source-patch.ts +107 -0
- package/src/native/electrobun-windows-shortcut-com.patch +923 -0
- package/src/native/linux-cef-links.ts +14 -0
- package/src/native/native-secret-store.ts +99 -0
- package/src/native/native-utilities.ts +166 -0
- package/src/native/partitioned-window.ts +62 -0
- package/src/native/renderer-profile.ts +27 -0
- package/src/native/secure-window.ts +115 -0
- package/src/native/sidecar-services.ts +71 -0
- package/src/native/sidecar.ts +387 -0
- package/src/native/window-bootstrap.ts +77 -0
- package/src/native/window-options.ts +24 -0
- package/src/native/windows-build-hook-internal.ts +49 -0
- package/src/native/windows-build-hook.ts +12 -0
- package/src/native/windows-runtime-patch-internal.ts +48 -0
- package/src/native/windows-runtime-patch.ts +15 -0
- package/src/release/feed-release-cut.ts +110 -0
- package/src/release/feed-state.ts +135 -0
- package/src/release/framework-package-publish.ts +163 -0
- package/src/release/framework-update.ts +196 -0
- package/src/release/github-cli.ts +27 -0
- package/src/release/github-release-assets.ts +36 -0
- package/src/release/github-release-cut.ts +237 -0
- package/src/release/github-release-lookup.ts +39 -0
- package/src/release/github-release-promotion.ts +112 -0
- package/src/release/github-release-provenance.ts +65 -0
- package/src/release/github-release-publisher.ts +90 -0
- package/src/release/github-release-qualification.ts +144 -0
- package/src/release/local-provenance.ts +92 -0
- package/src/release/local-release.ts +525 -0
- package/src/release/macos-dmg.ts +113 -0
- package/src/release/release-artifact.ts +53 -0
- package/src/release/release-assets-plan.ts +118 -0
- package/src/release/release-config.ts +420 -0
- package/src/release/release-cut-command.ts +80 -0
- package/src/release/release-cut.ts +133 -0
- package/src/release/release-descriptor-staging.ts +242 -0
- package/src/release/release-finalize.ts +191 -0
- package/src/release/release-promotion-command.ts +36 -0
- package/src/release/release-promotion.ts +132 -0
- package/src/release/release-publication.ts +213 -0
- package/src/release/release-publish-command.ts +163 -0
- package/src/release/release-qualification.ts +397 -0
- package/src/release/release-staging.ts +87 -0
- package/src/release/release-steps.ts +173 -0
- package/src/release/retained-release-build.ts +217 -0
- package/src/shell/app-shell.tsx +285 -0
- package/src/shell/app-utilities.tsx +437 -0
- package/src/shell/application-menu-commands.ts +6 -0
- package/src/shell/application-menu.ts +250 -0
- package/src/shell/help-shortcuts.ts +24 -0
- package/src/shell/settings-sections.ts +74 -0
- package/src/shell/shortcut-platform.ts +35 -0
- package/src/updates/channel-update-manager.ts +127 -0
- package/src/updates/desktop-updater.ts +440 -0
- package/src/updates/release-feed.ts +187 -0
- package/src/updates/release-location.ts +101 -0
- package/src/updates/release-version.ts +57 -0
- package/src/updates/signed-release.ts +311 -0
- package/src/updates/stable-file.ts +32 -0
- package/src/updates/update-adapter.ts +129 -0
- package/src/updates/update-arm.ts +107 -0
- package/src/updates/update-channel-store.ts +86 -0
- package/src/updates/update-discovery.ts +113 -0
- package/src/updates/update-download.ts +82 -0
- package/src/updates/update-exclusive-rename.ts +58 -0
- package/src/updates/update-extraction.ts +261 -0
- package/src/updates/update-handoff-plan.ts +75 -0
- package/src/updates/update-helper.ts +87 -0
- package/src/updates/update-launch.ts +33 -0
- package/src/updates/update-manager.ts +130 -0
- package/src/updates/update-process-fence.ts +125 -0
- package/src/updates/update-resume.ts +34 -0
- package/src/updates/update-shutdown.ts +37 -0
- package/src/updates/update-state.ts +34 -0
- package/src/updates/update-swap-stage.ts +75 -0
- package/src/updates/update-swap.ts +30 -0
- package/src/views/app-about.tsx +44 -0
- package/src/views/app-appearance.tsx +32 -0
- package/src/views/app-help.tsx +43 -0
- package/src/views/app-settings.tsx +88 -0
- package/src/views/appearance-surface.tsx +427 -0
- package/src/views/update-surface.tsx +85 -0
- package/templates/application/.gitattributes +1 -0
- package/templates/application/.github/workflows/release-assets.yml +29 -0
- package/templates/application/.github/workflows/release-finalize.yml +29 -0
- package/templates/application/.github/workflows/release-please.yml +19 -0
- package/templates/application/.github/workflows/release.yml +29 -0
- package/templates/application/.github/workflows/validation.yml +28 -0
- package/templates/application/.oxfmtrc.json +6 -0
- package/templates/application/.oxlintrc.json +48 -0
- package/templates/application/.release-please-manifest.json +3 -0
- package/templates/application/README.md +47 -0
- package/templates/application/electrobun.config.ts +22 -0
- package/templates/application/release-please-config.json +12 -0
- package/templates/application/scripts/app-version.ts +9 -0
- package/templates/application/scripts/build-desktop.ts +34 -0
- package/templates/application/scripts/secure-build.ts +1 -0
- package/templates/application/scripts/stage-release.ts +21 -0
- package/templates/application/src/bun/index.ts +80 -0
- package/templates/application/src/electrobun.d.ts +27 -0
- package/templates/application/src/web/index.html +12 -0
- package/templates/application/src/web/main.tsx +97 -0
- package/templates/application/src/web/public/icon.svg +1 -0
- package/templates/application/src/web/style.css +3 -0
- package/templates/application/tests/app-config.test.ts +9 -0
- package/templates/application/tsconfig.json +15 -0
- package/templates/application/vite.config.ts +10 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// External worker guard for a disposable hosted runner. Never imported by the app bundle.
|
|
2
|
+
// Loaded as the Bun preload (main thread), it redirects the app's one worker to this file.
|
|
3
|
+
// Running as that worker, it installs the fetch guard and renderer probe, waits for the
|
|
4
|
+
// runner's permit and only then imports the installed app entry.
|
|
5
|
+
import { writeFileSync } from 'node:fs'
|
|
6
|
+
import { isAbsolute } from 'node:path'
|
|
7
|
+
import { fileURLToPath } from 'node:url'
|
|
8
|
+
import { installInstallerFetchGuard } from './installer-fetch-guard'
|
|
9
|
+
import { installInstallerRendererProbe } from './installer-renderer-evidence'
|
|
10
|
+
import { parseOfflinePolicy } from '../release/release-qualification'
|
|
11
|
+
import { awaitInstallerWorkerPermit, interceptInstallerWorker } from './installer-worker-guard'
|
|
12
|
+
|
|
13
|
+
if (Bun.isMainThread) {
|
|
14
|
+
const entry = process.env.FRAMEWORK_CI_WORKER_ENTRY
|
|
15
|
+
if (!entry) throw new Error('Missing installer CI preload context')
|
|
16
|
+
interceptInstallerWorker({
|
|
17
|
+
env: process.env,
|
|
18
|
+
globals: globalThis,
|
|
19
|
+
entry,
|
|
20
|
+
bootstrap: fileURLToPath(import.meta.url),
|
|
21
|
+
})
|
|
22
|
+
} else await runGuardedWorker()
|
|
23
|
+
|
|
24
|
+
async function runGuardedWorker(): Promise<void> {
|
|
25
|
+
const env = process.env
|
|
26
|
+
const {
|
|
27
|
+
FRAMEWORK_CI_WORKER_ENTRY: entry,
|
|
28
|
+
FRAMEWORK_CI_NONCE: nonce,
|
|
29
|
+
FRAMEWORK_CI_ACK: acknowledgement,
|
|
30
|
+
FRAMEWORK_CI_PERMIT: permit,
|
|
31
|
+
FRAMEWORK_CI_ORIGIN: origin,
|
|
32
|
+
FRAMEWORK_CI_OBSERVATION: observation,
|
|
33
|
+
FRAMEWORK_CI_UNEXPECTED: unexpected,
|
|
34
|
+
FRAMEWORK_CI_PID: pidRecord,
|
|
35
|
+
} = env
|
|
36
|
+
if (
|
|
37
|
+
(pidRecord !== undefined &&
|
|
38
|
+
(!isAbsolute(pidRecord) ||
|
|
39
|
+
[entry, acknowledgement, permit, observation, unexpected].includes(pidRecord))) ||
|
|
40
|
+
![entry, acknowledgement, permit, observation, unexpected].every(
|
|
41
|
+
(value) => typeof value === 'string' && isAbsolute(value)
|
|
42
|
+
) ||
|
|
43
|
+
!nonce ||
|
|
44
|
+
!origin ||
|
|
45
|
+
new Set([acknowledgement, permit, observation, unexpected]).size !== 4
|
|
46
|
+
)
|
|
47
|
+
throw new Error('Invalid installer CI worker context')
|
|
48
|
+
const encoded = env.FRAMEWORK_CI_EXPECTED_READS ?? '[]'
|
|
49
|
+
if (encoded.length > 8192) throw new Error('Invalid expected reads')
|
|
50
|
+
const expectedReads: unknown = JSON.parse(encoded)
|
|
51
|
+
const offlineEncoded = env.FRAMEWORK_CI_OFFLINE_POLICY
|
|
52
|
+
if (offlineEncoded && offlineEncoded.length > 2048) throw new Error('Invalid offline policy')
|
|
53
|
+
const offlinePolicy = offlineEncoded ? parseOfflinePolicy(JSON.parse(offlineEncoded)) : undefined
|
|
54
|
+
if (!Array.isArray(expectedReads) || expectedReads.some((value) => typeof value !== 'string'))
|
|
55
|
+
throw new Error('Invalid expected reads')
|
|
56
|
+
let recordedUnexpected = false
|
|
57
|
+
const guard = installInstallerFetchGuard({
|
|
58
|
+
env,
|
|
59
|
+
globals: globalThis,
|
|
60
|
+
origin,
|
|
61
|
+
expectedReads,
|
|
62
|
+
onUnexpected: () => {
|
|
63
|
+
if (!recordedUnexpected) {
|
|
64
|
+
writeFileSync(unexpected!, nonce + '\n', { flag: 'wx', mode: 0o600 })
|
|
65
|
+
recordedUnexpected = true
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
})
|
|
69
|
+
if (!['0', '1', undefined].includes(env.FRAMEWORK_CI_ALLOW_EPHEMERAL))
|
|
70
|
+
throw new Error('Invalid listener selection')
|
|
71
|
+
installInstallerRendererProbe({
|
|
72
|
+
env,
|
|
73
|
+
origin,
|
|
74
|
+
nonce,
|
|
75
|
+
allowEphemeral: env.FRAMEWORK_CI_ALLOW_EPHEMERAL === '1',
|
|
76
|
+
offlinePolicy,
|
|
77
|
+
foreignOrigin: env.FRAMEWORK_CI_FOREIGN_ORIGIN,
|
|
78
|
+
runtime: Bun,
|
|
79
|
+
save: (value, state) => {
|
|
80
|
+
writeFileSync(
|
|
81
|
+
observation!,
|
|
82
|
+
JSON.stringify({
|
|
83
|
+
nonce,
|
|
84
|
+
origin,
|
|
85
|
+
...value,
|
|
86
|
+
blockedReads: guard.blockedReads,
|
|
87
|
+
unexpectedActivity: guard.unexpectedActivity,
|
|
88
|
+
...(offlinePolicy ? { offlinePolicy, bootstrapDenied: state.bootstrapDenied } : {}),
|
|
89
|
+
}) + '\n',
|
|
90
|
+
{ flag: 'wx', mode: 0o600 }
|
|
91
|
+
)
|
|
92
|
+
},
|
|
93
|
+
})
|
|
94
|
+
if (pidRecord)
|
|
95
|
+
writeFileSync(pidRecord, nonce + '\n' + process.pid + '\n', { flag: 'wx', mode: 0o600 })
|
|
96
|
+
const verifiedEntry = await awaitInstallerWorkerPermit({
|
|
97
|
+
env,
|
|
98
|
+
globals: globalThis,
|
|
99
|
+
entry: entry!,
|
|
100
|
+
nonce,
|
|
101
|
+
acknowledgement: acknowledgement!,
|
|
102
|
+
permit: permit!,
|
|
103
|
+
})
|
|
104
|
+
await import(verifiedEntry)
|
|
105
|
+
}
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto'
|
|
2
|
+
import { assertNativeExecutable } from './native-executable'
|
|
3
|
+
import { chmod, lstat, mkdir, mkdtemp, open, readdir, realpath, rm } from 'node:fs/promises'
|
|
4
|
+
import { isAbsolute, join, relative, resolve, sep, win32 } from 'node:path'
|
|
5
|
+
import {
|
|
6
|
+
assertInstallerContext,
|
|
7
|
+
assertInstallerLayout,
|
|
8
|
+
assertPortableAppName,
|
|
9
|
+
type InstallerPlatform,
|
|
10
|
+
} from './installer-layout'
|
|
11
|
+
import { verifyInstallerPayload } from './installer-identity'
|
|
12
|
+
|
|
13
|
+
async function run(cmd: string[], env: Record<string, string>): Promise<string> {
|
|
14
|
+
const child = Bun.spawn({
|
|
15
|
+
cmd,
|
|
16
|
+
env,
|
|
17
|
+
stdout: 'pipe',
|
|
18
|
+
stderr: 'pipe',
|
|
19
|
+
signal: AbortSignal.timeout(120000),
|
|
20
|
+
})
|
|
21
|
+
const output = (async () => {
|
|
22
|
+
const chunks: Uint8Array[] = []
|
|
23
|
+
let size = 0
|
|
24
|
+
for await (const chunk of child.stdout) {
|
|
25
|
+
size += chunk.length
|
|
26
|
+
if (size > 8 * 1024 * 1024) {
|
|
27
|
+
child.kill()
|
|
28
|
+
throw new Error('Installer command output exceeds bound')
|
|
29
|
+
}
|
|
30
|
+
chunks.push(chunk)
|
|
31
|
+
}
|
|
32
|
+
return Buffer.concat(chunks).toString('utf8')
|
|
33
|
+
})()
|
|
34
|
+
const errors = (async () => {
|
|
35
|
+
for await (const _chunk of child.stderr) {
|
|
36
|
+
/* Drain without logging untrusted output. */
|
|
37
|
+
}
|
|
38
|
+
})()
|
|
39
|
+
const [text, , status] = await Promise.all([output, errors, child.exited])
|
|
40
|
+
if (status !== 0) throw new Error('Installer preparation command failed')
|
|
41
|
+
return text
|
|
42
|
+
}
|
|
43
|
+
async function extract(
|
|
44
|
+
tar: string,
|
|
45
|
+
archive: string,
|
|
46
|
+
member: string,
|
|
47
|
+
destination: string,
|
|
48
|
+
maximum: number,
|
|
49
|
+
env: Record<string, string>
|
|
50
|
+
): Promise<void> {
|
|
51
|
+
const output = await open(destination, 'wx', 0o600)
|
|
52
|
+
const spawn = () =>
|
|
53
|
+
Bun.spawn({
|
|
54
|
+
cmd: [tar, '-xOf', archive, member],
|
|
55
|
+
env,
|
|
56
|
+
stdout: 'pipe',
|
|
57
|
+
stderr: 'pipe',
|
|
58
|
+
signal: AbortSignal.timeout(120000),
|
|
59
|
+
})
|
|
60
|
+
try {
|
|
61
|
+
const child = spawn()
|
|
62
|
+
const errors = (async () => {
|
|
63
|
+
for await (const _chunk of child.stderr) {
|
|
64
|
+
/* Drain silently. */
|
|
65
|
+
}
|
|
66
|
+
})()
|
|
67
|
+
let count = 0
|
|
68
|
+
try {
|
|
69
|
+
for await (const chunk of child.stdout) {
|
|
70
|
+
count += chunk.length
|
|
71
|
+
if (!Number.isSafeInteger(count) || count > maximum)
|
|
72
|
+
throw new Error('Installer member exceeds bound')
|
|
73
|
+
let offset = 0
|
|
74
|
+
while (offset < chunk.length) {
|
|
75
|
+
const result = await output.write(chunk, offset, chunk.length - offset)
|
|
76
|
+
if (!result.bytesWritten) throw new Error('Cannot copy installer member')
|
|
77
|
+
offset += result.bytesWritten
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if ((await child.exited) !== 0 || count === 0) throw new Error('Cannot copy installer member')
|
|
81
|
+
await errors
|
|
82
|
+
} catch (error) {
|
|
83
|
+
child.kill()
|
|
84
|
+
await child.exited
|
|
85
|
+
await errors
|
|
86
|
+
throw error
|
|
87
|
+
}
|
|
88
|
+
} finally {
|
|
89
|
+
await output.close()
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async function digest(path: string): Promise<{ size: number; digest: string }> {
|
|
93
|
+
const info = await lstat(path)
|
|
94
|
+
if (!info.isFile() || info.isSymbolicLink() || !Number.isSafeInteger(info.size) || info.size < 1)
|
|
95
|
+
throw new Error('Invalid extracted file')
|
|
96
|
+
const file = await open(path, 'r')
|
|
97
|
+
try {
|
|
98
|
+
const before = await file.stat()
|
|
99
|
+
if (before.dev !== info.dev || before.ino !== info.ino || before.size !== info.size)
|
|
100
|
+
throw new Error('Extracted file changed')
|
|
101
|
+
const hash = createHash('sha256')
|
|
102
|
+
let size = 0
|
|
103
|
+
for await (const chunk of file.createReadStream({ autoClose: false })) {
|
|
104
|
+
size += chunk.length
|
|
105
|
+
if (size > before.size) throw new Error('Extracted file changed')
|
|
106
|
+
hash.update(chunk)
|
|
107
|
+
}
|
|
108
|
+
const after = await file.stat()
|
|
109
|
+
if (
|
|
110
|
+
size !== before.size ||
|
|
111
|
+
after.size !== before.size ||
|
|
112
|
+
after.mtimeMs !== before.mtimeMs ||
|
|
113
|
+
after.ino !== before.ino ||
|
|
114
|
+
after.dev !== before.dev
|
|
115
|
+
)
|
|
116
|
+
throw new Error('Extracted file changed')
|
|
117
|
+
return { size, digest: 'sha256:' + hash.digest('hex') }
|
|
118
|
+
} finally {
|
|
119
|
+
await file.close()
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function normalizeArchiveMember(name: string): string {
|
|
124
|
+
return name.replace(/^\.\//, '').replaceAll('\\', '/')
|
|
125
|
+
}
|
|
126
|
+
async function assertExecutable(path: string, platform: InstallerPlatform): Promise<void> {
|
|
127
|
+
const info = await lstat(path)
|
|
128
|
+
if (!info.isFile() || info.isSymbolicLink() || info.size < 4096)
|
|
129
|
+
throw new Error('Invalid copied installer executable')
|
|
130
|
+
const file = await open(path, 'r')
|
|
131
|
+
try {
|
|
132
|
+
await assertNativeExecutable(file, info.size, platform, 'installer executable')
|
|
133
|
+
} finally {
|
|
134
|
+
await file.close()
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async function assertLinuxEmbedded(
|
|
138
|
+
path: string,
|
|
139
|
+
archive: { size: number; digest: string }
|
|
140
|
+
): Promise<void> {
|
|
141
|
+
const info = await lstat(path),
|
|
142
|
+
marker = Buffer.from('ELECTROBUN_ARCHIVE_V1')
|
|
143
|
+
if (info.size <= archive.size + marker.length)
|
|
144
|
+
throw new Error('Copied installer archive is incomplete')
|
|
145
|
+
const file = await open(path, 'r')
|
|
146
|
+
try {
|
|
147
|
+
const position = info.size - archive.size - marker.length,
|
|
148
|
+
actual = Buffer.alloc(marker.length)
|
|
149
|
+
if (
|
|
150
|
+
(await file.read(actual, 0, actual.length, position)).bytesRead !== actual.length ||
|
|
151
|
+
!actual.equals(marker)
|
|
152
|
+
)
|
|
153
|
+
throw new Error('Copied installer archive marker missing')
|
|
154
|
+
const hash = createHash('sha256')
|
|
155
|
+
for await (const chunk of file.createReadStream({
|
|
156
|
+
start: position + marker.length,
|
|
157
|
+
autoClose: false,
|
|
158
|
+
}))
|
|
159
|
+
hash.update(chunk)
|
|
160
|
+
if ('sha256:' + hash.digest('hex') !== archive.digest)
|
|
161
|
+
throw new Error('Copied installer archive differs')
|
|
162
|
+
} finally {
|
|
163
|
+
await file.close()
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function within(root: string, value: string): boolean {
|
|
167
|
+
const path = relative(root, value)
|
|
168
|
+
return path !== '' && path !== '..' && !path.startsWith('..' + sep) && !isAbsolute(path)
|
|
169
|
+
}
|
|
170
|
+
function cleanEnv(parent: Record<string, string | undefined>): Record<string, string> {
|
|
171
|
+
const result: Record<string, string> = {}
|
|
172
|
+
for (const key of [
|
|
173
|
+
'PATH',
|
|
174
|
+
'SystemRoot',
|
|
175
|
+
'WINDIR',
|
|
176
|
+
'COMSPEC',
|
|
177
|
+
'PATHEXT',
|
|
178
|
+
'TMP',
|
|
179
|
+
'TEMP',
|
|
180
|
+
'TMPDIR',
|
|
181
|
+
'LANG',
|
|
182
|
+
'LC_ALL',
|
|
183
|
+
'DISPLAY',
|
|
184
|
+
'XAUTHORITY',
|
|
185
|
+
'DBUS_SESSION_BUS_ADDRESS',
|
|
186
|
+
])
|
|
187
|
+
if (parent[key]) result[key] = parent[key]!
|
|
188
|
+
return result
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** Verify and prepare an installer without executing it, on a matching disposable runner. */
|
|
192
|
+
export async function prepareInstallerExecution(options: {
|
|
193
|
+
platform: InstallerPlatform
|
|
194
|
+
appName: string
|
|
195
|
+
installer: string
|
|
196
|
+
archive: string
|
|
197
|
+
env?: Record<string, string | undefined>
|
|
198
|
+
}): Promise<{ directory: string; profile: string; incoming: string; executable: string }> {
|
|
199
|
+
const env = options.env ?? process.env
|
|
200
|
+
assertInstallerContext(env, options.platform, process.platform, process.arch)
|
|
201
|
+
assertPortableAppName(options.appName)
|
|
202
|
+
if (!env.RUNNER_TEMP || !isAbsolute(env.RUNNER_TEMP))
|
|
203
|
+
throw new Error('Missing runner temp directory')
|
|
204
|
+
const parent = await realpath(env.RUNNER_TEMP),
|
|
205
|
+
sourceInstaller = resolve(options.installer),
|
|
206
|
+
sourceArchive = resolve(options.archive)
|
|
207
|
+
if (!(await lstat(parent)).isDirectory()) throw new Error('Invalid runner temp directory')
|
|
208
|
+
const verified = await verifyInstallerPayload({
|
|
209
|
+
...options,
|
|
210
|
+
installer: sourceInstaller,
|
|
211
|
+
archive: sourceArchive,
|
|
212
|
+
env,
|
|
213
|
+
})
|
|
214
|
+
const directory = await mkdtemp(join(parent, 'framework-installer-'))
|
|
215
|
+
let mounted = false
|
|
216
|
+
try {
|
|
217
|
+
const profile = join(directory, 'profile'),
|
|
218
|
+
incoming = join(directory, 'incoming')
|
|
219
|
+
await mkdir(profile, { mode: 0o700 })
|
|
220
|
+
await mkdir(incoming, { mode: 0o700 })
|
|
221
|
+
const clean = cleanEnv(env)
|
|
222
|
+
let executable: string
|
|
223
|
+
if (options.platform === 'macos-arm64') {
|
|
224
|
+
const mount = join(directory, 'mount')
|
|
225
|
+
await mkdir(mount)
|
|
226
|
+
await run(
|
|
227
|
+
[
|
|
228
|
+
'/usr/bin/hdiutil',
|
|
229
|
+
'attach',
|
|
230
|
+
'-readonly',
|
|
231
|
+
'-nobrowse',
|
|
232
|
+
'-mountpoint',
|
|
233
|
+
mount,
|
|
234
|
+
sourceInstaller,
|
|
235
|
+
],
|
|
236
|
+
clean
|
|
237
|
+
)
|
|
238
|
+
mounted = true
|
|
239
|
+
try {
|
|
240
|
+
const appName = `${options.appName}.app`,
|
|
241
|
+
apps = (await readdir(mount)).filter((name) => name.endsWith('.app'))
|
|
242
|
+
if (apps.length !== 1 || apps[0] !== appName)
|
|
243
|
+
throw new Error('Unexpected installer application')
|
|
244
|
+
const sourceApp = await realpath(join(mount, appName)),
|
|
245
|
+
mountRoot = await realpath(mount)
|
|
246
|
+
if (!within(mountRoot, sourceApp)) throw new Error('Installer application escapes image')
|
|
247
|
+
const app = join(incoming, appName)
|
|
248
|
+
await run(['/usr/bin/ditto', sourceApp, app], clean)
|
|
249
|
+
const actualApp = await realpath(app),
|
|
250
|
+
resources = await realpath(join(actualApp, 'Contents', 'Resources'))
|
|
251
|
+
if (!within(await realpath(incoming), actualApp) || !within(actualApp, resources))
|
|
252
|
+
throw new Error('Copied installer escapes profile')
|
|
253
|
+
const plist = join(actualApp, 'Contents', 'Info.plist'),
|
|
254
|
+
plistInfo = await lstat(plist)
|
|
255
|
+
if (
|
|
256
|
+
!plistInfo.isFile() ||
|
|
257
|
+
plistInfo.isSymbolicLink() ||
|
|
258
|
+
plistInfo.size < 1 ||
|
|
259
|
+
plistInfo.size > 1024 * 1024
|
|
260
|
+
)
|
|
261
|
+
throw new Error('Invalid installer property list')
|
|
262
|
+
const name = (
|
|
263
|
+
await run(['/usr/libexec/PlistBuddy', '-c', 'Print :CFBundleExecutable', plist], clean)
|
|
264
|
+
).trim()
|
|
265
|
+
if (!name || name === '.' || name === '..' || /[\\/]/.test(name))
|
|
266
|
+
throw new Error('Invalid installer executable')
|
|
267
|
+
executable = join(actualApp, 'Contents', 'MacOS', name)
|
|
268
|
+
const sourceExecutable = join(sourceApp, 'Contents', 'MacOS', name)
|
|
269
|
+
if (
|
|
270
|
+
!within(actualApp, await realpath(executable)) ||
|
|
271
|
+
!within(sourceApp, await realpath(sourceExecutable))
|
|
272
|
+
)
|
|
273
|
+
throw new Error('Installer executable escapes application')
|
|
274
|
+
await assertExecutable(executable, options.platform)
|
|
275
|
+
if (
|
|
276
|
+
JSON.stringify(await digest(sourceExecutable)) !==
|
|
277
|
+
JSON.stringify(await digest(executable))
|
|
278
|
+
)
|
|
279
|
+
throw new Error('Copied installer executable differs')
|
|
280
|
+
const archives = (await readdir(resources)).filter((value) => value.endsWith('.tar.zst'))
|
|
281
|
+
if (archives.length !== 1) throw new Error('Missing installer archive')
|
|
282
|
+
const embedded = await digest(join(resources, archives[0]!))
|
|
283
|
+
if (embedded.size !== verified.archive.size || embedded.digest !== verified.archive.digest)
|
|
284
|
+
throw new Error('Copied installer archive differs')
|
|
285
|
+
} finally {
|
|
286
|
+
await run(['/usr/bin/hdiutil', 'detach', mount], clean)
|
|
287
|
+
mounted = false
|
|
288
|
+
}
|
|
289
|
+
} else {
|
|
290
|
+
const root = env.SystemRoot
|
|
291
|
+
if (options.platform === 'windows-x64' && (!root || !/^[A-Za-z]:[\\/]/.test(root)))
|
|
292
|
+
throw new Error('Missing Windows system directory')
|
|
293
|
+
const tar =
|
|
294
|
+
options.platform === 'windows-x64' ? win32.join(root!, 'System32', 'tar.exe') : 'tar'
|
|
295
|
+
const names = (await run([tar, '-tf', sourceInstaller], clean)).split(/\r?\n/).filter(Boolean)
|
|
296
|
+
assertInstallerLayout(options.platform, options.appName, names)
|
|
297
|
+
const find = (name: string) => {
|
|
298
|
+
const found = names.filter((value) =>
|
|
299
|
+
options.platform === 'windows-x64'
|
|
300
|
+
? normalizeArchiveMember(value).toLowerCase() === name.toLowerCase()
|
|
301
|
+
: normalizeArchiveMember(value) === name
|
|
302
|
+
)
|
|
303
|
+
if (found.length !== 1) throw new Error('Installer member missing or ambiguous')
|
|
304
|
+
return found[0]!
|
|
305
|
+
}
|
|
306
|
+
if (options.platform === 'windows-x64') {
|
|
307
|
+
const subdirectory = join(incoming, '.installer')
|
|
308
|
+
await mkdir(subdirectory)
|
|
309
|
+
executable = join(incoming, `${options.appName}-Setup.exe`)
|
|
310
|
+
await extract(
|
|
311
|
+
tar,
|
|
312
|
+
sourceInstaller,
|
|
313
|
+
find(`${options.appName}-Setup.exe`),
|
|
314
|
+
executable,
|
|
315
|
+
256 * 1024 * 1024,
|
|
316
|
+
clean
|
|
317
|
+
)
|
|
318
|
+
await assertExecutable(executable, options.platform)
|
|
319
|
+
await extract(
|
|
320
|
+
tar,
|
|
321
|
+
sourceInstaller,
|
|
322
|
+
find(`.installer/${options.appName}-Setup.metadata.json`),
|
|
323
|
+
join(subdirectory, `${options.appName}-Setup.metadata.json`),
|
|
324
|
+
1024 * 1024,
|
|
325
|
+
clean
|
|
326
|
+
)
|
|
327
|
+
const embeddedPath = join(subdirectory, `${options.appName}-Setup.tar.zst`)
|
|
328
|
+
await extract(
|
|
329
|
+
tar,
|
|
330
|
+
sourceInstaller,
|
|
331
|
+
find(`.installer/${options.appName}-Setup.tar.zst`),
|
|
332
|
+
embeddedPath,
|
|
333
|
+
verified.archive.size,
|
|
334
|
+
clean
|
|
335
|
+
)
|
|
336
|
+
const embedded = await digest(embeddedPath)
|
|
337
|
+
if (embedded.size !== verified.archive.size || embedded.digest !== verified.archive.digest)
|
|
338
|
+
throw new Error('Copied installer archive differs')
|
|
339
|
+
} else {
|
|
340
|
+
executable = join(incoming, 'installer')
|
|
341
|
+
await extract(
|
|
342
|
+
tar,
|
|
343
|
+
sourceInstaller,
|
|
344
|
+
find('installer'),
|
|
345
|
+
executable,
|
|
346
|
+
verified.archive.size + 256 * 1024 * 1024,
|
|
347
|
+
clean
|
|
348
|
+
)
|
|
349
|
+
await assertExecutable(executable, options.platform)
|
|
350
|
+
await assertLinuxEmbedded(executable, verified.archive)
|
|
351
|
+
await chmod(executable, 0o700)
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
const after = await verifyInstallerPayload({
|
|
355
|
+
...options,
|
|
356
|
+
installer: sourceInstaller,
|
|
357
|
+
archive: sourceArchive,
|
|
358
|
+
env,
|
|
359
|
+
})
|
|
360
|
+
if (JSON.stringify(after) !== JSON.stringify(verified))
|
|
361
|
+
throw new Error('Installer changed during preparation')
|
|
362
|
+
return { directory, profile, incoming, executable }
|
|
363
|
+
} catch (error) {
|
|
364
|
+
if (!mounted) await rm(directory, { recursive: true, force: true })
|
|
365
|
+
throw error
|
|
366
|
+
}
|
|
367
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { assertHostedRunner } from './hosted-runner'
|
|
2
|
+
import type { FetchFunction } from '../updates/release-location'
|
|
3
|
+
/** CI preflight only: block external fetches while recording unexpected activity.
|
|
4
|
+
* This does not intercept sockets, subprocesses, or webview networking. */
|
|
5
|
+
export function installInstallerFetchGuard(options: {
|
|
6
|
+
env: Record<string, string | undefined>
|
|
7
|
+
globals: { fetch: FetchFunction }
|
|
8
|
+
origin: string
|
|
9
|
+
expectedReads?: readonly string[]
|
|
10
|
+
onUnexpected?: () => void
|
|
11
|
+
}): { readonly blockedReads: number; readonly unexpectedActivity: boolean } {
|
|
12
|
+
assertHostedRunner(options.env, 'Fetch guard')
|
|
13
|
+
const origin = new URL(options.origin)
|
|
14
|
+
if (
|
|
15
|
+
origin.protocol !== 'http:' ||
|
|
16
|
+
origin.hostname !== '127.0.0.1' ||
|
|
17
|
+
!origin.port ||
|
|
18
|
+
origin.origin !== options.origin
|
|
19
|
+
)
|
|
20
|
+
throw new Error('Invalid installer probe origin')
|
|
21
|
+
const expected = new Set(options.expectedReads ?? [])
|
|
22
|
+
if (expected.size !== (options.expectedReads ?? []).length || expected.size > 32)
|
|
23
|
+
throw new Error('Invalid expected reads')
|
|
24
|
+
for (const value of expected) {
|
|
25
|
+
const url = new URL(value)
|
|
26
|
+
if (url.protocol !== 'https:' || url.username || url.password || url.hash || url.href !== value)
|
|
27
|
+
throw new Error('Invalid expected read')
|
|
28
|
+
}
|
|
29
|
+
const original = options.globals.fetch
|
|
30
|
+
if (typeof original !== 'function') throw new Error('Missing fetch implementation')
|
|
31
|
+
let blockedReads = 0,
|
|
32
|
+
unexpectedActivity = false
|
|
33
|
+
const unexpected = () => {
|
|
34
|
+
unexpectedActivity = true
|
|
35
|
+
options.onUnexpected?.()
|
|
36
|
+
}
|
|
37
|
+
const guardedFetch = async (...[input, init]: Parameters<FetchFunction>) => {
|
|
38
|
+
let request: Request
|
|
39
|
+
try {
|
|
40
|
+
request = new Request(input, init)
|
|
41
|
+
} catch {
|
|
42
|
+
unexpected()
|
|
43
|
+
throw new Error('Invalid guarded request')
|
|
44
|
+
}
|
|
45
|
+
const url = new URL(request.url)
|
|
46
|
+
if (url.origin === origin.origin && !url.username && !url.password)
|
|
47
|
+
return original.call(options.globals, request, { redirect: 'error' })
|
|
48
|
+
blockedReads++
|
|
49
|
+
if (
|
|
50
|
+
request.method !== 'GET' ||
|
|
51
|
+
!expected.has(url.href) ||
|
|
52
|
+
request.headers.has('authorization') ||
|
|
53
|
+
request.headers.has('cookie') ||
|
|
54
|
+
init?.credentials === 'include'
|
|
55
|
+
)
|
|
56
|
+
unexpected()
|
|
57
|
+
throw new Error('Installer qualification blocks external fetch')
|
|
58
|
+
}
|
|
59
|
+
const guard = Object.assign(guardedFetch, {
|
|
60
|
+
preconnect: () => {
|
|
61
|
+
unexpected()
|
|
62
|
+
throw new Error('Installer qualification blocks preconnect')
|
|
63
|
+
},
|
|
64
|
+
})
|
|
65
|
+
if (!Reflect.set(options.globals, 'fetch', guard) || options.globals.fetch !== guard)
|
|
66
|
+
throw new Error('Cannot install fetch guard')
|
|
67
|
+
return {
|
|
68
|
+
get blockedReads() {
|
|
69
|
+
return blockedReads
|
|
70
|
+
},
|
|
71
|
+
get unexpectedActivity() {
|
|
72
|
+
return unexpectedActivity
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
}
|