@ai-ecoverse/slicc-kernel 1.195.30 → 1.195.31
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 +4 -4
- package/dist/async-process.js +1 -1
- package/dist/cloudflare-sources.js +1 -1
- package/dist/cloudflare.js +246 -125
- package/dist/cloudflare.js.map +3 -3
- package/dist/index.js.map +1 -1
- package/dist/kernel-worker.js +246 -125
- 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 +246 -125
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +1 -1
- package/dist/types/commands.d.ts +1 -1
- package/dist/types/fs/integrity.d.ts +2 -0
- package/dist/types/launcher.d.ts +7 -4
- package/dist/types/sudo-files.d.ts +10 -1
- package/dist/types/sudo.d.ts +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1394,7 +1394,7 @@ With `users: 'enforce'` the kernel checks every file call that reaches it agains
|
|
|
1394
1394
|
- **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`.
|
|
1395
1395
|
- **`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>`).
|
|
1396
1396
|
- **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.
|
|
1397
|
-
- **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.
|
|
1397
|
+
- **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. Sudo builds the command catalog and `binfmt` rules for that plan from the manifest bytes it verifies, even when `package.json` links outside the watched roots. Lookups within one plan reuse the same scoped tables and one read per real manifest. Every user-writable manifest consulted in those scopes is bound: another package can replace a command or hide a rule without being the eventual winner, and a global project's `package.json` can affect dependency precedence. Root-held manifests stay out of `userWritable`. At start, and after a package-replacement wait, the selected interpreter chain must also match the approved chain; a vanished rule cannot silently become a different interpreter. 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.
|
|
1398
1398
|
- **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:
|
|
1399
1399
|
```
|
|
1400
1400
|
Defaults env_keep += "GH_TOKEN GITHUB_TOKEN"
|
|
@@ -1407,7 +1407,7 @@ With `users: 'enforce'` the kernel checks every file call that reaches it agains
|
|
|
1407
1407
|
- **Upgrading:** kernels before this refused an `env_keep` line (`sudo` and `visudo -c` reported it, and nothing was kept), so one already in the policy starts to count.
|
|
1408
1408
|
- **Compared with Linux sudo:** sudo(8) runs whatever path the policy allows, whoever owns it, and checks a command's contents only when its sudoers line names a digest (`sha256:<hex> /path`). The kernel runs what the policy allows too, and binds every user-writable file to the hash `sudo` saw, for every run, without a digest in the policy, and for all the files that run for the command (glue, module, `package.json`, script and interpreter), not only the command itself. A hand-written line without `Sha256` for a user-writable path is the admin's choice, as a sudoers line without a digest is: it runs the file as it is when it starts. Only the policy files themselves must be root-only, as only sudo's own files must be on Linux. The fixed `PATH` list, the checks on the caller's directory below, the symlink rule for what the command opens and the tags stay as they were. **Upgrading:** kernels before this refused a command that wasn't root-only, whatever the policy said (`sudo: <file> must be root's, and writable by root only`). Such a command now runs when a line allows it, so a `NOPASSWD` line or a `%sudo` line naming a user-writable path starts to count; an approver should show `userWritable`.
|
|
1409
1409
|
- **The decision:** a caller whose effective uid is 0 runs anything (the binding of user-writable files still applies). Otherwise a matching `NOPASSWD` line runs the command at once; any other matching line asks `approve`; nothing matching is refused (`sudo: cone is not allowed to run /usr/bin/ls as root`).
|
|
1410
|
-
- **Approval:** `approve(req, { signal })` gets `{ id, kind: 'sudo', user, uid, target, argv, path, cwd, pid, tag?, tty?, createdAt, expiresAt, always, stdin, rootOnly, userWritable?, routeSha256?, validate?, timestamp: true }`: the caller's name and real uid, the target user, the argv as typed, the resolved `path`, the caller's directory, pid, tag and terminal, and the times in ms. `always` is whether an `'always'` answer can be recorded: `false` when the argv, the path, the directory or a user-writable file's path has a control character (`\p{Cc}`, U+0085 included) or a line or paragraph separator (U+2028, U+2029), which a policy line can't hold, and `true` otherwise; nothing else sets it. `stdin` (`SudoStdin`) is what the caller's standard input is: `'tty'` (a terminal, possibly a pseudo-terminal a program drives), `'none'` (closed or `/dev/null`), `'pipe'` (a pipe, socket or other stream) or `'file'` (a file or another device). `rootOnly` maps the directory, and each argument (and the value of each `--opt=value`) that is an absolute path or names an existing path relative to the directory, resolved against it (`..` collapsed, links not followed), to whether it reaches that path through no symlink (none before a `..` either) and that path, or its nearest existing parent if it is missing, and every directory above it are root's, no symlink, and writable by root only (the stricter no-symlink test that policy files must pass), at most 64 entries from the first 256 arguments. `userWritable`, there only when the command has [user-writable files](#sudo), lists each as `{ path, sha256 }` (`SudoFile`), the command first, so the approver can show that the caller can change what it approves, and what it holds now: the command runs only with those contents. `routeSha256` is the route digest described above, omitted when the hashed paths are all direct
|
|
1410
|
+
- **Approval:** `approve(req, { signal })` gets `{ id, kind: 'sudo', user, uid, target, argv, path, cwd, pid, tag?, tty?, createdAt, expiresAt, always, stdin, rootOnly, userWritable?, routeSha256?, chainSha256?, validate?, timestamp: true }`: the caller's name and real uid, the target user, the argv as typed, the resolved `path`, the caller's directory, pid, tag and terminal, and the times in ms. `always` is whether an `'always'` answer can be recorded: `false` when the argv, the path, the directory or a user-writable file's path has a control character (`\p{Cc}`, U+0085 included) or a line or paragraph separator (U+2028, U+2029), which a policy line can't hold, and `true` otherwise; nothing else sets it. `stdin` (`SudoStdin`) is what the caller's standard input is: `'tty'` (a terminal, possibly a pseudo-terminal a program drives), `'none'` (closed or `/dev/null`), `'pipe'` (a pipe, socket or other stream) or `'file'` (a file or another device). `rootOnly` maps the directory, and each argument (and the value of each `--opt=value`) that is an absolute path or names an existing path relative to the directory, resolved against it (`..` collapsed, links not followed), to whether it reaches that path through no symlink (none before a `..` either) and that path, or its nearest existing parent if it is missing, and every directory above it are root's, no symlink, and writable by root only (the stricter no-symlink test that policy files must pass), at most 64 entries from the first 256 arguments. `userWritable`, there only when the command has [user-writable files](#sudo), lists each as `{ path, sha256 }` (`SudoFile`), the command first, so the approver can show that the caller can change what it approves, and what it holds now: the command runs only with those contents. `routeSha256` is the route digest described above, omitted when the hashed paths are all direct. For an interpreted command `chainSha256` identifies the script paths, interpreter words, binfmt manifests and final interpreter entry. Pass both digests back unchanged for `sudoRun`. An older saved request for an interpreted command without the chain digest needs a fresh request. File facts have their own 1 MiB budget (UTF-8 path bytes plus 66 bytes per digest and separators), not the 256-argument `rootOnly` limit. A request too large to replay fails with `E2BIG` before the approval hook is called. A hash-bound rule also needs to be recorded again if additional writable manifests now enter its binding. These are facts for the approver, which decides what to offer; the kernel keeps no list of commands. `timestamp: true`, on every request, says this kernel takes the answer `{ answer: 'once' | 'always', timestamp: true }` (`SudoApproval`), which means a person approved, and `validate: true` marks the request of a `sudo -v`, with `argv: []`, `path: ''`, `always: false` and `rootOnly: {}`: it asks to start a timestamp for `user` and runs nothing (see [Sudo timestamps](#sudo-timestamps)). It answers `'once'` (run it), `'always'` (run it, and append `NOPASSWD <user> (<target>) Cwd <dir> Stdin none [RouteSha256 <sha256>] [Sha256 <file>=<sha256>…] Cmnd <path> <args…>` to `/etc/sudoers.d/<user>`, each argument a literal (a `*` written as `\*`), `""` for a call without arguments, and one `Sha256` for each user-writable file, root's `0440`, so it's never asked again for this command, these arguments and these contents, in this directory, with no input or at a terminal; if a user-writable file changed while the request waited, nothing is recorded or run (`sudo: <file> changed since it was approved`); if that can't be written, nothing runs and `sudo` fails with `sudo: the rule could not be recorded`. A command line whose `always` was `false` runs once and records nothing, and `sudo` prints `sudo: ran once; this command line can't be recorded as always` on standard error before the command starts) or `'deny'`, or a denial that says who refused and why, `{ answer: 'deny', message: 'sudo: denied by the approval judge: <reason>' }` (`SudoDenial`): `sudo` prints the message (`EACCES`) on one line, with line breaks and tabs turned into spaces, other control characters removed, and cut to 500 characters (the last one `…`), when it starts with `sudo: ` and says something after it; otherwise, and for a throw, any other answer or no hook at all, it prints `sudo: approval denied`. After 5 minutes the request expires (`signal` aborts with `'expired'`, and `sudo` fails with `sudo: the request expired`); when the requester ends or gets a signal while it waits, `^C` included, `signal` aborts with `'withdrawn'` and `sudo` ends with that signal's status. `sudo: the request was withdrawn` means it was interrupted before any answer came: an answer the hook gave before the abort (its promise had settled) is reported, so a denial still prints its message, while `'once'` or `'always'` runs nothing once the requester has gone, and reads withdrawn (or expired); an answer after the abort is ignored. A user has at most one request waiting; another fails with `sudo: another request is pending`. On the page, `createKernel` relays the request from the kernel worker and back (a denial as `{ answer, message }` and a person's approval as `{ answer, timestamp: true }`, without any other field; any other object reads as a denial, as before), and the abort too, and what counts as first is what reaches the kernel worker first; `terminate()` or a failed worker aborts every request still waiting with `'withdrawn'`.
|
|
1411
1411
|
- **What `'always'` covers:** the same command with the same arguments in the same directory, with no input or at a terminal, and, when the command has user-writable files, with the same contents (once one of them changes, the rule no longer matches and `sudo` asks again, or refuses when no other line allows it), so a relative argument (`tee config.toml`) can't be pointed elsewhere by running it from another directory, and piped or redirected input (a pipe, a file) asks again; a terminal counts as no input, even one a program drives through a pseudo-terminal. It doesn't make a command that writes, or an interpreter (`bash -c`, `tee`, `cp`), safe to allow: what such a command touches depends on the files it is given, which the caller may control (a symlink, a file it owns). Keep `'always'` to commands that are safe in any state of the files they're given. Lines that kernels before `Cwd` recorded have no `Cwd`, so they match in any directory; to drop them, rewrite `/etc/sudoers.d/<user>` as root.
|
|
1412
1412
|
- **Running:** the command runs as the caller's child, with all six ids and the groups of the target user, in the caller's directory, on its terminal, standard input, output and error, in a **process group of its own** in the caller's session, as sudo(8) runs it without a pty. When `sudo` has the terminal's foreground, it hands the terminal to the command's group, so `^C`, `^\` and `^Z` reach the command, and takes it back when the command stops or ends. `sudo` exits with the command's status, and passes `SIGTERM`, `SIGHUP`, `SIGINT`, `SIGQUIT`, `SIGUSR1`, `SIGUSR2` and `SIGALRM` on to the command's whole group, so its children get them too; it installs these relays before it asks, so one that comes while the command starts is passed on once it runs (the kernel lets `sudo` signal the group of the command it started, which its own user may not). When the command stops (`^Z`), `sudo` stops by the same signal, so the shell's `jobs`, `fg` and `bg` work on it; when it is continued, it hands the terminal back to the command if it is in the foreground (`fg`) and continues the command's group. A `sudo` killed with `-9` leaves the command running in its group, as sudo(8) does, and the shell takes the terminal back as for any job;
|
|
1413
1413
|
- **Symlinks:** a command `sudo` started, and every process it starts in turn, follows a symlink only when root or the target user owns it: Linux's `protected_symlinks`, applied in every directory rather than only in sticky world-writable ones. Any other link is `EACCES`, and the denial names the link. That holds in every runtime: in the kernel's own path walk (JS programs' `ctx.fs` and `ctx.open`, WASI paths, `exec` and `cd` by path), in an Emscripten program's lookups (where the denial's op is `follow`), and where a WASI program resolves `..` itself. So a link the caller put where a rule's file or directory is expected (`/tmp/k4l` → `/etc/fnox`, or `config.toml` → `/etc/fnox/config.toml` in the caller's own directory) leads nowhere. `readlink`, `ls -l`, `lstat`, and removing or renaming a link still work, since they don't follow it.
|
|
@@ -1438,14 +1438,14 @@ As in sudo(8), a person's approval is remembered for a few minutes: until then,
|
|
|
1438
1438
|
|
|
1439
1439
|
A request can end without an answer: nobody was there within the 5 minutes, and `sudo` failed with `sudo: the request expired`. The owner may still want it to run. `kernel.sudoRun(request, options)`, and `client.sudoRun` on a root client, run it then, as if the answer had been `'once'`, without the caller's shell, which has moved on.
|
|
1440
1440
|
|
|
1441
|
-
- **The request** is the object `approve` got, passed back as it is (`SudoReplay`: its `id`, `user`, `uid`, `target`, `argv`, `path`, `cwd`, `stdin`, `rootOnly`, `userWritable`, `routeSha256`, `tag`, `tags` and `validate`; other fields are ignored). The kernel keeps nothing of a request, so a request saved before a reload still runs, and every call runs it once more: running it at most once is the caller's to keep. It trusts none of the fields: it runs the decision again and refuses whatever has changed. Something that isn't such a request is `EINVAL` (`sudo: that isn't a sudo request this kernel can run`): a field missing or of the wrong type (`rootOnly` included, `{}` for none), an `argv` that is empty, holds a NUL or is over 4096 words or 1 MiB, and a `path` or `cwd` that isn't absolute, holds a NUL or is longer than 4096 characters. A kernel whose `users` isn't `'enforce'` refuses it too.
|
|
1441
|
+
- **The request** is the object `approve` got, passed back as it is (`SudoReplay`: its `id`, `user`, `uid`, `target`, `argv`, `path`, `cwd`, `stdin`, `rootOnly`, `userWritable`, `routeSha256`, `chainSha256`, `tag`, `tags` and `validate`; other fields are ignored). The kernel keeps nothing of a request, so a request saved before a reload still runs, and every call runs it once more: running it at most once is the caller's to keep. It trusts none of the fields: it runs the decision again and refuses whatever has changed. Something that isn't such a request is `EINVAL` (`sudo: that isn't a sudo request this kernel can run`): a field missing or of the wrong type (`rootOnly` included, `{}` for none), an `argv` that is empty, holds a NUL or is over 4096 words or 1 MiB, and a `path` or `cwd` that isn't absolute, holds a NUL or is longer than 4096 characters. A kernel whose `users` isn't `'enforce'` refuses it too.
|
|
1442
1442
|
- **What it refuses outright** (`EINVAL`): a `sudo -v` request (`sudo: a sudo -v request runs no command`), and one whose `stdin` was `'pipe'` or `'file'`, since that input is gone (`sudo: the request read a pipe, and that input is gone`).
|
|
1443
1443
|
- **What it checks again,** in this order, before anything runs:
|
|
1444
1444
|
- `user` still exists, with `uid` (`ENOENT`, `sudo: unknown user <user>`; `EPERM`, `sudo: <user> is no longer uid <uid>`), and so does `target` (`ENOENT`).
|
|
1445
1445
|
- A policy line still lets `user` ask for `path` with these arguments as `target`, in `cwd`, with the contents in `userWritable`, `NOPASSWD` or not (`EACCES`, `sudo: <user> may no longer ask to run <command> as <target>`). There is no caller process any more, so its groups are the ones `/etc/group` gives the user now: a user taken out of `sudo` since can't have its old request run. A root user's request passes, as root's `sudo` does.
|
|
1446
1446
|
- `cwd` resolves to the same real path (`EACCES`, `sudo: <cwd> changed since it was requested`), and `user` may still enter it (`EACCES`, `sudo: cannot run in <cwd>: it isn't a directory <user> can enter`). Both are checked once more just before the command starts, as for a command `sudo` starts, and a directory that no longer resolves to itself then (a symlink swapped in meanwhile) is refused with the first sentence, so the command never runs somewhere else.
|
|
1447
1447
|
- The first word of `argv` still finds `path`, by the same search as `sudo`'s (`ENOENT`, `sudo: <word>: command not found`; `EPERM`, `sudo: <word> now runs <path now>, not <path>`).
|
|
1448
|
-
- The command's user-writable files are the same files with the same sha256 as in `userWritable`, with the same requested-to-real path bindings (`routeSha256`) (`EPERM`, `sudo: <file> changed since it was requested`).
|
|
1448
|
+
- The command's user-writable files are the same files with the same sha256 as in `userWritable`, with the same requested-to-real path bindings (`routeSha256`) and interpreter chain (`chainSha256`) (`EPERM`, `sudo: <file> changed since it was requested`).
|
|
1449
1449
|
- No entry of `rootOnly` that was `true` is false now (`EPERM`, `sudo: <path> is no longer root-only`).
|
|
1450
1450
|
- **How it runs:** as `sudo` would have run it, as `target` with all six ids and its groups, with `sudo`'s environment (`SUDO_USER`, `SUDO_COMMAND`, the fixed `PATH` and the rest) and the caller's umask, but none of the variables `env_keep` names (the request holds no environment, so there is nothing to copy them from), in `cwd`, with the [symlink rule](#sudo) for it and everything it starts, and the binding of its user-writable files checked once more when the kernel loads them. It isn't the child of any process: it leads a session and a process group of its own (`pgid` and its session are its `pid`, its parent is pid 1), has no terminal, and reads `/dev/null`. It has every tag of the request, in their order, after the tag of the client's connection, and then `tag` (a string or a list of at most 8), so `ps` and [`trace`](#clienttracetag-onevents--limit---promise-close-) show it as the agent's and the run's: give each run a tag of its own (`sudo-run:<id>`) and subscribe to it before the call.
|
|
1451
1451
|
- **Output:** `stdout` and `stderr` are absolute paths that the kernel opens as `user`, as the caller's shell opens `sudo command > file`: the caller must be able to write the file, or create it in its directory (`EACCES`, `sudo: <path>: Permission denied`; a missing directory is `ENOENT`, `sudo: <path>: No such file or directory`, since the kernel makes none), a symlink on the way must be root's or the caller's, and the file is truncated, or created as the caller's with mode `0600`. Once the kernel holds the file, it checks the path again, and refuses one that changed meanwhile (a symlink in its place: `EACCES`, `sudo: <path> changed while it was opened`). The same path for both opens one file, as `> file 2>&1` does. Without them, output goes to `/dev/null`. Because the output goes to files, not to the client, the run doesn't depend on the client: it goes on when the client detaches or its worker restarts, and nothing kills it for writing to a reader that is gone.
|
package/dist/async-process.js
CHANGED
|
@@ -1437,7 +1437,7 @@ function createParentRefreshCount() {
|
|
|
1437
1437
|
}
|
|
1438
1438
|
|
|
1439
1439
|
// src/version.ts
|
|
1440
|
-
var KERNEL_VERSION = true ? "1.195.
|
|
1440
|
+
var KERNEL_VERSION = true ? "1.195.31" : "0.0.0-dev";
|
|
1441
1441
|
var OS_RELEASE = "6.0.0-slicc";
|
|
1442
1442
|
function procVersion() {
|
|
1443
1443
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|