From a22c55e6063c6a69b25c1a607d7b38d87ed9eb56 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Thu, 22 Oct 2026 17:47:52 +0200 Subject: [PATCH 1/4] Add wf run and wf exec: WebFront scripts in a Worker under the manifest permissions [#307] Scripts of the manifest and webfront.bin entries of locked packages are bundled by esbuild-wasm and run in a dedicated Worker with a bounded context API (args, signal, console, project read/list/write, packages.resolve, fetch, exit). The page applies the manifest permissions to context operations and publishes each write with developer::Store. Ctrl+C or the time limit aborts the script's signal, then terminates the Worker after a grace period; staged writes are aborted and committed ones complete. npm's bin is never run and Node.js imports are refused while loading. Store::list backs context.project.list. --- .github/workflows/DeveloperDistribution.yml | 2 +- docs/CHANGELOG.md | 8 + docs/DEVELOPER_ENVIRONMENT.md | 54 ++++- docs/PROJECT_STATUS.md | 3 +- include/webfront/DeveloperApp.hpp | 1 + include/webfront/system/DeveloperFiles.hpp | 1 + include/webfront/system/DeveloperStore.hpp | 31 +++ js/core/WebFrontAssets.cmake | 2 +- js/developer/environment/bundler.mjs | 45 +++- js/developer/environment/bundles.json | 15 +- js/developer/environment/compiler.mjs | 6 +- js/developer/environment/packages-entry.mjs | 3 + js/developer/environment/packages.bundle.mjs | 26 ++- js/developer/environment/permissions.mjs | 42 ++++ js/developer/environment/runtime.mjs | 50 ++++- js/developer/environment/script-worker.mjs | 77 +++++++ js/developer/environment/scripts.mjs | 217 +++++++++++++++++++ js/developer/tools/build.mjs | 7 +- js/developer/tools/memory-bridge.mjs | 8 + js/developer/tools/registry-fixture.mjs | 17 +- js/developer/tools/scripts-check.mjs | 216 ++++++++++++++++++ test/unit/DeveloperTests.cpp | 34 +++ test/web/developer-specs.mjs | 67 +++++- 23 files changed, 895 insertions(+), 37 deletions(-) create mode 100644 js/developer/environment/permissions.mjs create mode 100644 js/developer/environment/script-worker.mjs create mode 100644 js/developer/environment/scripts.mjs create mode 100644 js/developer/tools/scripts-check.mjs diff --git a/.github/workflows/DeveloperDistribution.yml b/.github/workflows/DeveloperDistribution.yml index 7c175075..c7f9fec1 100644 --- a/.github/workflows/DeveloperDistribution.yml +++ b/.github/workflows/DeveloperDistribution.yml @@ -69,7 +69,7 @@ jobs: echo "::notice::Sources build $building; DeveloperReleaseData.hpp still pins the published $pinned." node js/developer/tools/pin-check.mjs fi - node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs js/developer/tools/manifest-check.mjs js/developer/tools/restore-check.mjs + node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs js/developer/tools/manifest-check.mjs js/developer/tools/restore-check.mjs js/developer/tools/scripts-check.mjs - name: Check the dedicated release tag if: startsWith(github.ref, 'refs/tags/developer-v') env: diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index fde9409f..385c6eb2 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -21,6 +21,14 @@ print it with its origin. A reproducible local npm registry fixture (`js/developer/tools/registry-fixture.mjs`) serves the tests. +- `wf run [--timeout ]