@ai-ecoverse/slicc-kernel 1.195.0 → 1.195.1

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 CHANGED
@@ -1753,7 +1753,7 @@ The kernel is ported from SLICC's `packages/webapp/src/kernel/` with the browser
1753
1753
  - `src/cdp/`: the CDP facade on `127.0.0.1:9222`, its WebSocket framing, the registry of hosts and the `MessagePort` bridge to them.
1754
1754
  - `src/sudo.ts`, `src/sudoers.ts`, `src/sudo-command.ts`: the kernel side of `sudo` and `visudo -c`, the policy parser (both line forms and their diagnostics), and the two commands.
1755
1755
  - `src/time-zone.ts`: the system time zone (`timeZone`, or the browser's) and UTC offsets of a zone, which cron's schedules and `TZ` both come from.
1756
- - `src/async/`, `src/process/emscripten/`, `src/cloudflare.ts`, `src/cloudflare/` and `tools/derive-async/`: the kernel [in a Cloudflare Durable Object](#in-a-cloudflare-durable-object). `src/async/` is the link between the kernel and a process that shares no memory with it; `src/process/emscripten/` the kernel's own Emscripten imports; `src/cloudflare/` the Durable Object host, the SQLite root and the Cloudflare Computer backend; `tools/derive-async/` the build step that derives the async process runtime. Their tests are in `test/integration/cf/` and run in Node, with `node --test --test-concurrency=2 'test/integration/cf/*.test.mjs'`; those named `cloudflare-*` and `computer-cloudflare-*` start `wrangler dev`, and run against a deployed Worker when given its URL (`SLICC_CF_FIXTURE_URL` for the test fixture, `SLICC_CF_COMPUTER_URL` for the Computer example, with `SLICC_KERNEL_STAGING_KEY_SECRET` and `GITHUB_RUN_ID` to derive its key; `SLICC_CF_EXAMPLE_URL` and `SLICC_CF_EXAMPLE_KEY` for `examples/cloudflare`). `npm test` and CI run them with the rest. On a pull request, CI's `deploy` job runs `tools/cf-staging.mjs` through its deploy command, `sh tools/cf-staging.sh >> "$GITHUB_STEP_SUMMARY"`, which deploys `examples/cloudflare-computer` as the Worker `slicc-kernel-do-pr-<number>` and the test fixture `test/integration/cf/cloudflare-fixture` as `slicc-kernel-do-pr-<number>-waits`, and hands their addresses to the test shards and the reviewers as `STAGING_URL` (`https://…workers.dev/?fixture=…`, the fixture's origin URL-encoded), origins only. Every route of both needs the run's staging key, `HMAC-SHA256` of the run id (`GITHUB_RUN_ID`) under the repository secret `SLICC_KERNEL_STAGING_KEY_SECRET`, in hex, as an `x-slicc-key` or `authorization: Bearer` header; a request with a `key` parameter in its URL is refused even with the right header. Every request that carries the key, from the deploy or a test, follows no redirect and fails on a 3xx answer, so the key never reaches another origin. The deploy uploads each Worker once, with one `wrangler deploy` that carries the run id as its var `RUN`, the expiry as `EXPIRES` and the secret as `KEY_SECRET` in a JSON `--secrets-file`. That file is mode 0600, in a fresh 0700 directory inside the run's own directory, and is removed after the upload, on a failure and on SIGINT or SIGTERM; only its path is an argument. `tools/cf-staging.sh` makes that run directory with `mktemp -d` under `RUNNER_TEMP`, named `slicc-staging-run-…`, hands it to the tool as `SLICC_STAGING_SECRETS`, and removes it in a `trap … EXIT`, so a deploy killed with SIGKILL leaves no file behind either; on GitHub Actions the tool deploys nothing without such a directory. At start the tool removes stale run directories: only directories named exactly as the script names them (`slicc-staging-run-` and six letters or digits), never files or symlinks, never its own, and only under a `RUNNER_TEMP` whose real path is outside the checkout. A directory is stale when it and everything directly in it are older than an hour, twice the 30-minute limit of the deploy job, so the directory of a live deploy is never removed. The tool also refuses a secrets base whose real path is inside the checkout, through a symlink too. So no Worker runs a new `RUN` without the secret that goes with it. Each Worker recomputes the key for every request and compares it in constant time, answering a plain 403 otherwise; no Worker, output, summary or environment holds the key itself. When anything fails once `wrangler deploy` has been invoked for a Worker (the upload, or the check that its `/ready` answers 403 without the key and exactly 404 with it), the tool deletes that Worker; a failure before that, such as a refused base, touches no Worker. It counts the Worker as deleted only when the Cloudflare API answers 404 for its script, asked with no redirect and the token sent only to `api.cloudflare.com`, and neither wrangler config names an `account_id`, so that lookup and the deploy use the same account. Any other answer, any error while it checks (its body too), or no token strands the Worker: the deploy step fails and no address goes to the shards. A Worker that a cancellation leaves behind after a complete upload is gated by the run's key and swept after 24 hours. Wrangler gets only an allowlist of variables (`PATH`, `HOME`, the temporary, locale, XDG, proxy and CA variables) plus the Cloudflare login it is handed, locally under `wrangler dev` too, and the tool reports a failed wrangler command by its Cloudflare API codes, never by its output. Whatever derives the key (the deploy, to check that both Workers refuse a request without it and take one with it, and each shard, which gets the secret from the pipeline's `test-secrets:`) first prints `::add-mask::` for it on GitHub Actions, and writes it nowhere else. The reviewers get no secret and so no key. `npm test` loads `test/integration/staging-env-guard.cjs` with `--require`, so the test runner of every shard scans its own environment before any test runs and prints one line: on GitHub Actions with `SLICC_KERNEL_STAGING_KEY_SECRET` set, the number of variables it scanned for anything shaped like a key (64 hex characters) or holding `key=`, a pipeline or deploy secret the shards don't declare, the whole secrets object, or a copy of the secret or the key, and a leak fails the shard, naming only the variables; without the secret (a fork, a Renovate branch, the merge queue, a run with the staging deploy off, or outside GitHub Actions) it prints that it skipped, and why, and checks nothing, except that a pull request with a `STAGING_URL` but no secret fails. It runs in the test runner, not in each test file: `--import` would load it only in the test files' processes. The guard isn't enforcement on its own: it does nothing in a process that inherits `NODE_TEST_CONTEXT`, and another test command would drop it. The row in `test/integration/workflows.test.mjs` that pins `npm test`, with that `--require`, as the command every shard runs is the enforcement. The shards run the pull request's code, so that code holds the secret and can derive the key for any run id, not only its own: the same trust as the deploy job's `deploy-secrets`, and the Workers only run code from the pull request anyway. A secret that is missing, empty, shorter than 32 characters or equal to the Cloudflare token gives no key: the deploy skips, the staging rows skip with the reason, and fail on a pull request with a `STAGING_URL`. `test/integration/cf/staging-key-guard.test.mjs` runs the deploy with a fake secret and a stub wrangler, with a canary in every pipeline and declared secret name, and fails on anything shaped like a key (also split across lines), holding `key=`, or holding the key, the secret or a canary in its output, summary and log, in the arguments and environment each wrangler child received (as written and as JSON) and everything the stub captured, in every argument of every console line, in the environment a shard received, and in the review prompt. `computer-cloudflare-staging.test.mjs` then runs the Computer example's tests against the first Worker, and `frozen-clock-staging.test.mjs` checks on the second that `sigtimedwait` waits its full timeout after pure compute, during which a deployed Worker's clock stands still. Both Workers stop answering 24 hours after their deploy, and the example's programs have no network. The job needs the secrets `SLICC_KERNEL_CLOUDFLARE_API_TOKEN` (a Cloudflare API token that may edit Workers scripts; `SLICC_KERNEL_CLOUDFLARE_ACCOUNT_ID` too when the token sees several accounts) and `SLICC_KERNEL_STAGING_KEY_SECRET`; the shards never get the token. Without them, on a fork, in the merge queue, or when the deploy fails, there is no staging Worker and the example's test file skips. A row against a deployed Worker whose staging secret is unusable skips outside a pull request, also on CI, and fails on one; any other reason to skip (no `dist/`, no wrangler, `wrangler dev` not starting) fails on CI. The fixture's test file skips in the merge queue and outside CI, but fails on a pull request without a fixture, and the deploy job warns when the fixture's deploy failed. Each deploy deletes the other `slicc-kernel-do-pr-` Workers whose last deploy is more than 24 hours old, which no longer answer, and warns about one it could not delete.
1756
+ - `src/async/`, `src/process/emscripten/`, `src/cloudflare.ts`, `src/cloudflare/` and `tools/derive-async/`: the kernel [in a Cloudflare Durable Object](#in-a-cloudflare-durable-object). `src/async/` is the link between the kernel and a process that shares no memory with it; `src/process/emscripten/` the kernel's own Emscripten imports; `src/cloudflare/` the Durable Object host, the SQLite root and the Cloudflare Computer backend; `tools/derive-async/` the build step that derives the async process runtime. Their tests are in `test/integration/cf/` and run in Node, with `node --test --test-concurrency=2 'test/integration/cf/*.test.mjs'`; those named `cloudflare-*` and `computer-cloudflare-*` start `wrangler dev`, and run against a deployed Worker when given its URL (`SLICC_CF_FIXTURE_URL` for the test fixture, `SLICC_CF_COMPUTER_URL` for the Computer example, with `SLICC_KERNEL_STAGING_KEY_SECRET` and `GITHUB_RUN_ID` to derive its key; `SLICC_CF_EXAMPLE_URL` and `SLICC_CF_EXAMPLE_KEY` for `examples/cloudflare`). `npm test` and CI run them with the rest. On a pull request, CI's `deploy` job runs `tools/cf-staging.mjs` through its deploy command, `sh tools/cf-staging.sh >> "$GITHUB_STEP_SUMMARY"`, which deploys `examples/cloudflare-computer` as the Worker `slicc-kernel-do-pr-<number>` and the test fixture `test/integration/cf/cloudflare-fixture` as `slicc-kernel-do-pr-<number>-waits`, and hands their addresses to the test shards and the reviewers as `STAGING_URL` (`https://…workers.dev/?fixture=…`, the fixture's origin URL-encoded), origins only. Every route of both needs the run's staging key, `HMAC-SHA256` of the run id (`GITHUB_RUN_ID`) under the repository secret `SLICC_KERNEL_STAGING_KEY_SECRET`, in hex, as an `x-slicc-key` or `authorization: Bearer` header; a request with a `key` parameter in its URL is refused even with the right header. Every request that carries the key, from the deploy or a test, follows no redirect and fails on a 3xx answer, so the key never reaches another origin. The deploy uploads each Worker once, with one `wrangler deploy` that carries the run id as its var `RUN`, the expiry as `EXPIRES` and the secret as `KEY_SECRET` in a JSON `--secrets-file`. That file is mode 0600, in a fresh 0700 directory inside the run's own directory, and is removed after the upload, on a failure and on SIGINT or SIGTERM; only its path is an argument. `tools/cf-staging.sh` makes that run directory with `mktemp -d` under `RUNNER_TEMP`, named `slicc-staging-run-…`, hands it to the tool as `SLICC_STAGING_SECRETS`, and removes it in a `trap … EXIT`, so a deploy killed with SIGKILL leaves no file behind either; on GitHub Actions the tool deploys nothing without such a directory. At start the tool removes stale run directories: only directories named exactly as the script names them (`slicc-staging-run-` and six letters or digits), never files or symlinks, never its own, and only under a `RUNNER_TEMP` whose real path is outside the checkout. A directory is stale when it and everything directly in it are older than an hour, twice the 30-minute limit of the deploy job, so the directory of a live deploy is never removed. The tool also refuses a secrets base whose real path is inside the checkout, through a symlink too. So no Worker runs a new `RUN` without the secret that goes with it. Each Worker recomputes the key for every request and compares it in constant time, answering a plain 403 otherwise; no Worker, output, summary or environment holds the key itself. When anything fails once `wrangler deploy` has been invoked for a Worker (the upload, or the check that its `/ready` answers 403 without the key and exactly 404 with it), the tool deletes that Worker; a failure before that, such as a refused base, touches no Worker. It counts the Worker as deleted only when the Cloudflare API answers 404 for its script, asked with no redirect and the token sent only to `api.cloudflare.com`, and neither wrangler config names an `account_id`, so that lookup and the deploy use the same account. Any other answer, any error while it checks (its body too), or no token strands the Worker: the deploy step fails and no address goes to the shards. A Worker that a cancellation leaves behind after a complete upload is gated by the run's key and swept after 24 hours. Wrangler gets only an allowlist of variables (`PATH`, `HOME`, the temporary, locale, XDG, proxy and CA variables) plus the Cloudflare login it is handed, locally under `wrangler dev` too, and the tool reports a failed wrangler command by its Cloudflare API codes, never by its output. Whatever derives the key (the deploy, to check that both Workers refuse a request without it and take one with it, and each shard, whose Integration tests step alone gets the secret, from the pipeline's numbered slot `PIPELINE_TEST_SECRET_1` under the name `test-secrets` gives it, and only on a pull request from a branch of this repository) first prints `::add-mask::` for it on GitHub Actions, and writes it nowhere else. The reviewers get no secret and so no key. `npm test` loads `test/integration/staging-env-guard.cjs` with `--require`, so the test runner of every shard scans its own environment before any test runs and prints one line: on GitHub Actions with `SLICC_KERNEL_STAGING_KEY_SECRET` set, the number of variables it scanned for anything shaped like a key (64 hex characters) or holding `key=`, a pipeline or deploy secret the shards don't declare, the whole secrets object, or a copy of the secret or the key, and a leak fails the shard, naming only the variables; without the secret (a fork, a Renovate branch, the merge queue, a run with the staging deploy off, or outside GitHub Actions) it prints that it skipped, and why, and checks nothing, except that a pull request with a `STAGING_URL` but no secret fails. It runs in the test runner, not in each test file: `--import` would load it only in the test files' processes. The guard isn't enforcement on its own: it does nothing in a process that inherits `NODE_TEST_CONTEXT`, and another test command would drop it. The row in `test/integration/workflows.test.mjs` that pins `npm test`, with that `--require`, as the command every shard runs is the enforcement. The shards run the pull request's code, so that code holds the secret and can derive the key for any run id, not only its own: the same trust as the deploy job's `deploy-secrets`, and the Workers only run code from the pull request anyway. A secret that is missing, empty, shorter than 32 characters or equal to the Cloudflare token gives no key: the deploy skips, the staging rows skip with the reason, and fail on a pull request with a `STAGING_URL`. `test/integration/cf/staging-key-guard.test.mjs` runs the deploy with a fake secret and a stub wrangler, with a canary in every pipeline and declared secret name, and fails on anything shaped like a key (also split across lines), holding `key=`, or holding the key, the secret or a canary in its output, summary and log, in the arguments and environment each wrangler child received (as written and as JSON) and everything the stub captured, in every argument of every console line, in the environment a shard received, and in the review prompt. `computer-cloudflare-staging.test.mjs` then runs the Computer example's tests against the first Worker, and `frozen-clock-staging.test.mjs` checks on the second that `sigtimedwait` waits its full timeout after pure compute, during which a deployed Worker's clock stands still. Both Workers stop answering 24 hours after their deploy, and the example's programs have no network. The job needs the secrets `SLICC_KERNEL_CLOUDFLARE_API_TOKEN` (a Cloudflare API token that may edit Workers scripts; `SLICC_KERNEL_CLOUDFLARE_ACCOUNT_ID` too when the token sees several accounts) and `SLICC_KERNEL_STAGING_KEY_SECRET`, which ci.yml hands to the deploy command alone, in that order, through the slots `PIPELINE_DEPLOY_SECRET_1` to `PIPELINE_DEPLOY_SECRET_3` under the names `deploy-secrets` lists; the shards never get the token. Without them, on a fork, in the merge queue, or when the deploy fails, there is no staging Worker and the example's test file skips. A row against a deployed Worker whose staging secret is unusable skips outside a pull request, also on CI, and fails on one; any other reason to skip (no `dist/`, no wrangler, `wrangler dev` not starting) fails on CI. The fixture's test file skips in the merge queue and outside CI, but fails on a pull request without a fixture, and the deploy job warns when the fixture's deploy failed. Each deploy deletes the other `slicc-kernel-do-pr-` Workers whose last deploy is more than 24 hours old, which no longer answer, and warns about one it could not delete.
1757
1757
  - `src/cron/`: the cron service (`service.ts`), the schedule and table parsers, the clock, and the `crontab` command with the kernel side of `ctx.crontab`. An embedder that uses `Launcher` directly passes `cron: { lock }` to share the firing lock among the kernels on one root; the default, `slicc-kernel-cron`, is one lock for the whole origin.
1758
1758
 
1759
1759
 
@@ -1362,7 +1362,7 @@ function createParentRefreshCount() {
1362
1362
  }
1363
1363
 
1364
1364
  // src/version.ts
1365
- var KERNEL_VERSION = true ? "1.195.0" : "0.0.0-dev";
1365
+ var KERNEL_VERSION = true ? "1.195.1" : "0.0.0-dev";
1366
1366
  var OS_RELEASE = "6.0.0-slicc";
1367
1367
  function procVersion() {
1368
1368
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC