@ai-ecoverse/slicc-kernel 1.195.26 → 1.195.27

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
@@ -1388,7 +1388,7 @@ With `users: 'enforce'` the kernel checks every file call that reaches it agains
1388
1388
  - **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] [Sha256 <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`.
1389
1389
  - **`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>`).
1390
1390
  - **The embedders' recipe** puts cones in `sudo` (`groups: ['sudo']`) and scoops not, so a cone may ask for any command and a scoop for none.
1391
- - **The command** is found once, on `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin` for a bare name or against the caller's directory for a path, and its real path (symlinks resolved) is what runs and what the policy sees; the caller's `PATH` is never searched, as with sudo's `secure_path`, so a bare name doesn't find a user's own bin directory. The policy decides whether it runs, not who owns it: a command the caller can change runs as the target user when a line allows it. What the kernel adds is a binding to its contents. It looks at that file and every file that will really run for it (a catalog command's glue, module and imports module, and the `package.json` that defines it, a script and the interpreter its `#!` line or `binfmt` rule names, with the `package.json` that defines the rule). A file is omitted from the binding when it and every directory on its path are root-owned and not writable by group or others, and every symlink traversed, including links in a link target, is root-owned. Thus a root-only file behind root's own links counts like a direct path. Every other file is **user-writable**: its real path and sha256 go into the approval request (`userWritable`, below), and an `'always'` answer records them in its rule (`Sha256`). When the command starts, just before the kernel loads it, it hashes those files again; if one differs, is gone, or another user-writable file now runs for the command, nothing runs and `sudo` fails with `sudo: <file> changed since it was approved` (`EPERM`). Each requested path must still name the real file it identified at approval: exchanging two hashed files' links is refused even if their contents are identical. For a script the kernel plans each interpreter and its arguments from the same read it hashes. The modules and glue the kernel loads itself (a wasm module, a JS program's module, an Emscripten glue or imports module) are taken from the bytes it read and hashed then, never from its cache of compiled programs, which keys a file by its size and modification time, so a user-writable module swapped for another of the same size and time runs as approved or not at all. If a directly named Wasm file vanishes after the final hash, a warm entry keyed by that digest can still run the approved bytes. A file the kernel loads for the command that `sudo` didn't hash, such as the module of a [variant](#commands) the environment picked, must be root's and writable by root only, with every directory above it the same, and reached only through symlinks that root owns, so that no other user can change which file the path names; otherwise nothing runs (`sudo: <file> changed since it was approved`). Being root-only at the end of a link another user can repoint isn't enough, so a link repointed at another root-only program after the check doesn't run it. That holds whatever allowed the run (an approval, a `NOPASSWD` line, a [timestamp](#sudo-timestamps), an effective uid of 0): the hashes are the ones `sudo` saw when it decided. This also binds the script the interpreter opens. For each user-writable interpreted input (a `#!` script or a `binfmt` file), the child inherits a read-only, seekable descriptor for the very bytes used to plan the interpreter and verify the digest. The script argument becomes `/dev/fd/N`, including at each user-writable level of a nested interpreter chain. A rewrite or unlink after the check cannot substitute new contents. Each open of the descriptor path starts at offset zero, so a script can read `$0` without moving the interpreter's cursor. `dup` and `fork` still share the offset of the description they inherit. This applies to `sudoRun` too. **Compatibility:** bash sees `$0=/dev/fd/N`; Python sees the same descriptor path as `sys.argv[0]`. Self-relative lookups through `dirname "$0"` no longer find the script's directory. Pass the directory separately if needed. Root-only scripts (including ones behind root-held links) and scripts run outside sudo keep their original path. `sudo --help` describes this difference. Files that are root-only throughout are not listed or pinned, and a command whose files all are behaves as before. `sudo -l` ends the line of a rule whose command is user-writable with ` # user-writable command`. A command that wouldn't start as the target user (a `#!` line naming an interpreter that is only the caller's, say) fails with `command not found` before anything is asked. Other files a program loads at run time (a package's libraries) are the admin's to keep safe, as on Linux. The caller's directory, which the program passes on, must be a directory the caller may enter, or `sudo` refuses (`EACCES`). The kernel resolves it to its real path once, shows that in the request, and runs the command there; if it no longer resolves the same, or the caller can no longer enter it, when the answer comes or when the command starts, nothing runs.
1391
+ - **The command** is found once, on `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin` for a bare name or against the caller's directory for a path, and its real path (symlinks resolved) is what runs and what the policy sees; the caller's `PATH` is never searched, as with sudo's `secure_path`, so a bare name doesn't find a user's own bin directory. The policy decides whether it runs, not who owns it: a command the caller can change runs as the target user when a line allows it. What the kernel adds is a binding to its contents. It looks at that file and every file that will really run for it (a catalog command's glue, module and imports module, and the `package.json` that defines it, a script and the interpreter its `#!` line or `binfmt` rule names, with the `package.json` that defines the rule). A file is omitted from the binding when it and every directory on its path are root-owned and not writable by group or others, and every symlink traversed, including links in a link target, is root-owned. Thus a root-only file behind root's own links counts like a direct path. Every other file is **user-writable**: its real path and sha256 go into the approval request (`userWritable`, below), and an `'always'` answer records them in its rule (`Sha256`). When the command starts, just before the kernel loads it, it hashes those files again; if one differs, is gone, or another user-writable file now runs for the command, nothing runs and `sudo` fails with `sudo: <file> changed since it was approved` (`EPERM`). Each requested path must still name the real file it identified at approval: exchanging two hashed files' links is refused even if their contents are identical. For a script the kernel plans each interpreter and its arguments from the same read it hashes. When sudo selects an interpreter by `binfmt`, it scans the applicable rule manifests for that plan rather than using the ordinary exec cache. The winning manifest's digest comes from the bytes used to select the rule, even if its `package.json` links outside a watched package directory. The modules and glue the kernel loads itself (a wasm module, a JS program's module, an Emscripten glue or imports module) are taken from the bytes it read and hashed then, never from its cache of compiled programs, which keys a file by its size and modification time, so a user-writable module swapped for another of the same size and time runs as approved or not at all. If a directly named Wasm file vanishes after the final hash, a warm entry keyed by that digest can still run the approved bytes. A file the kernel loads for the command that `sudo` didn't hash, such as the module of a [variant](#commands) the environment picked, must be root's and writable by root only, with every directory above it the same, and reached only through symlinks that root owns, so that no other user can change which file the path names; otherwise nothing runs (`sudo: <file> changed since it was approved`). Being root-only at the end of a link another user can repoint isn't enough, so a link repointed at another root-only program after the check doesn't run it. That holds whatever allowed the run (an approval, a `NOPASSWD` line, a [timestamp](#sudo-timestamps), an effective uid of 0): the hashes are the ones `sudo` saw when it decided. This also binds the script the interpreter opens. For each user-writable interpreted input (a `#!` script or a `binfmt` file), the child inherits a read-only, seekable descriptor for the very bytes used to plan the interpreter and verify the digest. The script argument becomes `/dev/fd/N`, including at each user-writable level of a nested interpreter chain. A rewrite or unlink after the check cannot substitute new contents. Each open of the descriptor path starts at offset zero, so a script can read `$0` without moving the interpreter's cursor. `dup` and `fork` still share the offset of the description they inherit. This applies to `sudoRun` too. **Compatibility:** bash sees `$0=/dev/fd/N`; Python sees the same descriptor path as `sys.argv[0]`. Self-relative lookups through `dirname "$0"` no longer find the script's directory. Pass the directory separately if needed. Root-only scripts (including ones behind root-held links) and scripts run outside sudo keep their original path. `sudo --help` describes this difference. Files that are root-only throughout are not listed or pinned, and a command whose files all are behaves as before. `sudo -l` ends the line of a rule whose command is user-writable with ` # user-writable command`. A command that wouldn't start as the target user (a `#!` line naming an interpreter that is only the caller's, say) fails with `command not found` before anything is asked. Other files a program loads at run time (a package's libraries) are the admin's to keep safe, as on Linux. The caller's directory, which the program passes on, must be a directory the caller may enter, or `sudo` refuses (`EACCES`). The kernel resolves it to its real path once, shows that in the request, and runs the command there; if it no longer resolves the same, or the caller can no longer enter it, when the answer comes or when the command starts, nothing runs.
1392
1392
  - **The environment** is the kernel's, as sudo's is under `env_reset`: the kernel's own variables (`HOSTNAME`, `TZ`, the proxy and CA settings, and its `env` option), the target user's `HOME`, `USER`, `LOGNAME`, `SHELL`, `PNPM_HOME` and `NPM_CONFIG_PREFIX`, the fixed `PATH` above, `PWD`, the caller's `TERM` when it is a plain terminal name, and `SUDO_USER`, `SUDO_UID`, `SUDO_GID` and `SUDO_COMMAND`. Nothing else of the caller's environment reaches the command unless the policy keeps it with sudoers(5)'s `env_keep`, so a tool that reads a token from the environment works under `sudo` as it does on Linux:
1393
1393
  ```
1394
1394
  Defaults env_keep += "GH_TOKEN GITHUB_TOKEN"
@@ -1434,7 +1434,7 @@ function createParentRefreshCount() {
1434
1434
  }
1435
1435
 
1436
1436
  // src/version.ts
1437
- var KERNEL_VERSION = true ? "1.195.26" : "0.0.0-dev";
1437
+ var KERNEL_VERSION = true ? "1.195.27" : "0.0.0-dev";
1438
1438
  var OS_RELEASE = "6.0.0-slicc";
1439
1439
  function procVersion() {
1440
1440
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC