@ai-ecoverse/slicc-kernel 1.195.0 → 1.195.2
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 +2 -2
- package/dist/async-process.js +1 -1
- package/dist/cloudflare-sources.js +1 -1
- package/dist/cloudflare.js +17 -15
- package/dist/cloudflare.js.map +2 -2
- package/dist/kernel-worker.js +17 -15
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.cjs +1 -1
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +17 -15
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1502,7 +1502,7 @@ The kernel then asks the hook `{ v: 1, op: 'materializeConsume', ticket, stamp,
|
|
|
1502
1502
|
- `stamp` is the child's caller stamp, as above (`pid` the child's; `ppid` the process that spawned or exec'd it, which is the one that sent the `materialize`, so for an exec both are that process's pid), also given as `caller`, as on every request;
|
|
1503
1503
|
- `path` and `cwd` are the ones the `materialize` named, and `resolved` the file that runs, symlinks resolved;
|
|
1504
1504
|
- `interpreters` is the chain of `#!` and `binfmt` interpreters the kernel will really run, outermost first, each absolute with its symlinks resolved, and empty for a program of the catalog (Emscripten, WASI or JS) and the `/usr/bin/<name>` entries for one. A plain `#!/usr/bin/env X` (or `env -S X …`) is reported as `X`: a command of the catalog as `/usr/bin/X`, a script command by its file. `env` with any other option or a `NAME=value` assignment is run and reported as `/usr/bin/env` itself;
|
|
1505
|
-
- `trusted` is true when the program and every interpreter are regular files owned by root and not writable by group or others, under directories that are all the same, up to `/` (for a command of the catalog, its package files). It's false unless `users` is `'enforce'`: under `'off'` files have no owners, and under `'report'` owners don't stop a write. The reply must be `{ values, placeholders }` (string maps) within 10 s; anything else is `EACCES`. Each variable of the child's environment whose value is exactly `placeholders[NAME]` gets `values[NAME]`; nothing else changes. The kernel keeps no copy and logs nothing of either. Like any environment, the values are inherited by whatever the child itself spawns or execs, as on Linux. A ticket isn't carried across `sudo`, which builds its own environment: a `sudo` run with `SLICC_SEALED_TICKET` set fails with `EACCES`, and burns the ticket. `env_keep` doesn't change that, since the kernel never copies `SLICC_SEALED_TICKET`, whatever the list says. A placeholder in a variable `env_keep` names is a string like any other, and reaches the command as it is.
|
|
1505
|
+
- `trusted` is true when the program and every interpreter are regular files owned by root and not writable by group or others, under directories that are all the same, up to `/` (for a command of the catalog, its package files, every [variant](#commands) its environment can pick included, since the variant is chosen when the program loads). It's false unless `users` is `'enforce'`: under `'off'` files have no owners, and under `'report'` owners don't stop a write. The reply must be `{ values, placeholders }` (string maps) within 10 s; anything else is `EACCES`. Each variable of the child's environment whose value is exactly `placeholders[NAME]` gets `values[NAME]`; nothing else changes. The kernel keeps no copy and logs nothing of either. Like any environment, the values are inherited by whatever the child itself spawns or execs, as on Linux. A ticket isn't carried across `sudo`, which builds its own environment: a `sudo` run with `SLICC_SEALED_TICKET` set fails with `EACCES`, and burns the ticket. `env_keep` doesn't change that, since the kernel never copies `SLICC_SEALED_TICKET`, whatever the list says. A placeholder in a variable `env_keep` names is a string like any other, and reaches the command as it is.
|
|
1506
1506
|
|
|
1507
1507
|
**The child's output is scrubbed (S2).** The kernel compiles a [slicc-scrub](https://github.com/ai-ecoverse/slicc-scrub) scrubber (1.1.0, bundled; the published package has no runtime dependency) over exactly the values it swapped in, and gives the child new open file descriptions for fd 1 and fd 2, for every other descriptor it holds on the same descriptions (a `dup` of them), and for every descriptor on a terminal (fd 0 of a terminal session is one), that pass every write through it into the originals (one wrapper per original description, so `2>&1` keeps its order). A value appears as its placeholder, and a fragment or encoded form of it (JSON, percent, HTML, base64, hex, wrapped) as `[redacted:NAME]`. Bytes go through at once unless they may still be the start of a match; such a tail is let out after 50 ms without a write when it's shorter than 16 bytes, and otherwise at the next write or at close. The child's descendants inherit the scrubbed descriptions through fork, spawn, exec and `dup`, and a descendant that opens its controlling terminal (`/dev/tty`, or a terminal by name) gets one scrubbed too, as does a pseudo-terminal slave (`/dev/pts/N`) or [`/dev/clipboard`](#devclipboard) it opens, and a `/dev/clipboard` descriptor it inherited is wrapped at the redeem like fd 1 and 2, so the page's clipboard gets placeholders, never the values. Files, sockets and pipes the child or a descendant opens itself are not scrubbed, so `printf %s "$T" > f` writes the value. A scrubbed fd 1 or 2 is a stream: it doesn't seek. Under `O_NONBLOCK` it gives `EAGAIN` when the pipe or terminal under it would. A write that finds room returns at once, taking at most 64 KiB, and the scrubbed bytes the file couldn't take yet go out before anything written later. Until they have, `poll` reports it unwritable and a nonblocking write gets `EAGAIN`, taking nothing. A blocking write that waits for them, or for room, ends with `EINTR` at a signal, taking nothing; one interrupted after it began writing returns its whole count, and the rest follows. A descendant that redeems a ticket of its own adds its values: its output is scrubbed for both sets. A value under 8 bytes is swapped but can't be scrubbed. The scrubber goes when the last process and description holding it do.
|
|
1508
1508
|
|
|
@@ -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,
|
|
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
|
|
package/dist/async-process.js
CHANGED
|
@@ -1362,7 +1362,7 @@ function createParentRefreshCount() {
|
|
|
1362
1362
|
}
|
|
1363
1363
|
|
|
1364
1364
|
// src/version.ts
|
|
1365
|
-
var KERNEL_VERSION = true ? "1.195.
|
|
1365
|
+
var KERNEL_VERSION = true ? "1.195.2" : "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
|