@ai-ecoverse/slicc-kernel 1.196.37 → 1.196.38
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 +3 -3
- package/dist/async-process.js +1 -1
- package/dist/cloudflare-sources.js +1 -1
- package/dist/cloudflare.js +20 -8
- package/dist/cloudflare.js.map +3 -3
- package/dist/kernel-worker.js +20 -8
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.cjs +1 -1
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +20 -8
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +1 -1
- package/dist/types/commands.d.ts +5 -0
- package/dist/types/launcher.d.ts +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -436,7 +436,7 @@ A WASI preview1 or WASIX program (Zig, Rust, Go, wasi-libc or wasix-libc C) has
|
|
|
436
436
|
|
|
437
437
|
**Kernel commands:** `sudo`, `visudo`, `crontab` and `sealed` are the kernel's own, in `/usr/bin` for every user (see [Sudo](#sudo), [Cron](#cron) and [`/dev/sealed`](#devsealed)). A package's command of the same name, in any root, never wins over them.
|
|
438
438
|
|
|
439
|
-
A command's name is any single path component without whitespace or control characters, so coreutils' `[` is in `/usr/bin` too; a name that is empty, `.` or `..`, or has a `/`, a space, a tab, a newline, NUL or another control character is skipped. Entries may also set `argv0`, `args` and `env`, and a package can set `slicc.env` for all of its commands. A WASI entry with `"preopenRoot": true` also gets `/` as a preopen (see [WASI programs](#wasi-programs)). An entry with `"argv0Path": true` gets the absolute path it was run by as `argv[0]` when that path is a link outside `/bin` and `/usr/bin` to the command, as a venv's `bin/python` is (the `#!` line of a script naming such a link included), so it can find what sits beside that link; other entries keep their `argv0`. In `env`, `${package}` is the package directory, `${cwd}` the process's working directory, and `${NAME}` the caller's `NAME` when the program starts (a default naming an unset variable is left out); a relative path that exists in the package (`lib/python3.14`, `./`) becomes that absolute path. The caller's environment wins over these defaults; a `null` value removes the variable for the command, after the caller's environment is applied (a host-networked program can drop the kernel's proxy settings that way), and a command entry can set a variable its package's `slicc.env` removes. The catalog reads its roots in order, and the first root that provides a name wins it: a user's own global packages (for that user's processes), `/node_modules`, root's global packages, then each appended root. Within a root, packages are read by name and the first wins (compared as strings by UTF-16 code unit, so a scoped `@scope/name` comes before names that start with a letter, but after those that start with a digit), whatever order the file system lists them in; a `PNPM_HOME`'s install groups count as one root, read group by group (by the group directory's name, effectively arbitrary for pnpm's hashed names), each by package name. A variant can take over from the package it extends with `"slicc": { "replaces": ["@ai-ecoverse/wasm-imagemagick"] }`: when it and a package it names are in the same root, it wins every command name they share, whatever the order; names only the other provides stay the other's, a third package that provides the name and sorts first still wins it, and packages that replace each other fall back to the name order. A replace never reaches into an earlier root, so root's global packages can't take a name from `/node_modules` or a user's own packages. The field must be an array of package names; anything else is ignored. `sh` runs bash as `sh` unless a package provides its own. A package's `engines.slicc-kernel` is a floor the kernel holds it to: when the running kernel's version doesn't satisfy that npm range (comparators, `^`, `~`, x-ranges, hyphen ranges, `||`), or the range can't be read, its commands are refused. They stay in `/usr/bin`, and running one by name, by path or as a `#!` interpreter exits 126 with `<cmd>: <pkg>@<version> needs slicc-kernel <range>; this kernel is <version>` on stderr. Each refused package is logged once to the console. A non-string `engines.slicc-kernel`, or none, is no constraint. A development build reports the newest release tag as `<tag>+dev` and checks against that; a build of unknown version (`0.0.0`) checks nothing. The refusal follows the program, not the name: its glue or `.wasm` run by path (directly or through a symlink), and a byte-identical copy of its glue beside it named for one of its commands (#390, #899), exit 126 with the same message ([#1235](https://github.com/ai-ecoverse/slicc-kernel/issues/1235)). Only commands are refused: a package without commands (a `py-*` library, a side module) isn't, and a refused package that replaces base commands makes those commands fail with 126 rather than fall back to the package it replaces. The installed commands appear as executables in a virtual `/usr/bin` and `/bin`, so `PATH` lookups, `command -v` and `ls /usr/bin` work without writing anything to OPFS. An entry reads as its program, as a PATH search that opens what it finds expects (`ruby -S rake`, `perl -S`, Pod::Usage looking itself up, bundler checking that `/usr/bin/ruby` isn't empty). A script command reads as its script, a JS command as its module, and a WASI or Emscripten command as its `.wasm`, so `cat /usr/bin/hello` prints the script and `head -c4 /usr/bin/cat` gives `\0asm`. The entry is a plain file and no link: it stays a root-owned `0755` regular file with its own inode, `readlink` of it is `EINVAL`, and `which` and `command -v` print `/usr/bin/<name>`. No file stands behind it, so unlinking it is `ENOENT`, open or not, for a user's own entry in `~/.local/share/pnpm/bin` too: `rm -f` does nothing, `pnpm remove -g` counts it as gone, and the entry leaves with its package. Its size and times are the program's when the caller may read the program (anyone, for a kernel-internal look or with users off, only when everyone may), and 0 and the epoch otherwise. Running it still runs the catalog command, with its `env`, `args` and `argv0`. The read is the caller's: with users on, reading an entry also needs `r` on its program, and that includes a user's own commands in `~/.local/share/pnpm/bin`, so an entry whose program the caller can't read is `EACCES`. A process can also run a program by the path of its glue when the `.wasm` sits next to it, a wasm module by its own path (as a WASI program; when it is the `wasm` of a WASI command in the caller's catalog, the user's own packages included, it runs as that command, with its `env` defaults, `args` and `argv0`, the command whose name matches the file's, without `.wasm`, if several share it, while a copy elsewhere runs bare), and a script through its `#!` line (including `#!/usr/bin/env name`). Executing any other file fails with `ENOEXEC`, so bash runs it as a shell script, as POSIX shells do. A spawn by a bare name (no `/`) that the catalog doesn't have, and that didn't ask for no search (a WASIX `posix_spawn` or `execve`, as opposed to its `posix_spawnp`/`execvp`, keeps its bare name), searches the `PATH` of the spawn's own environment, in order, with an empty entry meaning the working directory; each candidate is run exactly as a spawn of that path would be. A `..` in a candidate resolves after the names before it, as on Linux, so an entry like `missing/..` or `file/..` is `ENOENT` for that entry and the search goes on with the next one; before [#1979](https://github.com/ai-ecoverse/slicc-kernel/issues/1979) it collapsed lexically and ran the name in the working directory. The first that runs wins; if one was found but refused and nothing else matched, the spawn fails with `EACCES` (126), otherwise `ENOENT` (127). A catalog command still wins over the same name on `PATH`, the reverse of a shell's order, and that order is deliberate ([#2007](https://github.com/ai-ecoverse/slicc-kernel/issues/2007)). The search was added only for names the catalog lacks ([#1165](https://github.com/ai-ecoverse/slicc-kernel/issues/1165)), so that every name that ran a command before runs the same one. It stayed that way when the search became the only one for a bare name ([#1168](https://github.com/ai-ecoverse/slicc-kernel/issues/1168)). So a JS program's `ctx.spawn('true')`, or a bare `true` from an Emscripten program built on the shim before its own search, runs the catalog's `true` even when an earlier `PATH` directory has an executable `true`. To run that one, spawn it by its path. A caller that searches `PATH` itself and hands the kernel the path it found gets `PATH` order (bash, and wasm-coreutils from 9.12.0-11), and so does a WASIX `posix_spawnp`, as below. A spawn whose environment has no `PATH` searches nothing, also on purpose: [#1169](https://github.com/ai-ecoverse/slicc-kernel/pull/1169) chose never to use a default of the kernel's. A name the catalog has still runs, and any other bare name is `ENOENT`, where `execvp` would search its default path. A caller that wants that default sets `PATH` itself. A file the search finds that is no program, such as a plain text file without `#!` and with no `binfmt` rule, is `ENOEXEC`, as for a spawn by its path: JS and Emscripten spawns behave like `posix_spawn` in glibc since 2.15, not like `execvp`, which runs such a file with `/bin/sh`, while a shell, which does its own fallback, still runs it as a script. A WASIX `posix_spawnp` or `execvp` is the exception: it searches the `PATH` its libc hands over (the caller's, as POSIX says, or musl's default when that is unset) in `PATH` order, with no catalog first, so a catalog command is found as its `/usr/bin` entry ([#2006](https://github.com/ai-ecoverse/slicc-kernel/issues/2006)). Each entry is tried as `entry/name`, an empty one as `name`, from the directory the spawn's `chdir` actions leave, and needs search on the entry itself before anything in it runs, a catalog command in `/usr/bin` included. As in glibc's `execvpe` and `posix_spawnp`, an `EACCES` is remembered and reported only if nothing later runs, `ENOENT`, `ENOTDIR`, `ESTALE`, `ENODEV` and `ETIMEDOUT` go on to the next entry, and any other errno ends the search with it: `ELOOP`, `EIO` from reading the file, the errno of a `#!` interpreter that can't be reached (`ELOOP` for a link loop), and `ENOEXEC`, as `posix_spawnp` has no `/bin/sh` fallback. These rules hold for every `PATH` search the kernel makes, also a JS or Emscripten program's for a name the catalog lacks. A name with a `/` also resolves from the directory the `chdir` actions leave, and an empty name is `ENOENT`. Before, the program looked the entries up itself: it skipped an empty entry when a later one had the file, stopped at a file it found but couldn't run, passed over an `ELOOP`, and resolved relative entries and a relative name from its own directory. An exec of a path that meets a symlink loop is `ELOOP` (126 in bash), as on Linux, where it used to be `ENOENT` (127). A searched bare name is never looked up in the working directory itself: a file of that name there runs only through an empty `PATH` entry, as with `execvp` ([#1234](https://github.com/ai-ecoverse/slicc-kernel/issues/1234)). A bare name that asks for no search (as `argv[0]` of `kernel.run` and `openTerminal` does) and that the catalog doesn't have runs a `#!` or `binfmt` script of that name in the working directory, and that exec is checked exactly as one of `./name`: with users on, the file needs `x` (and `r` for a script) and each directory on the way search permission, or the exec fails with `EACCES` ([#1955](https://github.com/ai-ecoverse/slicc-kernel/issues/1955)). Whether the catalog has the name is decided once, when the exec is planned, and the check is of the file that plan chose, so a command of that name installed meanwhile doesn't let the file in the working directory run unchecked. The `PATH` searched is the new process's, from the spawn's environment; POSIX `posix_spawnp` uses the caller's, which is the same unless the caller hands the child another one. This is `posix_spawnp`/`execvp` semantics for every caller that asks for a search: JS programs' `ctx.spawn`, WASI programs' spawn import, WASIX `posix_spawnp`, and Emscripten programs built on homescoop's shim before its own `PATH` search (gmake, tar, git and others hand the kernel the bare name). wasm-coreutils from 9.12.0-11 searches `PATH` itself and hands the kernel a path ([#1165](https://github.com/ai-ecoverse/slicc-kernel/issues/1165), [#1168](https://github.com/ai-ecoverse/slicc-kernel/issues/1168)). A `..` in a path that is run is resolved physically, as the file system resolves it: `pkg/../tools/x` after a symlinked `pkg` is the `tools/x` beside the link's target, and its exec permission is checked there. The walk is the caller's: with users on, each directory it passes needs search (`x`) permission (`EACCES`, 126 in bash, as on Linux), and a sudo process follows only the links it trusts, as for any other path. Commands also come from pnpm's global directory. Every process gets a `PNPM_HOME` and has `$PNPM_HOME/bin` on `PATH`: root's is `/usr/local/share/pnpm` (unless the embedder sets its own), a user's `~/.local/share/pnpm` (see [Users](#users)). The kernel scans each of pnpm's global install groups (`$PNPM_HOME/global/*/<group>/node_modules`) after `/node_modules`, which wins when both provide a command. The catalog is re-read whenever anything under either changes, so `pnpm add -g @ai-ecoverse/wasi-ripgrep` makes `rg` work in the same shell, and `pnpm remove -g` removes it again.
|
|
439
|
+
A command's name is any single path component without whitespace or control characters, so coreutils' `[` is in `/usr/bin` too; a name that is empty, `.` or `..`, or has a `/`, a space, a tab, a newline, NUL or another control character is skipped. Entries may also set `argv0`, `args` and `env`, and a package can set `slicc.env` for all of its commands. A WASI entry with `"preopenRoot": true` also gets `/` as a preopen (see [WASI programs](#wasi-programs)). An entry with `"argv0Path": true` gets the absolute path it was run by as `argv[0]` when that path is a link outside `/bin` and `/usr/bin` to the command, as a venv's `bin/python` is (the `#!` line of a script naming such a link included), so it can find what sits beside that link; other entries keep their `argv0`. In `env`, `${package}` is the package directory, `${cwd}` the process's working directory, and `${NAME}` the caller's `NAME` when the program starts (a default naming an unset variable is left out); a relative path that exists in the package (`lib/python3.14`, `./`) becomes that absolute path. Under sudo a package-relative default is anchored to its package even when the file is missing; a reference such as `${HOME}/.cache` that expands to an absolute path stays absolute. **Compatibility:** after expanding `${package}`, the catalog treats a default containing `/` as a single package path if, after removing one optional leading `./`, it neither starts with `/` nor contains a `..` component. It cannot distinguish a missing file from a string like `Europe/Berlin` or `https://example.org/index`. To use such a fixed literal unchanged under sudo, set it in the program rather than in its manifest environment defaults. The caller's environment wins over these defaults; a `null` value removes the variable for the command, after the caller's environment is applied (a host-networked program can drop the kernel's proxy settings that way), and a command entry can set a variable its package's `slicc.env` removes. The catalog reads its roots in order, and the first root that provides a name wins it: a user's own global packages (for that user's processes), `/node_modules`, root's global packages, then each appended root. Within a root, packages are read by name and the first wins (compared as strings by UTF-16 code unit, so a scoped `@scope/name` comes before names that start with a letter, but after those that start with a digit), whatever order the file system lists them in; a `PNPM_HOME`'s install groups count as one root, read group by group (by the group directory's name, effectively arbitrary for pnpm's hashed names), each by package name. A variant can take over from the package it extends with `"slicc": { "replaces": ["@ai-ecoverse/wasm-imagemagick"] }`: when it and a package it names are in the same root, it wins every command name they share, whatever the order; names only the other provides stay the other's, a third package that provides the name and sorts first still wins it, and packages that replace each other fall back to the name order. A replace never reaches into an earlier root, so root's global packages can't take a name from `/node_modules` or a user's own packages. The field must be an array of package names; anything else is ignored. `sh` runs bash as `sh` unless a package provides its own. A package's `engines.slicc-kernel` is a floor the kernel holds it to: when the running kernel's version doesn't satisfy that npm range (comparators, `^`, `~`, x-ranges, hyphen ranges, `||`), or the range can't be read, its commands are refused. They stay in `/usr/bin`, and running one by name, by path or as a `#!` interpreter exits 126 with `<cmd>: <pkg>@<version> needs slicc-kernel <range>; this kernel is <version>` on stderr. Each refused package is logged once to the console. A non-string `engines.slicc-kernel`, or none, is no constraint. A development build reports the newest release tag as `<tag>+dev` and checks against that; a build of unknown version (`0.0.0`) checks nothing. The refusal follows the program, not the name: its glue or `.wasm` run by path (directly or through a symlink), and a byte-identical copy of its glue beside it named for one of its commands (#390, #899), exit 126 with the same message ([#1235](https://github.com/ai-ecoverse/slicc-kernel/issues/1235)). Only commands are refused: a package without commands (a `py-*` library, a side module) isn't, and a refused package that replaces base commands makes those commands fail with 126 rather than fall back to the package it replaces. The installed commands appear as executables in a virtual `/usr/bin` and `/bin`, so `PATH` lookups, `command -v` and `ls /usr/bin` work without writing anything to OPFS. An entry reads as its program, as a PATH search that opens what it finds expects (`ruby -S rake`, `perl -S`, Pod::Usage looking itself up, bundler checking that `/usr/bin/ruby` isn't empty). A script command reads as its script, a JS command as its module, and a WASI or Emscripten command as its `.wasm`, so `cat /usr/bin/hello` prints the script and `head -c4 /usr/bin/cat` gives `\0asm`. The entry is a plain file and no link: it stays a root-owned `0755` regular file with its own inode, `readlink` of it is `EINVAL`, and `which` and `command -v` print `/usr/bin/<name>`. No file stands behind it, so unlinking it is `ENOENT`, open or not, for a user's own entry in `~/.local/share/pnpm/bin` too: `rm -f` does nothing, `pnpm remove -g` counts it as gone, and the entry leaves with its package. Its size and times are the program's when the caller may read the program (anyone, for a kernel-internal look or with users off, only when everyone may), and 0 and the epoch otherwise. Running it still runs the catalog command, with its `env`, `args` and `argv0`. The read is the caller's: with users on, reading an entry also needs `r` on its program, and that includes a user's own commands in `~/.local/share/pnpm/bin`, so an entry whose program the caller can't read is `EACCES`. A process can also run a program by the path of its glue when the `.wasm` sits next to it, a wasm module by its own path (as a WASI program; when it is the `wasm` of a WASI command in the caller's catalog, the user's own packages included, it runs as that command, with its `env` defaults, `args` and `argv0`, the command whose name matches the file's, without `.wasm`, if several share it, while a copy elsewhere runs bare), and a script through its `#!` line (including `#!/usr/bin/env name`). Executing any other file fails with `ENOEXEC`, so bash runs it as a shell script, as POSIX shells do. A spawn by a bare name (no `/`) that the catalog doesn't have, and that didn't ask for no search (a WASIX `posix_spawn` or `execve`, as opposed to its `posix_spawnp`/`execvp`, keeps its bare name), searches the `PATH` of the spawn's own environment, in order, with an empty entry meaning the working directory; each candidate is run exactly as a spawn of that path would be. A `..` in a candidate resolves after the names before it, as on Linux, so an entry like `missing/..` or `file/..` is `ENOENT` for that entry and the search goes on with the next one; before [#1979](https://github.com/ai-ecoverse/slicc-kernel/issues/1979) it collapsed lexically and ran the name in the working directory. The first that runs wins; if one was found but refused and nothing else matched, the spawn fails with `EACCES` (126), otherwise `ENOENT` (127). A catalog command still wins over the same name on `PATH`, the reverse of a shell's order, and that order is deliberate ([#2007](https://github.com/ai-ecoverse/slicc-kernel/issues/2007)). The search was added only for names the catalog lacks ([#1165](https://github.com/ai-ecoverse/slicc-kernel/issues/1165)), so that every name that ran a command before runs the same one. It stayed that way when the search became the only one for a bare name ([#1168](https://github.com/ai-ecoverse/slicc-kernel/issues/1168)). So a JS program's `ctx.spawn('true')`, or a bare `true` from an Emscripten program built on the shim before its own search, runs the catalog's `true` even when an earlier `PATH` directory has an executable `true`. To run that one, spawn it by its path. A caller that searches `PATH` itself and hands the kernel the path it found gets `PATH` order (bash, and wasm-coreutils from 9.12.0-11), and so does a WASIX `posix_spawnp`, as below. A spawn whose environment has no `PATH` searches nothing, also on purpose: [#1169](https://github.com/ai-ecoverse/slicc-kernel/pull/1169) chose never to use a default of the kernel's. A name the catalog has still runs, and any other bare name is `ENOENT`, where `execvp` would search its default path. A caller that wants that default sets `PATH` itself. A file the search finds that is no program, such as a plain text file without `#!` and with no `binfmt` rule, is `ENOEXEC`, as for a spawn by its path: JS and Emscripten spawns behave like `posix_spawn` in glibc since 2.15, not like `execvp`, which runs such a file with `/bin/sh`, while a shell, which does its own fallback, still runs it as a script. A WASIX `posix_spawnp` or `execvp` is the exception: it searches the `PATH` its libc hands over (the caller's, as POSIX says, or musl's default when that is unset) in `PATH` order, with no catalog first, so a catalog command is found as its `/usr/bin` entry ([#2006](https://github.com/ai-ecoverse/slicc-kernel/issues/2006)). Each entry is tried as `entry/name`, an empty one as `name`, from the directory the spawn's `chdir` actions leave, and needs search on the entry itself before anything in it runs, a catalog command in `/usr/bin` included. As in glibc's `execvpe` and `posix_spawnp`, an `EACCES` is remembered and reported only if nothing later runs, `ENOENT`, `ENOTDIR`, `ESTALE`, `ENODEV` and `ETIMEDOUT` go on to the next entry, and any other errno ends the search with it: `ELOOP`, `EIO` from reading the file, the errno of a `#!` interpreter that can't be reached (`ELOOP` for a link loop), and `ENOEXEC`, as `posix_spawnp` has no `/bin/sh` fallback. These rules hold for every `PATH` search the kernel makes, also a JS or Emscripten program's for a name the catalog lacks. A name with a `/` also resolves from the directory the `chdir` actions leave, and an empty name is `ENOENT`. Before, the program looked the entries up itself: it skipped an empty entry when a later one had the file, stopped at a file it found but couldn't run, passed over an `ELOOP`, and resolved relative entries and a relative name from its own directory. An exec of a path that meets a symlink loop is `ELOOP` (126 in bash), as on Linux, where it used to be `ENOENT` (127). A searched bare name is never looked up in the working directory itself: a file of that name there runs only through an empty `PATH` entry, as with `execvp` ([#1234](https://github.com/ai-ecoverse/slicc-kernel/issues/1234)). A bare name that asks for no search (as `argv[0]` of `kernel.run` and `openTerminal` does) and that the catalog doesn't have runs a `#!` or `binfmt` script of that name in the working directory, and that exec is checked exactly as one of `./name`: with users on, the file needs `x` (and `r` for a script) and each directory on the way search permission, or the exec fails with `EACCES` ([#1955](https://github.com/ai-ecoverse/slicc-kernel/issues/1955)). Whether the catalog has the name is decided once, when the exec is planned, and the check is of the file that plan chose, so a command of that name installed meanwhile doesn't let the file in the working directory run unchecked. The `PATH` searched is the new process's, from the spawn's environment; POSIX `posix_spawnp` uses the caller's, which is the same unless the caller hands the child another one. This is `posix_spawnp`/`execvp` semantics for every caller that asks for a search: JS programs' `ctx.spawn`, WASI programs' spawn import, WASIX `posix_spawnp`, and Emscripten programs built on homescoop's shim before its own `PATH` search (gmake, tar, git and others hand the kernel the bare name). wasm-coreutils from 9.12.0-11 searches `PATH` itself and hands the kernel a path ([#1165](https://github.com/ai-ecoverse/slicc-kernel/issues/1165), [#1168](https://github.com/ai-ecoverse/slicc-kernel/issues/1168)). A `..` in a path that is run is resolved physically, as the file system resolves it: `pkg/../tools/x` after a symlinked `pkg` is the `tools/x` beside the link's target, and its exec permission is checked there. The walk is the caller's: with users on, each directory it passes needs search (`x`) permission (`EACCES`, 126 in bash, as on Linux), and a sudo process follows only the links it trusts, as for any other path. Commands also come from pnpm's global directory. Every process gets a `PNPM_HOME` and has `$PNPM_HOME/bin` on `PATH`: root's is `/usr/local/share/pnpm` (unless the embedder sets its own), a user's `~/.local/share/pnpm` (see [Users](#users)). The kernel scans each of pnpm's global install groups (`$PNPM_HOME/global/*/<group>/node_modules`) after `/node_modules`, which wins when both provide a command. The catalog is re-read whenever anything under either changes, so `pnpm add -g @ai-ecoverse/wasi-ripgrep` makes `rg` work in the same shell, and `pnpm remove -g` removes it again.
|
|
440
440
|
|
|
441
441
|
**More roots:** `createKernel({ commands: { append: ['/opt/user/node_modules'] } })` (and `createNodeKernel`) scans more directories, each absolute and normalised (anything else throws a `TypeError`). A name is looked up in a user's own global packages first, then in `modules`, then in root's global packages, then in the appended roots in the order given, and the first match wins, so an appended root never shadows another command (or `sudo`). Commands of a package that a global install only brought along as a dependency come after all of these: see [A global package's dependencies](#commands). Their commands are in `/usr/bin` for every user, like root's global packages, and their `binfmt` and file system entries count too. A package in an appended root also gets a command for each `bin` entry of its `package.json` (a string `bin` is named after the package, without its scope), which runs as a `#!` script; a name its `slicc.commands` gives wins. A `bin` entry is skipped when its name isn't a command name (see above), or its file, with symlinks resolved, isn't a regular file inside the package. `/node_modules` and the global packages keep reading only `slicc.commands`. A missing root counts as empty until it appears, and an install or removal in a root is picked up as it happens. With `users: 'enforce'` a root counts only when it and every directory above it are root's and not writable by group or others; another root is skipped without a word. Under `'report'` such a root is still scanned, and reported once to `onDenial` and the report log as `{ pid: 0, uid: 0, op: 'commands', path, errno: 'EACCES' }`. Running a `bin` command needs `r` and `x` on its file under `users` (see [Permissions](#permissions)), checked when it runs, so a `0644` file is `EACCES` under `'enforce'`.
|
|
442
442
|
|
|
@@ -1402,7 +1402,7 @@ With `users: 'enforce'` the kernel checks every file call that reaches it agains
|
|
|
1402
1402
|
`sudo` is a command of the kernel itself, in `/usr/bin` (a package's `sudo` never wins over it): `sudo [-kn] [-u user] [--] command [args…]` runs `command` as `user` (root by default), and `sudo -l` lists what the caller may run (`visudo -c` checks the policy, below). `-n` never asks: a command that needs approval fails with `sudo: a password is required`, unless a [timestamp](#sudo-timestamps) lets it run. `sudo -v`, `sudo -k` and `sudo -K` start, end and remove timestamps, as in sudo(8) (below). Any other combination, a command after `-v`, `-l` or `-K`, or no command and no mode, prints the usage. The decision, the credentials and the environment are all made in the kernel; the command only passes its arguments and its own environment on (`ctx.sudo`, see [JS programs](#js-programs)), so no program can grant itself more by calling the kernel some other way.
|
|
1403
1403
|
|
|
1404
1404
|
- **`sudo` elevates only under `users: 'enforce'`.** With `'off'` and `'report'`, `sudo command` just runs `command`, as the caller, with its environment. Under `'report'` nothing is refused, so anyone could rewrite the policy or a command; `sudo` grants nothing until the kernel enforces.
|
|
1405
|
-
- **The policy** is `/etc/sudoers` and the files in `/etc/sudoers.d/` (in name order, skipping names that start with `.` or end in `~`), which the kernel writes at start when they're missing, with owners on: `/etc/sudoers` root's `0440` with the one line `%sudo Cmnd *`, and `/etc/sudoers.d` root's `0750`. There is no API: an admin (bios, as root) edits `/etc/sudoers.d/<user>`. A line is `[NOPASSWD] <user|%group|ALL> [(<target>)] [Cwd <dir>] [Stdin none] [ChainSha256 <sha256>] [RouteSha256 <sha256>] [Sha256 none|<file>=<sha256>…] Cmnd <argv…|*>`: who (a user name, a group, or anyone), the user it may run as (`root` by default, or `ALL`), the directory it may run in, whether it needs a standard input that carries nothing the approver didn't see, the contents of the command's user-writable files, and the command, or `*` for any command. The command is shell-quoted words whose first is an absolute path, matched exactly against the resolved path (a `*` in it is a literal `*`). The arguments follow sudoers(5): **none written** (`Cmnd /usr/bin/mcpcat`) allows the program with any arguments, none included; **`""` as the only argument** (`Cmnd /usr/bin/mcpcat ""`) allows it with no arguments (`''` is one empty argument); **otherwise** each word matches one argument, exactly, except that an unquoted `*` is a wildcard. A word that is `*` alone matches any number of arguments, none included (`Cmnd /usr/bin/mcpcat list *`), and a `*` inside a word matches any text within that one argument (`--log=*.txt`). A quoted or escaped `*` (`\*`, `'*'`, `"*"`) is a literal `*`, and `*` is the only wildcard: `?` and `[` are literal. **Unlike sudo**, which matches the arguments joined by spaces as one string, so that `/bin/cat /var/log/*` also allows `cat /var/log/x /etc/shadow`, a `*` here never reaches past the argument it is in: that line allows one argument under `/var/log/`, while `/bin/cat *` allows any arguments. `sudo -l` shows the command as it reads, `*` unquoted and a literal `*` as `\*`. **Upgrading:** before this, a command with no arguments allowed only a bare call and `*` was literal, so a hand-written line without arguments now allows any arguments, and an unquoted `*` now matches. Narrow such a line with `""` or the exact arguments if a bare call is what it meant. A hand-written `""` used to be one empty argument and is now no arguments; write `''` for the empty argument. A line in the exact format an `'always'` answer wrote for a bare call in a kernel from before, `NOPASSWD <user> (<target>) [Cwd <dir>] Cmnd <path>` in `/etc/sudoers.d/<user>`, character for character (trailing whitespace on the line ignored), is always read as if it ended in `""`, so it keeps allowing only that bare call, and `sudo -l` shows it with the `""`. That holds for a line an older kernel appends later, on the same root, too. A hand-written line that is character for character in that format is read the same way, so add arguments or `*`, or drop the `(<target>)`, to make it wider. Recorded lines with arguments still match the same arguments, since the kernel quoted each `*` it wrote. `Cwd` takes one shell-quoted absolute path, and the line then matches only when the caller's directory, resolved to its real path (the one the request shows and the command runs in), is that path, so write it without symlinks: one that has a symlink in it never matches. A line without `Cwd` matches in any directory. `sudo -l` shows the clause as `CWD=<dir>`. `Stdin none` makes the line match only when the caller's standard input is a terminal, `/dev/null` or closed, so a rule for `tee /etc/hosts` typed at a terminal never covers `echo … | sudo tee /etc/hosts` or `< file`. A terminal is any terminal, which a program can also drive through a pseudo-terminal of its own (`/dev/ptmx`, as `script` and `expect` do), so `Stdin none` keeps piped, redirected and file input out, not every input a person didn't type; `none` is the only value, and any other makes the line not parse. A line without `Stdin` matches whatever the input, as before. `sudo -l` shows it as `STDIN=none`, after `CWD=`. `Sha256 <file>=<sha256>`, one clause per file, pins the command to its contents: the line matches only when the [user-writable files](#sudo) that would run for the command are exactly the files it names, by real path (each a shell-quoted `<file>=<sha256>` word with an absolute path and 64 hex digits), and each still has that sha256. An `'always'` answer writes one for each user-writable input, or `Sha256 none` for an empty set, so a provider that becomes relevant later cannot inherit an approval for an empty set. Older kernels omitted `Sha256` when they recorded an `'always'` approval with no user-writable files. In `/etc/sudoers.d/<user>`, a line in the exact format an older kernel wrote for that user now counts as `Sha256 none`: it still matches while all inputs are root-held, but a newly user-writable input needs fresh approval. This is checked when the line is read, without rewriting the file. Other rules without `Sha256` still match whatever the files hold. For an admin rule with exactly the same text but no digest check, put it in another policy file. `ChainSha256` pins the catalog entry or interpreter choice and requires a `Sha256` clause. A new `'always'` rule records the chain digest when a file is user-writable or a catalog environment value depends on a package path whose existence is not known to be root-controlled. This includes a missing file under a writable directory. Root-owned symlinks are allowed if the directories on both sides are root-held; an absent path is root-controlled only when every existing component traversed is root-held. When the environment path names a directory, sudo checks the route and the directory itself, not its contents. A root-held directory still counts as root-controlled if it contains a writable file: the check covers whether the catalog value expands to that directory, not what a program later reads there. An untrusted link, an invalid walk, or an unexpected lookup failure keeps the chain pinned. With no files to hash it still records `Sha256 none`. If the environment paths are root-controlled too, it omits the chain digest so a root-held package can be upgraded without another approval. An empty binding without a chain digest stops matching if an environment path becomes writable. Existing explicit chain pins remain effective.
|
|
1405
|
+
- **The policy** is `/etc/sudoers` and the files in `/etc/sudoers.d/` (in name order, skipping names that start with `.` or end in `~`), which the kernel writes at start when they're missing, with owners on: `/etc/sudoers` root's `0440` with the one line `%sudo Cmnd *`, and `/etc/sudoers.d` root's `0750`. There is no API: an admin (bios, as root) edits `/etc/sudoers.d/<user>`. A line is `[NOPASSWD] <user|%group|ALL> [(<target>)] [Cwd <dir>] [Stdin none] [ChainSha256 <sha256>] [RouteSha256 <sha256>] [Sha256 none|<file>=<sha256>…] Cmnd <argv…|*>`: who (a user name, a group, or anyone), the user it may run as (`root` by default, or `ALL`), the directory it may run in, whether it needs a standard input that carries nothing the approver didn't see, the contents of the command's user-writable files, and the command, or `*` for any command. The command is shell-quoted words whose first is an absolute path, matched exactly against the resolved path (a `*` in it is a literal `*`). The arguments follow sudoers(5): **none written** (`Cmnd /usr/bin/mcpcat`) allows the program with any arguments, none included; **`""` as the only argument** (`Cmnd /usr/bin/mcpcat ""`) allows it with no arguments (`''` is one empty argument); **otherwise** each word matches one argument, exactly, except that an unquoted `*` is a wildcard. A word that is `*` alone matches any number of arguments, none included (`Cmnd /usr/bin/mcpcat list *`), and a `*` inside a word matches any text within that one argument (`--log=*.txt`). A quoted or escaped `*` (`\*`, `'*'`, `"*"`) is a literal `*`, and `*` is the only wildcard: `?` and `[` are literal. **Unlike sudo**, which matches the arguments joined by spaces as one string, so that `/bin/cat /var/log/*` also allows `cat /var/log/x /etc/shadow`, a `*` here never reaches past the argument it is in: that line allows one argument under `/var/log/`, while `/bin/cat *` allows any arguments. `sudo -l` shows the command as it reads, `*` unquoted and a literal `*` as `\*`. **Upgrading:** before this, a command with no arguments allowed only a bare call and `*` was literal, so a hand-written line without arguments now allows any arguments, and an unquoted `*` now matches. Narrow such a line with `""` or the exact arguments if a bare call is what it meant. A hand-written `""` used to be one empty argument and is now no arguments; write `''` for the empty argument. A line in the exact format an `'always'` answer wrote for a bare call in a kernel from before, `NOPASSWD <user> (<target>) [Cwd <dir>] Cmnd <path>` in `/etc/sudoers.d/<user>`, character for character (trailing whitespace on the line ignored), is always read as if it ended in `""`, so it keeps allowing only that bare call, and `sudo -l` shows it with the `""`. That holds for a line an older kernel appends later, on the same root, too. A hand-written line that is character for character in that format is read the same way, so add arguments or `*`, or drop the `(<target>)`, to make it wider. Recorded lines with arguments still match the same arguments, since the kernel quoted each `*` it wrote. `Cwd` takes one shell-quoted absolute path, and the line then matches only when the caller's directory, resolved to its real path (the one the request shows and the command runs in), is that path, so write it without symlinks: one that has a symlink in it never matches. A line without `Cwd` matches in any directory. `sudo -l` shows the clause as `CWD=<dir>`. `Stdin none` makes the line match only when the caller's standard input is a terminal, `/dev/null` or closed, so a rule for `tee /etc/hosts` typed at a terminal never covers `echo … | sudo tee /etc/hosts` or `< file`. A terminal is any terminal, which a program can also drive through a pseudo-terminal of its own (`/dev/ptmx`, as `script` and `expect` do), so `Stdin none` keeps piped, redirected and file input out, not every input a person didn't type; `none` is the only value, and any other makes the line not parse. A line without `Stdin` matches whatever the input, as before. `sudo -l` shows it as `STDIN=none`, after `CWD=`. `Sha256 <file>=<sha256>`, one clause per file, pins the command to its contents: the line matches only when the [user-writable files](#sudo) that would run for the command are exactly the files it names, by real path (each a shell-quoted `<file>=<sha256>` word with an absolute path and 64 hex digits), and each still has that sha256. An `'always'` answer writes one for each user-writable input, or `Sha256 none` for an empty set, so a provider that becomes relevant later cannot inherit an approval for an empty set. Older kernels omitted `Sha256` when they recorded an `'always'` approval with no user-writable files. In `/etc/sudoers.d/<user>`, a line in the exact format an older kernel wrote for that user now counts as `Sha256 none`: it still matches while all inputs are root-held, but a newly user-writable input needs fresh approval. This is checked when the line is read, without rewriting the file. Other rules without `Sha256` still match whatever the files hold. For an admin rule with exactly the same text but no digest check, put it in another policy file. `ChainSha256` pins the catalog entry or interpreter choice and requires a `Sha256` clause. A new `'always'` rule records the chain digest when a file is user-writable or a catalog environment value depends on a package path whose existence is not known to be root-controlled. This includes a missing file under a writable directory. Root-owned symlinks are allowed if the directories on both sides are root-held; an absent path is root-controlled only when every existing component traversed is root-held. When the environment path names a directory, sudo checks the route and the directory itself, not its contents. A root-held directory still counts as root-controlled if it contains a writable file: the check covers whether the catalog value expands to that directory, not what a program later reads there. An untrusted link, an invalid walk, or an unexpected lookup failure keeps the chain pinned. With no files to hash it still records `Sha256 none`. If the environment paths are root-controlled too, it omits the chain digest so a root-held package can be upgraded without another approval. An empty binding without a chain digest stops matching if an environment path becomes writable. Existing explicit chain pins remain effective. Sudo passes a package-relative catalog default such as `opt/input` as an absolute package path even while it is missing, never as a lookup relative to the caller’s directory. A hand-written rule with file digests alone does not pin whether that path existed in the package at approval. Include the approval’s `ChainSha256` to pin that fact as well. A chain pin recorded using the old relative fallback needs a fresh approval. If a root-held module-search directory contains a user-writable subdirectory, a command running as root may load user-controlled modules from it. Keep the entire search tree non-writable by untrusted users. `sudo -l` shows the clauses as `CHAIN_SHA256=`, `SHA256=none` or `SHA256=<file>:<sha256>`. When any hashed path goes through a link to another name, an `'always'` rule also records `RouteSha256`: the sha256 of the UTF-8 JSON array of `[requested path, real path]` pairs for all hashed paths, sorted by requested path. A hash-bound rule must match this field too. A rule from an older kernel with `Sha256` but no route digest cannot authorize a hashed route that needs one; approve again to record the routes. Root-only files reached through root-held links need neither a file hash nor a route digest. A line in the bare-call format below with `Stdin none ` before `Cmnd` is read as ending in `""` too. `#` lines and blank lines are ignored. Groups are the caller's process groups, as `id` shows them.
|
|
1406
1406
|
- **The sudoers(5) form:** a line can also be written the way sudoers(5) writes one, for the common subset: `<user|%group|ALL> ALL=[(<target>[,<target>…][:<group>…])] [NOPASSWD:|PASSWD:] <command…|ALL>`, with optional spaces around `=`. The host must be `ALL`. The run-as list is user names or `ALL`, root when it is left out, and a line with several (`cone ALL=(cone-32,cone-33) …`) is one rule per user, as if written once per user in the kernel form; a `:<group>` part is accepted and ignored: the kernel's `sudo` has no `-g`, and the rule runs with the target's own groups, so `(root:restricted)` can differ from sudo, which would run it with that group. `NOPASSWD:` is the kernel's `NOPASSWD`, `PASSWD:` (the default) asks `approve`, and the command `ALL` is the kernel's `*`. So `cone ALL=(cone-32,cone-33) /usr/local/bin/agent send cone --file /tmp/msg-*.md` reads as `cone (cone-32) Cmnd /usr/local/bin/agent send cone --file /tmp/msg-*.md` and the same for `cone-33`, and `%sudo ALL=(ALL:ALL) ALL` as `%sudo (ALL) Cmnd *`. **The command keeps the kernel's stricter meaning, not sudo's:** an unquoted `*` stays within the argument it is in (the line above allows `--file /tmp/msg-a.md` but not `--file /tmp/msg-a.md /etc/shadow.md`, which sudo's `*` would), `?` and `[` are literal, no arguments allows any, and `""` allows none. A `\` escapes the next character (`\,` for a comma in an argument), as in sudoers. Anything else of sudoers is refused rather than guessed at, so it grants nothing: another host, a `%group`, `#uid` or `!user` to run as, `(:group)` alone, a tag other than `NOPASSWD:`/`PASSWD:` (`NOEXEC:`, `SETENV:`, …), an option such as `CWD=` (use the kernel form's `Cwd`, which limits where the caller may run it rather than choosing where it runs), several commands separated by `,` or a `:` that starts another entry (write one line each), a negated `!command`, a digest (`sha256:<hex> <command>`; use the kernel form's `Sha256`), a wildcard or a directory as the command path, quotes (write a quoted argument in the kernel form), a `#` comment after the rule, a line continued with `\`, a user list, `Defaults` other than the [timestamp ones](#sudo-timestamps) and `env_keep` (**The environment**, below), `*_Alias`, a `#uid` as who, and `@include`/`#include` (`#includedir /etc/sudoers.d` is ignored, since the kernel reads that directory anyway). **Upgrading:** kernels before this skipped every line in this form (with only a `console.warn`), so such a line already in `/etc/sudoers.d` starts to count; `visudo -c` as root lists what the policy holds.
|
|
1407
1407
|
- **A line that doesn't parse is never dropped silently:** it is skipped, so it grants nothing, while the rest of the file still counts (as sudo's error recovery does), and every `sudo` and `sudo -l` says so on standard error before anything else. A caller with an effective uid of 0 gets one line per problem, with the file, the line number and what was expected: `sudo: /etc/sudoers.d/memory-handoff:1: line skipped: the SETENV: tag isn't supported: only NOPASSWD: and PASSWD: are`, or, for a line in neither form, `expected '[NOPASSWD] <user|%group|ALL> [(<target>)] [Cwd <dir>] [Stdin none] [ChainSha256 <sha256>] [RouteSha256 <sha256>] [Sha256 none|<file>=<sha256>…] Cmnd <command…|*>' or '<user|%group|ALL> ALL=[(<target>[,<target>…])] [NOPASSWD:] <command…|ALL>'`. A policy file that isn't root's, is a symlink, or is writable by group or others, and every file in a directory that is, is skipped the same way and reported as `sudo: <path> skipped: it must be root's, no symlink, and writable by root only`. Any other caller can't read the policy, so it gets only a count, without file names or anything from the lines: `sudo: 2 policy lines or files were skipped and grant nothing; ask an administrator to run sudo visudo -c`, and nothing when nothing was skipped. To check a line before installing it, run `visudo -c -f <file>` on your own copy, which reports it in full. Each problem is also logged once, in full, with `console.warn`.
|
|
1408
1408
|
- **`visudo -c`** is a command of the kernel itself, in `/usr/bin`, that checks the policy without running anything: `visudo -c -f <file>` (or `visudo -c <file>`, several allowed, `-` for standard input, shown as `stdin`) checks a file the caller can read, before it is installed, and prints `<file>: parsed OK` on standard output, or `visudo: <file>:<line>: <what was expected>` on standard error for each bad line, and exits with 1. `visudo -c` alone checks `/etc/sudoers` and the files in `/etc/sudoers.d` as `sudo` reads them, the ownership and mode included (`visudo: <path>: sudo skips it: …`), and needs an effective uid of 0, as reading those files does on Linux: `sudo visudo -c`. After the files, it prints the [timestamp values](#sudo-timestamps) on standard output: `Defaults timestamp_timeout=<minutes>, timestamp_type=<type>` for everyone (the kernel's 5 and `tty` where no line sets them), then each `Defaults:<user|%group>` line, as read, in the order they apply, so a later one wins; the first line ends with `, env_keep="<names>"` when the lines for everyone keep any variable (**The environment**, below); `-f` prints them only when the files have a `Defaults` line. `-q` prints nothing and only sets the status, `-s` is accepted (the check is always strict), and `visudo` without `-c` refuses to edit: write the file as root with mode `0440` (`install -m 0440 -o root -g root <file> /etc/sudoers.d/<name>`).
|
|
@@ -1433,7 +1433,7 @@ As in sudo(8), a person's approval is remembered for a few minutes: until then,
|
|
|
1433
1433
|
|
|
1434
1434
|
- **Only a person's approval writes one.** The approver says so by answering `{ answer: 'once', timestamp: true }` or `{ answer: 'always', timestamp: true }` (`SudoApproval`; every request carries `timestamp: true` to say the kernel takes it). A plain `'once'` or `'always'` runs the command and writes nothing, so an approver from before this, a judge or another program can't open the window. `'always'` writes it only once its rule is recorded (or, for a command line that can't be recorded, once it ran).
|
|
1435
1435
|
- **What it skips:** only the question. The policy, the checks of the directory and the command, and `NOPASSWD` stay as they are, so a timestamp never lets a caller run a command no line allows it to ask for. A caller with an effective uid of 0, and a command a `NOPASSWD` line allows, neither use nor write one. Every run a timestamp allowed is refreshed (the window starts again from it, as sudo updates its record on each run) and logged on the kernel's console, through the same `console.warn` sudo already logs skipped policy lines to, in sudo's format: `sudo: cone : TTY=unknown ; PWD=/home/cone ; USER=root ; TIMESTAMP=ppid ; COMMAND=/usr/bin/id -un`. Nothing else shows it.
|
|
1436
|
-
- **What it covers:** starting a timestamp with `sudo -v`, or by approving an unrelated root-held command, does not cover a command whose catalog environment depends on a writable path, even if all of its command files are root-held. A personal approval for that command covers its current file binding and chain, including
|
|
1436
|
+
- **What it covers:** starting a timestamp with `sudo -v`, or by approving an unrelated root-held command, does not cover a command whose catalog environment depends on a writable path, even if all of its command files are root-held. A personal approval for that command covers its current file binding and chain, including whether the catalog environment path existed. If that fact changes, `sudo` asks again and `sudo -n` refuses.
|
|
1437
1437
|
- **Whose:** a timestamp belongs to the user who asked (the caller's real uid), whoever the command runs as, and to the place `timestamp_type` names:
|
|
1438
1438
|
- `tty` (the default): the caller's controlling terminal and its session, kept with the session leader's start time, so every command typed in one terminal shares it, a nested shell included, and nothing outside the terminal does. A caller without a terminal (an agent's `kernel.run`, a cron job, a pipe) falls back to `ppid`, as sudo does.
|
|
1439
1439
|
- `ppid`: the process that ran `sudo`, kept with its start time. So a script or a loop of `sudo` calls asks once, and the next script, another shell or the next `kernel.run` asks again. A `sudo` with no parent in the kernel (one the embedder started, or one a shell the embedder started execs as its last command, as `bash -c 'a; sudo b'` does) counts that top process as its parent, so the last `sudo` of a script shares the script's timestamp; one whose parent has ended uses and writes none.
|
package/dist/async-process.js
CHANGED
|
@@ -1576,7 +1576,7 @@ function createParentRefreshCount() {
|
|
|
1576
1576
|
}
|
|
1577
1577
|
|
|
1578
1578
|
// src/version.ts
|
|
1579
|
-
var KERNEL_VERSION = true ? "1.196.
|
|
1579
|
+
var KERNEL_VERSION = true ? "1.196.38" : "0.0.0-dev";
|
|
1580
1580
|
var OS_RELEASE = "6.0.0-slicc";
|
|
1581
1581
|
function procVersion() {
|
|
1582
1582
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|