@ai-ecoverse/slicc-kernel 1.176.1 → 1.177.0
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 +29 -8
- package/dist/index.js +8 -1
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +371 -59
- package/dist/kernel-worker.js.map +4 -4
- package/dist/meta.js.map +2 -2
- package/dist/node-process-worker.cjs +1 -1
- package/dist/node-process-worker.cjs.map +2 -2
- package/dist/node-process-worker.js +1 -1
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +372 -59
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +1 -1
- package/dist/process-worker.js.map +2 -2
- package/dist/types/fs/types.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/launcher.d.ts +5 -0
- package/dist/types/node.d.ts +6 -1
- package/dist/types/process/js/js-context.d.ts +2 -0
- package/dist/types/sudo-timestamp.d.ts +28 -0
- package/dist/types/sudo.d.ts +20 -1
- package/dist/types/sudoers.d.ts +25 -2
- package/package.json +3 -3
package/dist/types/fs/types.d.ts
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export type { JsCred, JsSyncContext, JsSyncFile } from './process/js/js-sync.js'
|
|
|
44
44
|
export type { JsThread, JsThreadContext, JsThreadSpawnOptions } from './process/js/js-thread.js';
|
|
45
45
|
export type { JsTermios, JsTty, JsTtySize } from './process/js/js-tty.js';
|
|
46
46
|
export type { JsWebSocket, JsWebSocketClose, JsWebSocketMessage, JsWebSocketOptions, } from './process/js/js-websocket.js';
|
|
47
|
-
export type { ApproveHook, SudoAnswer, SudoDenial, SudoRequest, SudoStdin } from './sudo.js';
|
|
47
|
+
export type { ApproveHook, SudoAnswer, SudoApproval, SudoDenial, SudoReply, SudoRequest, SudoStdin, } from './sudo.js';
|
|
48
48
|
export { type FetchTransportOptions, fetchTransport, type HeaderList, type NetworkExit, type NetworkRedirectPolicy, type NetworkRequest, type NetworkResponse, type NetworkTraits, type NetworkTransport, type NetworkWebSocket, type NetworkWebSocketRequest, } from './transport.js';
|
|
49
49
|
export type { Account, AddGroup, AddUser, Group, RemoveUser } from './users.js';
|
|
50
50
|
export interface NetworkOptions {
|
package/dist/types/launcher.d.ts
CHANGED
|
@@ -76,6 +76,9 @@ export interface LauncherOptions {
|
|
|
76
76
|
embedder?: EmbedderHook;
|
|
77
77
|
approve?: ApproveHook;
|
|
78
78
|
sudoTimeoutMs?: number;
|
|
79
|
+
sudoClock?: {
|
|
80
|
+
now(): number;
|
|
81
|
+
};
|
|
79
82
|
protect?: Protection;
|
|
80
83
|
cron?: CronOptions;
|
|
81
84
|
moduleUrl?: ModuleUrlMaker;
|
|
@@ -395,6 +398,8 @@ export declare class Launcher {
|
|
|
395
398
|
private threadsOf;
|
|
396
399
|
private crontab;
|
|
397
400
|
private sudo;
|
|
401
|
+
private timestampOwner;
|
|
402
|
+
private startedOf;
|
|
398
403
|
private visudo;
|
|
399
404
|
private spawner;
|
|
400
405
|
private childGroup;
|
package/dist/types/node.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export type { ConnectorStamp } from './kernel/socket.js';
|
|
|
33
33
|
export type { HostfsEvent, HostfsGrant, HostfsGrantHook, HostfsPortGrant, HostfsTransport, } from './mount/hostfs.js';
|
|
34
34
|
export { serveHostfsPort } from './mount/hostfs.js';
|
|
35
35
|
export type { MountEntry, MountSpec } from './mount/mount-fs.js';
|
|
36
|
-
export type { ApproveHook, SudoAnswer, SudoDenial, SudoRequest, SudoStdin } from './sudo.js';
|
|
36
|
+
export type { ApproveHook, SudoAnswer, SudoApproval, SudoDenial, SudoReply, SudoRequest, SudoStdin, } from './sudo.js';
|
|
37
37
|
export type { NetworkRedirectPolicy } from './transport.js';
|
|
38
38
|
export { fetchTransport, type NetworkTransport } from './transport.js';
|
|
39
39
|
export { memoryRoot };
|
|
@@ -70,6 +70,11 @@ export interface NodeKernelOptions {
|
|
|
70
70
|
cron?: {
|
|
71
71
|
clock?: CronClock;
|
|
72
72
|
};
|
|
73
|
+
sudo?: {
|
|
74
|
+
clock?: {
|
|
75
|
+
now(): number;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
73
78
|
compileCache?: string | false;
|
|
74
79
|
warmWorker?: boolean;
|
|
75
80
|
warmWorkers?: number;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TimestampType } from './sudoers.js';
|
|
2
|
+
export declare const TIMESTAMPS_MAX = 64;
|
|
3
|
+
export interface TimestampOwner {
|
|
4
|
+
uid: number;
|
|
5
|
+
terminal?: {
|
|
6
|
+
tty: string;
|
|
7
|
+
sid: number;
|
|
8
|
+
started: number;
|
|
9
|
+
} | undefined;
|
|
10
|
+
parent?: {
|
|
11
|
+
pid: number;
|
|
12
|
+
started: number;
|
|
13
|
+
} | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface TimestampPolicy {
|
|
16
|
+
type: TimestampType;
|
|
17
|
+
minutes: number;
|
|
18
|
+
}
|
|
19
|
+
export declare function timestampKey(owner: TimestampOwner, type: TimestampType): string | undefined;
|
|
20
|
+
export declare class Timestamps {
|
|
21
|
+
private readonly users;
|
|
22
|
+
private readonly now;
|
|
23
|
+
constructor(now: () => number);
|
|
24
|
+
current(owner: TimestampOwner, policy: TimestampPolicy): boolean;
|
|
25
|
+
stamp(owner: TimestampOwner, policy: TimestampPolicy): boolean;
|
|
26
|
+
invalidate(owner: TimestampOwner, type: TimestampType): void;
|
|
27
|
+
remove(uid: number): void;
|
|
28
|
+
}
|
package/dist/types/sudo.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { KernelFs, UsersMode } from './fs/types.js';
|
|
2
2
|
import type { Cred } from './kernel/cred.js';
|
|
3
|
+
import { type TimestampOwner } from './sudo-timestamp.js';
|
|
3
4
|
import { type UserDb } from './users.js';
|
|
4
5
|
export { SUDOERS, SUDOERS_D } from './sudoers.js';
|
|
5
6
|
export declare const SECURE_PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
|
|
@@ -23,6 +24,8 @@ export interface SudoRequest {
|
|
|
23
24
|
always: boolean;
|
|
24
25
|
stdin?: SudoStdin;
|
|
25
26
|
rootOnly?: Record<string, boolean>;
|
|
27
|
+
validate?: true;
|
|
28
|
+
timestamp?: true;
|
|
26
29
|
}
|
|
27
30
|
export type SudoStdin = 'tty' | 'none' | 'pipe' | 'file';
|
|
28
31
|
export type SudoAnswer = 'once' | 'always' | 'deny';
|
|
@@ -30,9 +33,14 @@ export interface SudoDenial {
|
|
|
30
33
|
answer: 'deny';
|
|
31
34
|
message: string;
|
|
32
35
|
}
|
|
36
|
+
export interface SudoApproval {
|
|
37
|
+
answer: 'once' | 'always';
|
|
38
|
+
timestamp: true;
|
|
39
|
+
}
|
|
40
|
+
export type SudoReply = SudoAnswer | SudoDenial | SudoApproval;
|
|
33
41
|
export type ApproveHook = (req: SudoRequest, options: {
|
|
34
42
|
signal: AbortSignal;
|
|
35
|
-
}) =>
|
|
43
|
+
}) => SudoReply | Promise<SudoReply>;
|
|
36
44
|
export interface SudoCall {
|
|
37
45
|
op: 'proc-sudo';
|
|
38
46
|
args: string[];
|
|
@@ -54,6 +62,8 @@ export type SudoResult = {
|
|
|
54
62
|
list: string;
|
|
55
63
|
} | {
|
|
56
64
|
run: string[];
|
|
65
|
+
} | {
|
|
66
|
+
done: true;
|
|
57
67
|
} | {
|
|
58
68
|
grant: SudoGrant;
|
|
59
69
|
notice?: string;
|
|
@@ -63,6 +73,8 @@ export interface SudoCaller {
|
|
|
63
73
|
pid: number;
|
|
64
74
|
tags?: readonly string[] | undefined;
|
|
65
75
|
tty?: string | null | undefined;
|
|
76
|
+
terminal?: TimestampOwner['terminal'];
|
|
77
|
+
parent?: TimestampOwner['parent'];
|
|
66
78
|
stdin: SudoStdin;
|
|
67
79
|
report?: ((line: string) => Promise<void>) | undefined;
|
|
68
80
|
}
|
|
@@ -89,11 +101,13 @@ export interface SudoOptions {
|
|
|
89
101
|
approve?: ApproveHook | undefined;
|
|
90
102
|
timeoutMs?: number | undefined;
|
|
91
103
|
warn?: (message: string) => void;
|
|
104
|
+
now?: (() => number) | undefined;
|
|
92
105
|
}
|
|
93
106
|
export declare class Sudo {
|
|
94
107
|
private readonly o;
|
|
95
108
|
private readonly warned;
|
|
96
109
|
private readonly pending;
|
|
110
|
+
private readonly timestamps;
|
|
97
111
|
private next;
|
|
98
112
|
constructor(options: SudoOptions);
|
|
99
113
|
private warn;
|
|
@@ -114,6 +128,11 @@ export declare class Sudo {
|
|
|
114
128
|
private untrusted;
|
|
115
129
|
private locate;
|
|
116
130
|
request(caller: SudoCaller, call: SudoCall, signal: AbortSignal): Promise<SudoResult>;
|
|
131
|
+
private command;
|
|
132
|
+
private validate;
|
|
133
|
+
private pendingFor;
|
|
134
|
+
private stamped;
|
|
135
|
+
private logged;
|
|
117
136
|
private always;
|
|
118
137
|
private listed;
|
|
119
138
|
private ask;
|
package/dist/types/sudoers.d.ts
CHANGED
|
@@ -16,8 +16,27 @@ export interface Rule {
|
|
|
16
16
|
stdin?: 'none';
|
|
17
17
|
cmnd: Command | '*';
|
|
18
18
|
}
|
|
19
|
+
export type TimestampType = 'tty' | 'ppid' | 'global';
|
|
20
|
+
export interface Settings {
|
|
21
|
+
timestampTimeout?: number;
|
|
22
|
+
timestampType?: TimestampType;
|
|
23
|
+
}
|
|
24
|
+
export interface DefaultsEntry {
|
|
25
|
+
who: string[] | null;
|
|
26
|
+
settings: Settings;
|
|
27
|
+
params: string[];
|
|
28
|
+
}
|
|
29
|
+
export interface Resolved {
|
|
30
|
+
timestampTimeout: number;
|
|
31
|
+
timestampType: TimestampType;
|
|
32
|
+
matching: DefaultsEntry[];
|
|
33
|
+
}
|
|
34
|
+
export declare const TIMESTAMP_TIMEOUT = 5;
|
|
35
|
+
export declare const TIMESTAMP_TYPE: TimestampType;
|
|
19
36
|
export type PolicyLine = {
|
|
20
37
|
rules: Rule[];
|
|
38
|
+
} | {
|
|
39
|
+
defaults: DefaultsEntry;
|
|
21
40
|
} | {
|
|
22
41
|
error: string;
|
|
23
42
|
} | null;
|
|
@@ -26,12 +45,16 @@ export declare function splitWords(text: string): string[] | undefined;
|
|
|
26
45
|
export declare function quoteWord(word: string): string;
|
|
27
46
|
export declare function commandMatches(cmnd: Command | '*', argv: readonly string[]): boolean;
|
|
28
47
|
export declare function commandText(cmnd: Command): string;
|
|
48
|
+
export declare function resolveDefaults(entries: readonly DefaultsEntry[], applies: (who: string) => boolean): Resolved;
|
|
49
|
+
export declare function defaultsText(entries: readonly DefaultsEntry[]): string[];
|
|
29
50
|
export declare function parseLine(line: string, file?: string): PolicyLine;
|
|
30
51
|
export interface PolicyError {
|
|
31
52
|
line: number;
|
|
32
53
|
message: string;
|
|
33
54
|
}
|
|
34
|
-
export
|
|
55
|
+
export interface Policy {
|
|
35
56
|
rules: Rule[];
|
|
57
|
+
defaults: DefaultsEntry[];
|
|
36
58
|
errors: PolicyError[];
|
|
37
|
-
}
|
|
59
|
+
}
|
|
60
|
+
export declare function parsePolicy(text: string, file?: string): Policy;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-kernel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.177.0",
|
|
4
4
|
"description": "SLICC's wasm-realm kernel: run Emscripten programs in the browser against OPFS, with fork, spawn, pipes and waitpid",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@ai-ecoverse/py-numpy": "2.5.4-4",
|
|
73
|
-
"@ai-ecoverse/slicc-cdp": "1.
|
|
73
|
+
"@ai-ecoverse/slicc-cdp": "1.47.2",
|
|
74
74
|
"@ai-ecoverse/slicc-scrub": "1.1.0",
|
|
75
75
|
"@ai-ecoverse/slicc-shared-web": "2.13.10",
|
|
76
76
|
"@ai-ecoverse/wasi-cargo": "0.99.0-6",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@ai-ecoverse/wasi-ripgrep": "15.2.0-5",
|
|
79
79
|
"@ai-ecoverse/wasi-rustc": "1.98.1-10",
|
|
80
80
|
"@ai-ecoverse/wasi-zig": "0.16.0-20",
|
|
81
|
-
"@ai-ecoverse/wasix-python": "3.15.0-
|
|
81
|
+
"@ai-ecoverse/wasix-python": "3.15.0-8",
|
|
82
82
|
"@ai-ecoverse/wasm-bash": "5.3.0-23",
|
|
83
83
|
"@ai-ecoverse/wasm-coreutils": "9.12.0-15",
|
|
84
84
|
"@ai-ecoverse/wasm-curl": "8.22.0-10",
|