@arcforge/kernel 2.0.191 → 2.0.193
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/package.json +8 -8
- package/src/mediation.ts +29 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcforge/kernel",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.193",
|
|
4
4
|
"description": "The Axon kernel — ring 0. Owns resources and execution, enforces policy, and is the only constructor of the unprivileged capsule.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"deploy": "echo \"This package is published ONLY by apps/tui/scripts/release.ts, which pins workspace:* deps to concrete versions first. Publishing it directly ships an unresolvable dependency.\" && exit 1"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@arcforge/air": "2.0.
|
|
19
|
-
"@arcforge/engines": "2.0.
|
|
20
|
-
"@arcforge/err": "2.0.
|
|
21
|
-
"@arcforge/session": "2.0.
|
|
22
|
-
"@arcforge/types": "2.0.
|
|
23
|
-
"@arcforge/cloud": "2.0.
|
|
24
|
-
"@arcforge/capsule": "2.0.
|
|
18
|
+
"@arcforge/air": "2.0.193",
|
|
19
|
+
"@arcforge/engines": "2.0.193",
|
|
20
|
+
"@arcforge/err": "2.0.193",
|
|
21
|
+
"@arcforge/session": "2.0.193",
|
|
22
|
+
"@arcforge/types": "2.0.193",
|
|
23
|
+
"@arcforge/cloud": "2.0.193",
|
|
24
|
+
"@arcforge/capsule": "2.0.193"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/bun": "latest",
|
package/src/mediation.ts
CHANGED
|
@@ -122,13 +122,36 @@ export function Mediation(opts: MediationOpts) {
|
|
|
122
122
|
return false
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
return await escalate(fn, subject, args, owner, String(rule))
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Ask, record, and report the answer.
|
|
130
|
+
*
|
|
131
|
+
* Extracted from `check()` because two callers need it and only one of them
|
|
132
|
+
* should go through rule resolution first. `shell()` has ALREADY decided —
|
|
133
|
+
* `decideShell` weighed the shell policy and returned "escalate" — and
|
|
134
|
+
* routing that through `check()` re-resolved a TOOLS rule for an address
|
|
135
|
+
* like `shell.run:axon`, found nothing (there is no tools rule for a
|
|
136
|
+
* program), and denied by omission. The escalate verdict was computed,
|
|
137
|
+
* discarded, and turned into the very refusal it exists to avoid; the
|
|
138
|
+
* prompt was never reached.
|
|
139
|
+
*/
|
|
140
|
+
async function escalate(
|
|
141
|
+
fn: string,
|
|
142
|
+
subject: string,
|
|
143
|
+
args: unknown[],
|
|
144
|
+
owner: string,
|
|
145
|
+
rule: string,
|
|
146
|
+
): Promise<boolean> {
|
|
147
|
+
void subject
|
|
125
148
|
// Escalate — a human decision, and the one thing the OS wall cannot
|
|
126
149
|
// express. Fails CLOSED, and RECORDS the timeout: this layer's whole
|
|
127
150
|
// remaining job is escalation and audit, so an escalation that expired
|
|
128
151
|
// with nothing written is a hole in its only function.
|
|
129
152
|
const id = randomUUID()
|
|
130
153
|
await opts.session.commit("process:policy:escalation", {
|
|
131
|
-
id, commandId: commandId() || null, module: owner, fn, args, rule
|
|
154
|
+
id, commandId: commandId() || null, module: owner, fn, args, rule,
|
|
132
155
|
}, span())
|
|
133
156
|
|
|
134
157
|
const started = Date.now()
|
|
@@ -214,7 +237,7 @@ export function Mediation(opts: MediationOpts) {
|
|
|
214
237
|
// it: a chain is invisible once split (a newline becomes whitespace, a
|
|
215
238
|
// quote disappears), and deciding without it means deciding about the
|
|
216
239
|
// first program while `/bin/sh -c` runs the rest.
|
|
217
|
-
const decision = decideShell(opts.policy().shell, argv,
|
|
240
|
+
const decision = decideShell(opts.policy().shell, argv, command)
|
|
218
241
|
if (decision.verdict === "allow") return decision
|
|
219
242
|
|
|
220
243
|
const fn = `shell.run:${decision.program}`
|
|
@@ -227,7 +250,10 @@ export function Mediation(opts: MediationOpts) {
|
|
|
227
250
|
return decision
|
|
228
251
|
}
|
|
229
252
|
|
|
230
|
-
|
|
253
|
+
// Straight to the ask. `decideShell` already weighed the shell policy;
|
|
254
|
+
// `check()` would start over against the TOOLS map, where a program
|
|
255
|
+
// address has no rule by construction, and deny by omission.
|
|
256
|
+
const allowed = await escalate(fn, subject, argv, owner, decision.reason)
|
|
231
257
|
return allowed ? { ...decision, verdict: "allow" } : { ...decision, verdict: "deny" }
|
|
232
258
|
}
|
|
233
259
|
|