talentos 1.4.17 → 1.4.18
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.
|
@@ -18,6 +18,10 @@ export const PROBE_REVISION = 3;
|
|
|
18
18
|
// wait for the room server passes.
|
|
19
19
|
export const SLOW_LIST_MS = 1500;
|
|
20
20
|
const RESOURCE_REFUSAL = /Method not found|unknown MCP server/u;
|
|
21
|
+
// Codex 0.165+ refuses a read aimed at a server it does not have with this line
|
|
22
|
+
// alone, without the "resources/read failed:" prefix older ones put first
|
|
23
|
+
// (#14551). Exactly this line: anything longer could carry a resource.
|
|
24
|
+
const BARE_UNKNOWN_SERVER = /^unknown MCP server '[\w.-]+'$/u;
|
|
21
25
|
const INPUT_TYPES = new Set([
|
|
22
26
|
"message",
|
|
23
27
|
"reasoning",
|
|
@@ -466,8 +470,9 @@ async function proveCodexBoundary(binary, version, catalog, stop, web = false) {
|
|
|
466
470
|
}
|
|
467
471
|
}
|
|
468
472
|
else if (typeof output.output !== "string" ||
|
|
469
|
-
!output.output.startsWith("resources/read failed:")
|
|
470
|
-
|
|
473
|
+
!((output.output.startsWith("resources/read failed:") &&
|
|
474
|
+
RESOURCE_REFUSAL.test(output.output)) ||
|
|
475
|
+
BARE_UNKNOWN_SERVER.test(output.output)) ||
|
|
471
476
|
text.includes(nonce)) {
|
|
472
477
|
throw new Error("Resource helper did not refuse");
|
|
473
478
|
}
|
|
@@ -27,8 +27,12 @@ const asRefusedBy = (value) => Array.isArray(value) &&
|
|
|
27
27
|
function parseReport(line) {
|
|
28
28
|
try {
|
|
29
29
|
const value = JSON.parse(line);
|
|
30
|
-
if (value.touch === true || value.taint === true) {
|
|
31
|
-
return {
|
|
30
|
+
if (value.touch === true || value.taint === true || value.web === true) {
|
|
31
|
+
return {
|
|
32
|
+
taint: value.taint === true,
|
|
33
|
+
touch: value.touch === true,
|
|
34
|
+
web: value.web === true,
|
|
35
|
+
};
|
|
32
36
|
}
|
|
33
37
|
}
|
|
34
38
|
catch {
|
|
@@ -59,6 +63,7 @@ function parseAsk(line) {
|
|
|
59
63
|
}
|
|
60
64
|
return;
|
|
61
65
|
}
|
|
66
|
+
const REPORT_KEYS = ["taint", "touch", "web"];
|
|
62
67
|
export class ApprovalBridge {
|
|
63
68
|
gateway;
|
|
64
69
|
onWaiting;
|
|
@@ -67,6 +72,7 @@ export class ApprovalBridge {
|
|
|
67
72
|
reported = {
|
|
68
73
|
taint: undefined,
|
|
69
74
|
touch: undefined,
|
|
75
|
+
web: undefined,
|
|
70
76
|
};
|
|
71
77
|
waiting = false;
|
|
72
78
|
polling = false;
|
|
@@ -149,23 +155,24 @@ export class ApprovalBridge {
|
|
|
149
155
|
const need = {
|
|
150
156
|
taint: flags.taint && !this.reported.taint,
|
|
151
157
|
touch: flags.touch && !this.reported.touch,
|
|
158
|
+
web: flags.web && !this.reported.web,
|
|
152
159
|
};
|
|
153
|
-
if (need.taint || need.touch) {
|
|
160
|
+
if (need.taint || need.touch || need.web) {
|
|
154
161
|
const request = this.gateway.touch(need).catch((error) => {
|
|
155
|
-
for (const key of
|
|
162
|
+
for (const key of REPORT_KEYS) {
|
|
156
163
|
if (need[key]) {
|
|
157
164
|
this.reported[key] = undefined;
|
|
158
165
|
}
|
|
159
166
|
}
|
|
160
167
|
throw error;
|
|
161
168
|
});
|
|
162
|
-
for (const key of
|
|
169
|
+
for (const key of REPORT_KEYS) {
|
|
163
170
|
if (need[key]) {
|
|
164
171
|
this.reported[key] = request;
|
|
165
172
|
}
|
|
166
173
|
}
|
|
167
174
|
}
|
|
168
|
-
const pending =
|
|
175
|
+
const pending = REPORT_KEYS.flatMap((key) => flags[key] && this.reported[key]
|
|
169
176
|
? [this.reported[key]]
|
|
170
177
|
: []);
|
|
171
178
|
Promise.all(pending)
|
|
@@ -3,7 +3,7 @@ import { appendFileSync, existsSync, lstatSync, mkdirSync, readFileSync, writeFi
|
|
|
3
3
|
import { connect } from "node:net";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import { classifyCall } from "./policy.js";
|
|
6
|
-
import { taintsJob, touchesPrivate } from "./touch.js";
|
|
6
|
+
import { readsWeb, taintsJob, touchesPrivate } from "./touch.js";
|
|
7
7
|
// The PreToolUse hook the owner-native profile installs (#10987). It is its own
|
|
8
8
|
// small entry so each tool call pays one tiny node start, not the whole CLI.
|
|
9
9
|
// Allowlist-shaped and fail-closed: any error is a denial. It never prints a
|
|
@@ -202,7 +202,8 @@ export async function runHook(jobDir, raw, holdMs = HOLD_MS) {
|
|
|
202
202
|
};
|
|
203
203
|
verdict = classifyCall(call, policy);
|
|
204
204
|
const touches = touchesPrivate(call, policy, verdict.allow);
|
|
205
|
-
const
|
|
205
|
+
const web = readsWeb(call, policy);
|
|
206
|
+
const taints = web || taintsJob(call, policy, verdict.allow ? undefined : verdict.ask);
|
|
206
207
|
if (!verdict.allow && verdict.ask && context.askSocket) {
|
|
207
208
|
const held = await holdForOwner(context.askSocket, verdict.ask, holdMs);
|
|
208
209
|
asked = held.answer;
|
|
@@ -224,6 +225,7 @@ export async function runHook(jobDir, raw, holdMs = HOLD_MS) {
|
|
|
224
225
|
(await reportTouch(context.askSocket, {
|
|
225
226
|
taint: taints,
|
|
226
227
|
touch: touches,
|
|
228
|
+
web,
|
|
227
229
|
})))) {
|
|
228
230
|
verdict = { allow: false, reason: HOOK_FAILED, tier: 2 };
|
|
229
231
|
}
|
|
@@ -152,6 +152,48 @@ export function taintsJob(call, context, asked) {
|
|
|
152
152
|
(asked?.tier === 1 && !asked.kind.split(" + ").every(isRun)) ||
|
|
153
153
|
touchesPrivate(call, context, true));
|
|
154
154
|
}
|
|
155
|
+
// Programs whose job is to bring web text in. `gh` reads issues and pull
|
|
156
|
+
// requests, which anyone can write.
|
|
157
|
+
const WEB_PROGRAMS = new Set(["curl", "gh", "http", "https", "wget", "xh"]);
|
|
158
|
+
// A tool outside the room whose name says it browses or fetches.
|
|
159
|
+
const WEB_TOOL_NAME = /browse|crawl|fetch|navigate|page|scrape|search|url|web/iu;
|
|
160
|
+
const URL_WORD = /[a-z][a-z0-9+.-]*:\/\//iu;
|
|
161
|
+
// The same programs (and a git fetch) found in a command the reader cannot parse.
|
|
162
|
+
const WEB_COMMAND = /(?:^|[\s;&|(`])(?:curl|gh|https?|wget|xh|git\s.*\b(?:clone|fetch|pull))\b/u;
|
|
163
|
+
function shellReadsWeb(source) {
|
|
164
|
+
const parsed = source ? parseShell(source) : undefined;
|
|
165
|
+
if (!parsed?.ok) {
|
|
166
|
+
// Unreadable: judged by its words, so `curl $(` still counts.
|
|
167
|
+
return URL_WORD.test(source ?? "") || WEB_COMMAND.test(source ?? "");
|
|
168
|
+
}
|
|
169
|
+
return parsed.commands.some(({ argv }) => {
|
|
170
|
+
const program = basename(argv[0]?.text ?? "");
|
|
171
|
+
// A script handed an address (`node scrape.js https://...`) reads it.
|
|
172
|
+
return (WEB_PROGRAMS.has(program) || argv.some((word) => URL_WORD.test(word.text)));
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Did this call read the web or another room (CLI 1.4.18)? Narrower than
|
|
177
|
+
* `taintsJob`: a local MCP tool, a read outside the folder or an approved
|
|
178
|
+
* script taints the job but is not this. Full access runs the owner's own
|
|
179
|
+
* scripts until a job does this, and the "It read the web" card reads it. A
|
|
180
|
+
* script that fetches without naming an address is not seen (James, 2026-11-04:
|
|
181
|
+
* everything except a push and what follows a real web read).
|
|
182
|
+
*/
|
|
183
|
+
export function readsWeb(call, context) {
|
|
184
|
+
const { tool } = call;
|
|
185
|
+
if (tool === "WebSearch" || tool === "WebFetch") {
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
if (tool.startsWith(ROOM_SERVER_PREFIX)) {
|
|
189
|
+
return (readsOtherRoom(call, context.roomId) || readsOtherRoomFile(call, context));
|
|
190
|
+
}
|
|
191
|
+
if (tool.startsWith("mcp__")) {
|
|
192
|
+
return WEB_TOOL_NAME.test(tool);
|
|
193
|
+
}
|
|
194
|
+
return (tool === "Bash" &&
|
|
195
|
+
(fetchesOutside(call) || shellReadsWeb(text(call.toolInput.command))));
|
|
196
|
+
}
|
|
155
197
|
function shellTouchesPrivate(source, inside, cwd, home) {
|
|
156
198
|
const parsed = source ? parseShell(source) : undefined;
|
|
157
199
|
if (!(parsed?.ok && inside("."))) {
|
package/package.json
CHANGED