fetchsandbox-mcp 0.4.11 → 0.5.1
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 +60 -1
- package/dist/auth.d.ts +10 -0
- package/dist/auth.js +67 -0
- package/dist/auth.js.map +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +8 -1
- package/dist/client.js.map +1 -1
- package/dist/index.js +141 -127
- package/dist/index.js.map +1 -1
- package/dist/signin.d.ts +35 -0
- package/dist/signin.js +152 -0
- package/dist/signin.js.map +1 -0
- package/dist/tools/find_bugs.d.ts +2 -0
- package/dist/tools/find_bugs.js +10 -2
- package/dist/tools/find_bugs.js.map +1 -1
- package/dist/tools/fix_bug.js +2 -2
- package/dist/tools/fix_bug.js.map +1 -1
- package/dist/tools/pack.d.ts +20 -1
- package/dist/tools/pack.js +160 -4
- package/dist/tools/pack.js.map +1 -1
- package/dist/tools/prove_fix.d.ts +15 -0
- package/dist/tools/prove_fix.js +12 -2
- package/dist/tools/prove_fix.js.map +1 -1
- package/dist/tools/submit_proof.js +3 -1
- package/dist/tools/submit_proof.js.map +1 -1
- package/package.json +13 -7
package/dist/signin.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Credentials } from "./auth.js";
|
|
2
|
+
interface DeviceCodeResponse {
|
|
3
|
+
device_code: string;
|
|
4
|
+
user_code: string;
|
|
5
|
+
verification_uri: string;
|
|
6
|
+
expires_in: number;
|
|
7
|
+
interval: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function startDeviceFlow(): Promise<DeviceCodeResponse>;
|
|
10
|
+
/** Human-facing instructions. This is what the agent shows in the IDE. */
|
|
11
|
+
export declare function signInMessage(d: DeviceCodeResponse): string;
|
|
12
|
+
/** One redemption attempt. `null` means "not yet", a throw means "start over". */
|
|
13
|
+
export declare function redeemOnce(d: DeviceCodeResponse): Promise<Credentials | null>;
|
|
14
|
+
/**
|
|
15
|
+
* Wait out a sign-in the human has already been shown. Resolves with
|
|
16
|
+
* credentials, or `null` if they are still not done — never throws on "pending",
|
|
17
|
+
* because "not finished yet" is a normal answer, not an error.
|
|
18
|
+
*/
|
|
19
|
+
export declare function awaitApproval(d: DeviceCodeResponse): Promise<Credentials | null>;
|
|
20
|
+
/**
|
|
21
|
+
* Run a tool call, handling "you need an account" without ever blocking on a
|
|
22
|
+
* code the human has not seen.
|
|
23
|
+
*
|
|
24
|
+
* First 401 -> start a flow and return the code IMMEDIATELY. The agent shows
|
|
25
|
+
* it; nothing is gained by waiting, because until that message is
|
|
26
|
+
* on screen there is nobody to approve anything.
|
|
27
|
+
* Later 401 -> they have seen it, so wait out the browser round trip, then
|
|
28
|
+
* retry the call once.
|
|
29
|
+
*
|
|
30
|
+
* If the backend has no device endpoints (an old deployment, or a client newer
|
|
31
|
+
* than the server) the original error is re-thrown untouched, so a version skew
|
|
32
|
+
* degrades to exactly today's behaviour instead of a hard wall.
|
|
33
|
+
*/
|
|
34
|
+
export declare function withSignIn<T>(call: () => Promise<T>): Promise<T>;
|
|
35
|
+
export {};
|
package/dist/signin.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sign-in handshake, run from inside a tool call.
|
|
3
|
+
*
|
|
4
|
+
* The whole design constraint is that this process cannot talk to the human.
|
|
5
|
+
* It can only RETURN something the agent will show them. So:
|
|
6
|
+
*
|
|
7
|
+
* 1. ask the backend for a code
|
|
8
|
+
* 2. return a message containing the URL and the code
|
|
9
|
+
* 3. the agent shows it; the human signs in on the website
|
|
10
|
+
* 4. poll until approved, write the key, carry on
|
|
11
|
+
*
|
|
12
|
+
* Step 4 blocks the tool call. That is intentional and it is why the poll has
|
|
13
|
+
* a hard ceiling: an agent left waiting forever is worse than a clear failure,
|
|
14
|
+
* and the human can always re-run the tool to start again.
|
|
15
|
+
*/
|
|
16
|
+
import { buildHeaders, getBaseUrl, ToolError } from "./client.js";
|
|
17
|
+
import { installId, readCredentials, writeCredentials } from "./auth.js";
|
|
18
|
+
import { detectIde } from "./session.js";
|
|
19
|
+
// Only ever used on a RETRY, when the human has already been shown the code and
|
|
20
|
+
// is mid-sign-in. Long enough to cover a browser round trip, short enough that
|
|
21
|
+
// an agent is never left hanging on someone who walked away.
|
|
22
|
+
const GRACE_POLL_MS = 45_000;
|
|
23
|
+
async function post(path, body) {
|
|
24
|
+
const res = await fetch(`${getBaseUrl()}${path}`, {
|
|
25
|
+
method: "POST",
|
|
26
|
+
// Same headers as every other call: the audit trail ties a sign-in to the
|
|
27
|
+
// install and the editor it came from, which is the whole point of it.
|
|
28
|
+
headers: buildHeaders({ "content-type": "application/json" }),
|
|
29
|
+
body: JSON.stringify(body),
|
|
30
|
+
});
|
|
31
|
+
let json = {};
|
|
32
|
+
try {
|
|
33
|
+
json = await res.json();
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
/* an empty or non-JSON body is handled by the caller via status */
|
|
37
|
+
}
|
|
38
|
+
return { status: res.status, json: json };
|
|
39
|
+
}
|
|
40
|
+
export async function startDeviceFlow() {
|
|
41
|
+
const { status, json } = await post("/api/auth/device/code", {
|
|
42
|
+
client_name: detectIde(),
|
|
43
|
+
install_id: installId(),
|
|
44
|
+
});
|
|
45
|
+
if (status !== 200 || !json?.user_code) {
|
|
46
|
+
throw new ToolError("Could not start sign-in. Check your connection and try again.", status);
|
|
47
|
+
}
|
|
48
|
+
return json;
|
|
49
|
+
}
|
|
50
|
+
/** Human-facing instructions. This is what the agent shows in the IDE. */
|
|
51
|
+
export function signInMessage(d) {
|
|
52
|
+
const url = `${d.verification_uri}?code=${encodeURIComponent(d.user_code)}`;
|
|
53
|
+
return [
|
|
54
|
+
"FetchSandbox needs a free account before it can run this.",
|
|
55
|
+
"",
|
|
56
|
+
` 1. Open ${url}`,
|
|
57
|
+
` 2. Sign in — no password, we email you a link`,
|
|
58
|
+
"",
|
|
59
|
+
`Your code is ${d.user_code}. It expires in ${Math.round(d.expires_in / 60)} minutes.`,
|
|
60
|
+
"I'll wait here and continue as soon as you're done.",
|
|
61
|
+
].join("\n");
|
|
62
|
+
}
|
|
63
|
+
/** One redemption attempt. `null` means "not yet", a throw means "start over". */
|
|
64
|
+
export async function redeemOnce(d) {
|
|
65
|
+
const { status, json } = await post("/api/auth/device/token", { device_code: d.device_code, install_id: installId() });
|
|
66
|
+
if (status === 200 && json.api_key) {
|
|
67
|
+
const creds = {
|
|
68
|
+
apiKey: json.api_key,
|
|
69
|
+
email: json.email ?? "",
|
|
70
|
+
createdAt: new Date().toISOString(),
|
|
71
|
+
};
|
|
72
|
+
writeCredentials(creds);
|
|
73
|
+
return creds;
|
|
74
|
+
}
|
|
75
|
+
const err = json?.detail?.error;
|
|
76
|
+
// "authorization_pending" is the ONLY status that means keep waiting.
|
|
77
|
+
if (err && err !== "authorization_pending") {
|
|
78
|
+
throw new ToolError(err === "expired_token"
|
|
79
|
+
? "That sign-in code expired. Run this again to get a new one."
|
|
80
|
+
: "That sign-in could not be completed. Run this again to start over.");
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Wait out a sign-in the human has already been shown. Resolves with
|
|
86
|
+
* credentials, or `null` if they are still not done — never throws on "pending",
|
|
87
|
+
* because "not finished yet" is a normal answer, not an error.
|
|
88
|
+
*/
|
|
89
|
+
export async function awaitApproval(d) {
|
|
90
|
+
const intervalMs = Math.max(2, d.interval || 5) * 1000;
|
|
91
|
+
const deadline = Date.now() + GRACE_POLL_MS;
|
|
92
|
+
// Try immediately: on a retry the approval has usually already landed.
|
|
93
|
+
let creds = await redeemOnce(d);
|
|
94
|
+
while (!creds && Date.now() < deadline) {
|
|
95
|
+
await new Promise((r) => setTimeout(r, intervalMs));
|
|
96
|
+
creds = await redeemOnce(d);
|
|
97
|
+
}
|
|
98
|
+
return creds;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A sign-in started on an earlier tool call and not yet finished. In memory
|
|
102
|
+
* only: this process outlives every individual call, and if it does restart we
|
|
103
|
+
* simply start a new flow.
|
|
104
|
+
*/
|
|
105
|
+
let pending = null;
|
|
106
|
+
/**
|
|
107
|
+
* Run a tool call, handling "you need an account" without ever blocking on a
|
|
108
|
+
* code the human has not seen.
|
|
109
|
+
*
|
|
110
|
+
* First 401 -> start a flow and return the code IMMEDIATELY. The agent shows
|
|
111
|
+
* it; nothing is gained by waiting, because until that message is
|
|
112
|
+
* on screen there is nobody to approve anything.
|
|
113
|
+
* Later 401 -> they have seen it, so wait out the browser round trip, then
|
|
114
|
+
* retry the call once.
|
|
115
|
+
*
|
|
116
|
+
* If the backend has no device endpoints (an old deployment, or a client newer
|
|
117
|
+
* than the server) the original error is re-thrown untouched, so a version skew
|
|
118
|
+
* degrades to exactly today's behaviour instead of a hard wall.
|
|
119
|
+
*/
|
|
120
|
+
export async function withSignIn(call) {
|
|
121
|
+
// Cheap, non-blocking: an approval that landed between calls is picked up here.
|
|
122
|
+
if (pending && !readCredentials()?.apiKey) {
|
|
123
|
+
const creds = await redeemOnce(pending).catch(() => null);
|
|
124
|
+
if (creds)
|
|
125
|
+
pending = null;
|
|
126
|
+
}
|
|
127
|
+
try {
|
|
128
|
+
return await call();
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
if (!(e instanceof ToolError) || e.status !== 401)
|
|
132
|
+
throw e;
|
|
133
|
+
if (pending) {
|
|
134
|
+
const creds = await awaitApproval(pending).catch(() => null);
|
|
135
|
+
if (creds) {
|
|
136
|
+
pending = null;
|
|
137
|
+
return await call();
|
|
138
|
+
}
|
|
139
|
+
throw new ToolError(signInMessage(pending), 401);
|
|
140
|
+
}
|
|
141
|
+
let started;
|
|
142
|
+
try {
|
|
143
|
+
started = await startDeviceFlow();
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
throw e; // no device endpoints — behave as before
|
|
147
|
+
}
|
|
148
|
+
pending = started;
|
|
149
|
+
throw new ToolError(signInMessage(started), 401);
|
|
150
|
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,IAAI,EAAE,CAAC;IACtB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,CAAC,CAAC,YAAY,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG;YAAE,MAAM,CAAC,CAAC;QAE3D,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;YAC7D,IAAI,KAAK,EAAE,CAAC;gBACV,OAAO,GAAG,IAAI,CAAC;gBACf,OAAO,MAAM,IAAI,EAAE,CAAC;YACtB,CAAC;YACD,MAAM,IAAI,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,OAA2B,CAAC;QAChC,IAAI,CAAC;YACH,OAAO,GAAG,MAAM,eAAe,EAAE,CAAC;QACpC,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,CAAC,CAAC,CAAC,yCAAyC;QACpD,CAAC;QACD,OAAO,GAAG,OAAO,CAAC;QAClB,MAAM,IAAI,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
|
package/dist/tools/find_bugs.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { ToolError } from "../client.js";
|
|
15
15
|
import { startAndPoll } from "./jobs.js";
|
|
16
|
-
import { packDirToBase64 } from "./pack.js";
|
|
16
|
+
import { packDirToBase64, resolveWorkspaceDir } from "./pack.js";
|
|
17
17
|
export const findBugsTool = {
|
|
18
18
|
name: "find_bugs",
|
|
19
19
|
description: "FIRST STEP for any API-integration bug — webhooks, payments, auth, email, " +
|
|
@@ -57,7 +57,7 @@ export const findBugsTool = {
|
|
|
57
57
|
// the compiler calls the addition an error rather than the loss. That is how
|
|
58
58
|
// next_actions survived three hops and died at the fourth.
|
|
59
59
|
export async function runFindBugs(input) {
|
|
60
|
-
const dir =
|
|
60
|
+
const dir = resolveWorkspaceDir(input.path);
|
|
61
61
|
const { b64, bytes } = packDirToBase64(dir);
|
|
62
62
|
const timeout_s = Math.min(Math.max(input.timeout_s ?? 300, 30), 600);
|
|
63
63
|
const body = {
|
|
@@ -91,6 +91,14 @@ export async function runFindBugs(input) {
|
|
|
91
91
|
// find_bugs result, quickrun called zero times. The routing existed at every
|
|
92
92
|
// layer except the one the agent reads.
|
|
93
93
|
next_actions: raw.next_actions ?? undefined,
|
|
94
|
+
// THE FIFTH WHITELIST. Every field the backend adds must be named
|
|
95
|
+
// here or it is invisible — this is what hid next_actions for weeks.
|
|
96
|
+
//
|
|
97
|
+
// Renamed from `notice` on 2026-09-12. A persona run proved the old name
|
|
98
|
+
// was invisible in a different way: the field arrived, and the agent
|
|
99
|
+
// relayed none of it to the person. `notice` sat beside spec and
|
|
100
|
+
// confidence, so it read as data to act on rather than words to pass on.
|
|
101
|
+
message_for_user: raw.message_for_user ?? undefined,
|
|
94
102
|
prove_instructions: raw.prove_instructions ?? undefined,
|
|
95
103
|
engine: raw.engine ?? "fetchsandbox",
|
|
96
104
|
packed_bytes: bytes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find_bugs.js","sourceRoot":"","sources":["../../src/tools/find_bugs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"find_bugs.js","sourceRoot":"","sources":["../../src/tools/find_bugs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,C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-13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { ToolError } from "../client.js";
|
|
15
15
|
import { startAndPoll } from "./jobs.js";
|
|
16
|
-
import { packDirToBase64 } from "./pack.js";
|
|
16
|
+
import { packDirToBase64, resolveWorkspaceDir } from "./pack.js";
|
|
17
17
|
export const fixBugTool = {
|
|
18
18
|
name: "fix_bug",
|
|
19
19
|
description: "FetchSandbox remediation: get a proposed fix for a specific bug in YOUR " +
|
|
@@ -60,7 +60,7 @@ export async function runFixBug(input) {
|
|
|
60
60
|
if (!input.bug || !input.bug.trim()) {
|
|
61
61
|
throw new ToolError("bug is required — pass the specific finding to fix.");
|
|
62
62
|
}
|
|
63
|
-
const dir =
|
|
63
|
+
const dir = resolveWorkspaceDir(input.path);
|
|
64
64
|
const { b64, bytes } = packDirToBase64(dir);
|
|
65
65
|
const timeout_s = Math.min(Math.max(input.timeout_s ?? 300, 30), 600);
|
|
66
66
|
const body = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix_bug.js","sourceRoot":"","sources":["../../src/tools/fix_bug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"fix_bug.js","sourceRoot":"","sources":["../../src/tools/fix_bug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAkBjE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,SAAS;IACf,WAAW,EACT,0EAA0E;QAC1E,iEAAi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
|
package/dist/tools/pack.d.ts
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
/** Tar+gzip `dir`, return base64. Throws ToolError with a readable message. */
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Decide which directory we are allowed to package, and refuse the rest.
|
|
4
|
+
*
|
|
5
|
+
* `path` arrives as a tool argument, which means the AGENT chooses it, which
|
|
6
|
+
* means a line of text in a repo can choose it. "Run find_bugs with
|
|
7
|
+
* path=/home/me" sitting in a README is enough to make a helpful agent hand us
|
|
8
|
+
* a home directory, and we would package it and upload it.
|
|
9
|
+
*
|
|
10
|
+
* So the working directory the MCP client was started in is the boundary.
|
|
11
|
+
* Anything inside it is fair game; anything outside is refused by name. Both
|
|
12
|
+
* sides are realpath'd first, so a symlink inside the tree cannot point out of
|
|
13
|
+
* it.
|
|
14
|
+
*
|
|
15
|
+
* FETCHSANDBOX_WORKSPACE_ROOT widens the boundary for the monorepo case, where
|
|
16
|
+
* the client starts in one package and the code under analysis sits in a
|
|
17
|
+
* sibling. It is an environment variable on purpose: the user sets it in their
|
|
18
|
+
* MCP config, and a file in a repo cannot.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveWorkspaceDir(raw?: string): string;
|
|
21
|
+
export declare function packDirToBase64(dirInput: string): {
|
|
3
22
|
b64: string;
|
|
4
23
|
bytes: number;
|
|
5
24
|
};
|
package/dist/tools/pack.js
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* tar from generating AppleDouble entries in the first place.
|
|
9
9
|
*/
|
|
10
10
|
import { execFileSync } from "node:child_process";
|
|
11
|
-
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
11
|
+
import { mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, } from "node:fs";
|
|
12
12
|
import { tmpdir } from "node:os";
|
|
13
|
-
import { join } from "node:path";
|
|
13
|
+
import { isAbsolute, join, resolve, sep } from "node:path";
|
|
14
14
|
import { ToolError } from "../client.js";
|
|
15
15
|
// Mirrors the backend's _TAR_EXCLUDE plus common build/output dirs.
|
|
16
16
|
const EXCLUDES = [
|
|
@@ -56,10 +56,163 @@ const EXCLUDES = [
|
|
|
56
56
|
".windsurf",
|
|
57
57
|
"copilot-instructions.md",
|
|
58
58
|
];
|
|
59
|
+
// SECRETS ARE NEVER PACKED.
|
|
60
|
+
//
|
|
61
|
+
// Reported by a reader of 0.5.0 on 2026-09-12 and reproduced the same hour: the
|
|
62
|
+
// list above excluded build output and agent instruction files and nothing
|
|
63
|
+
// else, so a repo keeping `.env` beside its code shipped live provider keys
|
|
64
|
+
// inside the tarball. Verified with the exact list — .env, .env.local and a
|
|
65
|
+
// server.pem all went in.
|
|
66
|
+
//
|
|
67
|
+
// Patterns, not names. The reporter's other point was the sharper one: a name
|
|
68
|
+
// list only ever covers the case someone already thought of, and the next
|
|
69
|
+
// person keeps credentials in `.env.production` or `terraform.tfstate`.
|
|
70
|
+
//
|
|
71
|
+
// `.env.example` goes too. It is usually harmless and occasionally is not, and
|
|
72
|
+
// the analysis has never needed it — an asymmetric bet taken the safe way.
|
|
73
|
+
const SECRET_PATTERNS = [
|
|
74
|
+
".env", ".env.*", "*.env",
|
|
75
|
+
"*.pem", "*.key", "*.p12", "*.pfx", "*.jks", "*.keystore",
|
|
76
|
+
"id_rsa*", "id_dsa*", "id_ecdsa*", "id_ed25519*", "*.ppk",
|
|
77
|
+
"*.tfstate", "*.tfstate.*", ".terraform",
|
|
78
|
+
".npmrc", ".netrc", ".pgpass", ".htpasswd",
|
|
79
|
+
".aws", ".ssh", ".gnupg", ".docker",
|
|
80
|
+
"credentials", "credentials.json", "secrets", "secrets.*", "*.secrets.*",
|
|
81
|
+
"service-account*.json", "serviceaccount*.json",
|
|
82
|
+
"*.kdbx", "*.asc", "*.gpg",
|
|
83
|
+
];
|
|
59
84
|
// nginx allows 50m on the probe endpoints; stay under with headroom.
|
|
60
85
|
const MAX_TAR_BYTES = 40 * 1024 * 1024;
|
|
86
|
+
/**
|
|
87
|
+
* Refuse to send a tarball that still carries something secret-shaped.
|
|
88
|
+
*
|
|
89
|
+
* The pattern list above is a denylist, and a denylist only ever covers what
|
|
90
|
+
* someone already thought of — which is precisely how this shipped. So the
|
|
91
|
+
* archive is read back before it leaves the machine and checked for the SHAPE
|
|
92
|
+
* of a credential, wherever it lives and whatever the file is called.
|
|
93
|
+
*
|
|
94
|
+
* It fails CLOSED, with the path named, because a developer who is told
|
|
95
|
+
* "config/local.yml looks like it holds a live key" can act, and one whose keys
|
|
96
|
+
* left silently cannot.
|
|
97
|
+
*/
|
|
98
|
+
const SECRET_SHAPES = [
|
|
99
|
+
["AWS access key", /\bAKIA[0-9A-Z]{16}\b/],
|
|
100
|
+
["private key block", /-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY-----/],
|
|
101
|
+
["Stripe secret key (live)", /\bsk_live_[A-Za-z0-9]{20,}/],
|
|
102
|
+
["OpenAI key", /\bsk-proj-[A-Za-z0-9_-]{40,}/],
|
|
103
|
+
["Anthropic key", /\bsk-ant-api\d{2}-[A-Za-z0-9_-]{40,}/],
|
|
104
|
+
["GitHub token", /\bgh[pousr]_[A-Za-z0-9]{36,}/],
|
|
105
|
+
["Slack token", /\bxox[baprs]-[A-Za-z0-9-]{20,}/],
|
|
106
|
+
["Google API key", /\bAIza[0-9A-Za-z_-]{35}\b/],
|
|
107
|
+
["SendGrid key", /\bSG\.[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{40,}/],
|
|
108
|
+
["npm token", /\bnpm_[A-Za-z0-9]{36}\b/],
|
|
109
|
+
];
|
|
110
|
+
/**
|
|
111
|
+
* Read the finished archive back and refuse to send it if anything inside
|
|
112
|
+
* still looks like a live credential.
|
|
113
|
+
*
|
|
114
|
+
* The exclude list above only covers names somebody thought of. This covers
|
|
115
|
+
* the rest: a key in config/local.yml, in a fixture, in a committed script.
|
|
116
|
+
*
|
|
117
|
+
* It EXTRACTS rather than streaming each entry through a subprocess, because
|
|
118
|
+
* the first version read each file with execFileSync and its 4MB buffer. A
|
|
119
|
+
* file above that threw, the catch treated it as "binary, nothing to read",
|
|
120
|
+
* and a secret in a 5MB file sailed through unscanned. A size limit that
|
|
121
|
+
* silently disables a security check is worse than no check, because the check
|
|
122
|
+
* is what you are trusting.
|
|
123
|
+
*
|
|
124
|
+
* Every failure here refuses. If we cannot look inside, we do not send it.
|
|
125
|
+
*/
|
|
126
|
+
const SCAN_MAX_BYTES = 64 * 1024 * 1024;
|
|
127
|
+
function refuseIfSecretsInside(tarPath, tmp) {
|
|
128
|
+
const scanDir = join(tmp, "scan");
|
|
129
|
+
mkdirSync(scanDir, { recursive: true });
|
|
130
|
+
try {
|
|
131
|
+
execFileSync("tar", ["-xzf", tarPath, "-C", scanDir], {
|
|
132
|
+
stdio: ["ignore", "ignore", "pipe"],
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
catch (e) {
|
|
136
|
+
throw new ToolError(`Could not inspect the package before sending it, so it was not sent: ` +
|
|
137
|
+
`${e.stderr?.toString() || e.message}`);
|
|
138
|
+
}
|
|
139
|
+
for (const rel of walk(scanDir)) {
|
|
140
|
+
const abs = join(scanDir, rel);
|
|
141
|
+
const size = statSync(abs).size;
|
|
142
|
+
if (size > SCAN_MAX_BYTES) {
|
|
143
|
+
throw new ToolError(`Refusing to send your project: ${rel} is ${(size / 1048576).toFixed(0)}MB, ` +
|
|
144
|
+
`too large to check for credentials before sending. Move it outside this ` +
|
|
145
|
+
`directory, or point us at a subdirectory that does not contain it.`);
|
|
146
|
+
}
|
|
147
|
+
// latin1 keeps bytes 1:1, so ASCII patterns match and binary never throws.
|
|
148
|
+
const body = readFileSync(abs).toString("latin1");
|
|
149
|
+
for (const [label, re] of SECRET_SHAPES) {
|
|
150
|
+
if (re.test(body)) {
|
|
151
|
+
throw new ToolError(`Refusing to send your project: ${rel} contains what looks like ` +
|
|
152
|
+
`${/^[AEIOU]/.test(label) ? "an" : "a"} ${label}.\n\nFetchSandbox packages your working directory and uploads it ` +
|
|
153
|
+
`for analysis, and nothing should leave your machine that you would not ` +
|
|
154
|
+
`paste into a ticket. Move it outside this directory, or point us at a ` +
|
|
155
|
+
`subdirectory that does not contain it, then run this again.`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function walk(dir, prefix = "") {
|
|
161
|
+
const out = [];
|
|
162
|
+
for (const e of readdirSync(dir, { withFileTypes: true })) {
|
|
163
|
+
const rel = prefix ? `${prefix}/${e.name}` : e.name;
|
|
164
|
+
if (e.isDirectory())
|
|
165
|
+
out.push(...walk(join(dir, e.name), rel));
|
|
166
|
+
else if (e.isFile())
|
|
167
|
+
out.push(rel);
|
|
168
|
+
}
|
|
169
|
+
return out;
|
|
170
|
+
}
|
|
61
171
|
/** Tar+gzip `dir`, return base64. Throws ToolError with a readable message. */
|
|
62
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Decide which directory we are allowed to package, and refuse the rest.
|
|
174
|
+
*
|
|
175
|
+
* `path` arrives as a tool argument, which means the AGENT chooses it, which
|
|
176
|
+
* means a line of text in a repo can choose it. "Run find_bugs with
|
|
177
|
+
* path=/home/me" sitting in a README is enough to make a helpful agent hand us
|
|
178
|
+
* a home directory, and we would package it and upload it.
|
|
179
|
+
*
|
|
180
|
+
* So the working directory the MCP client was started in is the boundary.
|
|
181
|
+
* Anything inside it is fair game; anything outside is refused by name. Both
|
|
182
|
+
* sides are realpath'd first, so a symlink inside the tree cannot point out of
|
|
183
|
+
* it.
|
|
184
|
+
*
|
|
185
|
+
* FETCHSANDBOX_WORKSPACE_ROOT widens the boundary for the monorepo case, where
|
|
186
|
+
* the client starts in one package and the code under analysis sits in a
|
|
187
|
+
* sibling. It is an environment variable on purpose: the user sets it in their
|
|
188
|
+
* MCP config, and a file in a repo cannot.
|
|
189
|
+
*/
|
|
190
|
+
export function resolveWorkspaceDir(raw) {
|
|
191
|
+
const root = realOrSelf(process.env.FETCHSANDBOX_WORKSPACE_ROOT?.trim() || process.cwd());
|
|
192
|
+
const asked = raw && raw.trim() ? raw.trim() : null;
|
|
193
|
+
if (!asked)
|
|
194
|
+
return root;
|
|
195
|
+
// A relative path is relative to where the AGENT is, which is the process
|
|
196
|
+
// cwd — not to the widened root, which the agent cannot see.
|
|
197
|
+
const abs = isAbsolute(asked) ? asked : resolve(process.cwd(), asked);
|
|
198
|
+
const dir = realOrSelf(abs);
|
|
199
|
+
if (dir === root || dir.startsWith(root.endsWith(sep) ? root : root + sep))
|
|
200
|
+
return dir;
|
|
201
|
+
throw new ToolError(`Refusing to package ${dir} — it is outside ${root}.\n\n` +
|
|
202
|
+
`FetchSandbox only reads the directory this MCP client was started in. ` +
|
|
203
|
+
`If that path is really the code you want analysed, start the client there, ` +
|
|
204
|
+
`or set FETCHSANDBOX_WORKSPACE_ROOT to a directory that contains both.`);
|
|
205
|
+
}
|
|
206
|
+
function realOrSelf(p) {
|
|
207
|
+
try {
|
|
208
|
+
return realpathSync(p);
|
|
209
|
+
}
|
|
210
|
+
catch {
|
|
211
|
+
return resolve(p);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
export function packDirToBase64(dirInput) {
|
|
215
|
+
const dir = resolveWorkspaceDir(dirInput);
|
|
63
216
|
const tmp = mkdtempSync(join(tmpdir(), "fs-pack-"));
|
|
64
217
|
const tarPath = join(tmp, "ws.tar.gz");
|
|
65
218
|
try {
|
|
@@ -68,6 +221,8 @@ export function packDirToBase64(dir) {
|
|
|
68
221
|
const args = ["-czf", tarPath, "-C", dir];
|
|
69
222
|
for (const e of EXCLUDES)
|
|
70
223
|
args.push(`--exclude=${e}`);
|
|
224
|
+
for (const e of SECRET_PATTERNS)
|
|
225
|
+
args.push(`--exclude=${e}`);
|
|
71
226
|
args.push("--exclude=._*", ".");
|
|
72
227
|
try {
|
|
73
228
|
execFileSync("tar", args, {
|
|
@@ -79,11 +234,12 @@ export function packDirToBase64(dir) {
|
|
|
79
234
|
const stderr = e.stderr?.toString() ?? "";
|
|
80
235
|
throw new ToolError(`Could not package the project with 'tar': ${stderr || e.message}`);
|
|
81
236
|
}
|
|
237
|
+
refuseIfSecretsInside(tarPath, tmp);
|
|
82
238
|
const buf = readFileSync(tarPath);
|
|
83
239
|
if (buf.length > MAX_TAR_BYTES) {
|
|
84
240
|
throw new ToolError(`Project is ${(buf.length / 1048576).toFixed(1)}MB packed, over the ` +
|
|
85
241
|
`${MAX_TAR_BYTES / 1048576}MB limit. Run from a smaller directory, or ` +
|
|
86
|
-
`
|
|
242
|
+
`point us at the subdirectory that actually integrates the API.`);
|
|
87
243
|
}
|
|
88
244
|
return { b64: buf.toString("base64"), bytes: buf.length };
|
|
89
245
|
}
|
package/dist/tools/pack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.js","sourceRoot":"","sources":["../../src/tools/pack.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,
|
|
1
|
+
{"version":3,"file":"pack.js","sourceRoot":"","sources":["../../src/tools/pack.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,SAAS,EACT,WAAW,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,MAAM,EACN,QAAQ,GACT,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,oEAAoE;AACpE,MAAM,QAAQ,GAAG;IACf,MAAM;IACN,cAAc;IACd,aAAa;IACb,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;IACP,UAAU;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AI,GAAG,CAAC,MAAM,GAAG,aAAa,EAAE,CAAC;YAC/B,MAAM,IAAI,SAAS,CACjB,cAAc,CAAC,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,sBAAsB;gBACnE,GAAG,aAAa,GAAG,OAAO,6CAA6C;gBACvE,gEAAgE,CACnE,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;IAC5D,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC;AACH,CAAC"}
|
|
@@ -47,7 +47,22 @@ export declare function runProveFix(input: ProveFixInput): Promise<{
|
|
|
47
47
|
reproduced?: boolean;
|
|
48
48
|
verified?: boolean;
|
|
49
49
|
reason?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Why we could not recreate and run the app, in words for the developer.
|
|
52
|
+
* Declared or tsc drops it.
|
|
53
|
+
*/
|
|
54
|
+
cannot_run?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The backend's instruction to the AGENT reading this result — the lever that
|
|
57
|
+
* stops an autonomous agent writing its own ungated harness and reporting a
|
|
58
|
+
* false green. The backend has always sent it. Until 2026-09-12 this type and
|
|
59
|
+
* the return below both omitted it, so it was dropped at the client and no
|
|
60
|
+
* agent ever saw it.
|
|
61
|
+
*/
|
|
62
|
+
agent_guidance?: string;
|
|
50
63
|
scenario?: unknown;
|
|
51
64
|
receipt_url?: string;
|
|
52
65
|
engine: string;
|
|
66
|
+
/** Backend-authored text addressed to the HUMAN. Declared or tsc drops it. */
|
|
67
|
+
message_for_user?: string;
|
|
53
68
|
}>;
|
package/dist/tools/prove_fix.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { ToolError } from "../client.js";
|
|
15
15
|
import { lastTwin } from "../twin.js";
|
|
16
16
|
import { startAndPoll } from "./jobs.js";
|
|
17
|
-
import { packDirToBase64 } from "./pack.js";
|
|
17
|
+
import { packDirToBase64, resolveWorkspaceDir } from "./pack.js";
|
|
18
18
|
export const proveFixTool = {
|
|
19
19
|
name: "prove_fix",
|
|
20
20
|
description: "THE PROOF STEP. The only way to establish that a fix actually works, and " +
|
|
@@ -60,7 +60,7 @@ export async function runProveFix(input) {
|
|
|
60
60
|
if (!input.diff || !input.diff.trim()) {
|
|
61
61
|
throw new ToolError("diff is required — pass the diff from fix_bug.");
|
|
62
62
|
}
|
|
63
|
-
const dir =
|
|
63
|
+
const dir = resolveWorkspaceDir(input.path);
|
|
64
64
|
const { b64 } = packDirToBase64(dir);
|
|
65
65
|
const timeout_s = Math.min(Math.max(input.timeout_s ?? 300, 30), 600);
|
|
66
66
|
const body = {
|
|
@@ -100,9 +100,19 @@ export async function runProveFix(input) {
|
|
|
100
100
|
reproduced: raw.reproduced,
|
|
101
101
|
verified: raw.verified,
|
|
102
102
|
reason: raw.reason,
|
|
103
|
+
cannot_run: raw.cannot_run,
|
|
104
|
+
agent_guidance: raw.agent_guidance,
|
|
103
105
|
scenario: raw.scenario,
|
|
104
106
|
receipt_url: raw.receipt_url,
|
|
105
107
|
engine: raw.engine ?? "fetchsandbox",
|
|
108
|
+
// THE FIFTH WHITELIST. Every field the backend adds must be named
|
|
109
|
+
// here or it is invisible — this is what hid next_actions for weeks.
|
|
110
|
+
//
|
|
111
|
+
// Renamed from `notice` on 2026-09-12. A persona run proved the old name
|
|
112
|
+
// was invisible in a different way: the field arrived, and the agent
|
|
113
|
+
// relayed none of it to the person. `notice` sat beside spec and
|
|
114
|
+
// confidence, so it read as data to act on rather than words to pass on.
|
|
115
|
+
message_for_user: raw.message_for_user ?? undefined,
|
|
106
116
|
};
|
|
107
117
|
}
|
|
108
118
|
//# sourceMappingURL=prove_fix.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prove_fix.js","sourceRoot":"","sources":["../../src/tools/prove_fix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"prove_fix.js","sourceRoot":"","sources":["../../src/tools/prove_fix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAWjE,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,WAAW;IACjB,WAAW,EACT,2EAA2E;QAC3E,oDAAoD;QACpD,6EAA6E;QAC7E,2EAA2E;QAC3E,4EAA4E;QAC5E,uEAAuE;QACvE,yEAAyE;QACzE,4EAA4E;QAC5E,cAAc;QACd,2EAA2E;QAC3E,6EAA6E;QAC7E,6EAA6E;QAC7E,0EAA0E;QAC1E,wEAAwE;QACxE,sBAAsB;IACxB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,uCAAuC,EAAE;YAC9E,GAAG,EAAE;gBACH,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mEAAmE;aACjF;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2CAA2C;aACzD;YACD,UAAU,EAAE;gBACV,IAAI,EA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|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { postJson } from "../client.js";
|
|
2
2
|
export const submitProofTool = {
|
|
3
3
|
name: "submit_proof",
|
|
4
|
-
description: "
|
|
4
|
+
description: "Receipts are readable by anyone with the link — do not attach bodies the " +
|
|
5
|
+
"user would not paste into a public PR. " +
|
|
6
|
+
"Attach REAL before/after evidence from the USER's actual app to the run " +
|
|
5
7
|
"receipt. Use this AFTER you've fixed the bug and re-run the app: it makes " +
|
|
6
8
|
"the receipt show their own code's behavior (before your fix vs after), " +
|
|
7
9
|
"which is far stronger proof than a reference simulation. Provide one " +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit_proof.js","sourceRoot":"","sources":["../../src/tools/submit_proof.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAiDxC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,cAAc;IACpB,WAAW,EACT,0EAA0E;QAC1E,4EAA4E;QAC5E,yEAAyE;QACzE,uEAAuE;QACvE,0EAA0E;QAC1E,6EAA6E;QAC7E,8EAA8E;QAC9E,6EAA6E;QAC7E,wEAAwE;QACxE,4EAA4E;QAC5E,sBAAsB;IACxB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,yCAAyC,EAAE;YACtF,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0CAA0C,EAAE;YACxF,cAAc,EAAE;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,wEAAwE;aACtF;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+DAA+D;aAC7E;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,OAAO;gBACb,WAAW,EACT,kGAAkG;oBAClG,iEAAiE;gBACnE,KAAK,EAAE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