@teamclaws/teamclaw 2026.11.12 → 2026.11.13
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/dist/src/controller/task-routes.js +7 -5
- package/dist/src/controller/tunnel-routes.js +37 -5
- package/dist/src/protocol.js +2 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/src/controller/task-routes.ts +7 -5
- package/src/controller/tunnel-routes.ts +36 -4
- package/src/protocol.ts +2 -0
|
@@ -438,13 +438,15 @@ export async function handleTaskCheckpointRequest(deps, req, res, pathname) {
|
|
|
438
438
|
* ClawHub security review 2026.11.11: a submitted previewCommand is run by
|
|
439
439
|
* the controller as a shell process (restricted env, confined cwd - but still
|
|
440
440
|
* arbitrary code as the controller user). While device protection is off,
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
*
|
|
444
|
-
* the
|
|
441
|
+
* NO peer except loopback (the controller host itself) may supply one - the
|
|
442
|
+
* 2026.11.11 review showed LAN peers are equally unpaired in L0, so a LAN
|
|
443
|
+
* or remote caller's contract is recorded WITHOUT preview fields so it can
|
|
444
|
+
* never trigger a process. Protection on: the device gate authenticated the
|
|
445
|
+
* caller, so nothing is stripped. Container/LAN workers that need dynamic
|
|
446
|
+
* previews must run with device pairing enabled.
|
|
445
447
|
*/
|
|
446
448
|
export function stripPreviewCommandsForUntrustedPeer(body, peer, protectionOn) {
|
|
447
|
-
if (protectionOn || !peer || peer.loopback
|
|
449
|
+
if (protectionOn || !peer || peer.loopback) {
|
|
448
450
|
return;
|
|
449
451
|
}
|
|
450
452
|
for (const key of ["contract", "resultContract"]) {
|
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
import { sendJson, sendError } from "../protocol.js";
|
|
1
|
+
import { sendJson, sendError, MAX_FORM_BODY_BYTES, BodyTooLargeError } from "../protocol.js";
|
|
2
2
|
import { getGithubAuthManager } from "./github-auth.js";
|
|
3
3
|
import { gatePageHtml, computeGateCookie, GATE_COOKIE_NAME, selfHostedTokenFromEnv } from "./tunnel-manager.js";
|
|
4
4
|
import { isLanIp, isProtectionOn, secretsEqual } from "./security.js";
|
|
5
|
+
/**
|
|
6
|
+
* ClawHub security review 2026.11.12 (finding 2): the gate verification
|
|
7
|
+
* endpoint is reachable from the internet before any authentication; the
|
|
8
|
+
* form reader used to buffer whatever was posted. Bodies are bounded by
|
|
9
|
+
* MAX_FORM_BODY_BYTES and oversized posts surface as BodyTooLargeError (413).
|
|
10
|
+
* Kept as an async-iterator read (not the shared event-based reader) so any
|
|
11
|
+
* async-iterable request body works.
|
|
12
|
+
*/
|
|
5
13
|
async function readFormBody(request) {
|
|
6
14
|
const chunks = [];
|
|
7
|
-
|
|
8
|
-
|
|
15
|
+
let total = 0;
|
|
16
|
+
for await (const chunk of request) {
|
|
17
|
+
const buf = chunk;
|
|
18
|
+
total += buf.length;
|
|
19
|
+
if (total > MAX_FORM_BODY_BYTES) {
|
|
20
|
+
request.destroy?.();
|
|
21
|
+
throw new BodyTooLargeError(MAX_FORM_BODY_BYTES);
|
|
22
|
+
}
|
|
23
|
+
chunks.push(buf);
|
|
24
|
+
}
|
|
9
25
|
const raw = Buffer.concat(chunks).toString("utf8");
|
|
10
26
|
const out = {};
|
|
11
27
|
for (const [k, v] of new URLSearchParams(raw))
|
|
@@ -79,7 +95,17 @@ export function createTunnelGateRoutes(tunnelManager) {
|
|
|
79
95
|
sendJson(res, 429, { error: "Too many gate verification attempts. Wait a minute and try again." });
|
|
80
96
|
return;
|
|
81
97
|
}
|
|
82
|
-
|
|
98
|
+
let form;
|
|
99
|
+
try {
|
|
100
|
+
form = await readFormBody(req);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
if (err instanceof BodyTooLargeError) {
|
|
104
|
+
sendError(res, 413, err.message);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
throw err;
|
|
108
|
+
}
|
|
83
109
|
// Issue #237 W3: gate tokens are 128-bit base64url and therefore
|
|
84
110
|
// case-sensitive - only surrounding whitespace is normalized (the
|
|
85
111
|
// old .toUpperCase() fold belonged to the retired 8-char token).
|
|
@@ -193,7 +219,13 @@ export function createTunnelManagementRoutes(tunnelManager, deps) {
|
|
|
193
219
|
const body = await readFormBody(req);
|
|
194
220
|
token = String(body.token ?? "");
|
|
195
221
|
}
|
|
196
|
-
catch {
|
|
222
|
+
catch (err) {
|
|
223
|
+
if (err instanceof BodyTooLargeError) {
|
|
224
|
+
sendError(res, 413, err.message);
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
/* fall through to env */
|
|
228
|
+
}
|
|
197
229
|
if (!token.trim()) {
|
|
198
230
|
const envToken = selfHostedTokenFromEnv();
|
|
199
231
|
if (!envToken) {
|
package/dist/src/protocol.js
CHANGED
|
@@ -73,6 +73,8 @@ async function parseJsonBody(req) {
|
|
|
73
73
|
export const MAX_JSON_BODY_BYTES = 8 * 1024 * 1024;
|
|
74
74
|
/** Repo bundle imports are binary git bundles - large, but still bounded. */
|
|
75
75
|
export const MAX_BUNDLE_BODY_BYTES = 256 * 1024 * 1024;
|
|
76
|
+
/** Tunnel gate / connector-token form bodies: a token is a few dozen bytes. */
|
|
77
|
+
export const MAX_FORM_BODY_BYTES = 64 * 1024;
|
|
76
78
|
export class BodyTooLargeError extends Error {
|
|
77
79
|
limitBytes;
|
|
78
80
|
constructor(limitBytes) {
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "teamclaw",
|
|
3
3
|
"name": "TeamClaw",
|
|
4
4
|
"description": "Virtual team collaboration - multiple OpenClaw instances form a virtual software company with role-based task routing.",
|
|
5
|
-
"version": "2026.11.
|
|
5
|
+
"version": "2026.11.13",
|
|
6
6
|
"activation": {
|
|
7
7
|
"onStartup": true
|
|
8
8
|
},
|
package/package.json
CHANGED
|
@@ -527,17 +527,19 @@ export async function handleTaskCheckpointRequest(deps: ControllerTaskDomainDeps
|
|
|
527
527
|
* ClawHub security review 2026.11.11: a submitted previewCommand is run by
|
|
528
528
|
* the controller as a shell process (restricted env, confined cwd - but still
|
|
529
529
|
* arbitrary code as the controller user). While device protection is off,
|
|
530
|
-
*
|
|
531
|
-
*
|
|
532
|
-
*
|
|
533
|
-
* the
|
|
530
|
+
* NO peer except loopback (the controller host itself) may supply one - the
|
|
531
|
+
* 2026.11.11 review showed LAN peers are equally unpaired in L0, so a LAN
|
|
532
|
+
* or remote caller's contract is recorded WITHOUT preview fields so it can
|
|
533
|
+
* never trigger a process. Protection on: the device gate authenticated the
|
|
534
|
+
* caller, so nothing is stripped. Container/LAN workers that need dynamic
|
|
535
|
+
* previews must run with device pairing enabled.
|
|
534
536
|
*/
|
|
535
537
|
export function stripPreviewCommandsForUntrustedPeer(
|
|
536
538
|
body: Record<string, unknown>,
|
|
537
539
|
peer: SecurityPeer | undefined,
|
|
538
540
|
protectionOn: boolean,
|
|
539
541
|
): void {
|
|
540
|
-
if (protectionOn || !peer || peer.loopback
|
|
542
|
+
if (protectionOn || !peer || peer.loopback) {
|
|
541
543
|
return;
|
|
542
544
|
}
|
|
543
545
|
for (const key of ["contract", "resultContract"]) {
|
|
@@ -8,16 +8,33 @@
|
|
|
8
8
|
// http-server.js as TYPE ONLY (ControllerHttpDeps), so the module graph
|
|
9
9
|
// stays acyclic - same discipline as security.ts.
|
|
10
10
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
11
|
-
import { sendJson, sendError } from "../protocol.js";
|
|
11
|
+
import { sendJson, sendError, MAX_FORM_BODY_BYTES, BodyTooLargeError } from "../protocol.js";
|
|
12
12
|
import { getGithubAuthManager } from "./github-auth.js";
|
|
13
13
|
import { gatePageHtml, computeGateCookie, GATE_COOKIE_NAME, selfHostedTokenFromEnv, type TunnelManager } from "./tunnel-manager.js";
|
|
14
14
|
import { isLanIp, isProtectionOn, secretsEqual } from "./security.js";
|
|
15
15
|
import type { ControllerHttpDeps } from "./http-server.js";
|
|
16
16
|
import type { RouteDef } from "./route-table.js";
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* ClawHub security review 2026.11.12 (finding 2): the gate verification
|
|
20
|
+
* endpoint is reachable from the internet before any authentication; the
|
|
21
|
+
* form reader used to buffer whatever was posted. Bodies are bounded by
|
|
22
|
+
* MAX_FORM_BODY_BYTES and oversized posts surface as BodyTooLargeError (413).
|
|
23
|
+
* Kept as an async-iterator read (not the shared event-based reader) so any
|
|
24
|
+
* async-iterable request body works.
|
|
25
|
+
*/
|
|
18
26
|
async function readFormBody(request: IncomingMessage): Promise<Record<string, unknown>> {
|
|
19
27
|
const chunks: Buffer[] = [];
|
|
20
|
-
|
|
28
|
+
let total = 0;
|
|
29
|
+
for await (const chunk of request) {
|
|
30
|
+
const buf = chunk as Buffer;
|
|
31
|
+
total += buf.length;
|
|
32
|
+
if (total > MAX_FORM_BODY_BYTES) {
|
|
33
|
+
request.destroy?.();
|
|
34
|
+
throw new BodyTooLargeError(MAX_FORM_BODY_BYTES);
|
|
35
|
+
}
|
|
36
|
+
chunks.push(buf);
|
|
37
|
+
}
|
|
21
38
|
const raw = Buffer.concat(chunks).toString("utf8");
|
|
22
39
|
const out: Record<string, unknown> = {};
|
|
23
40
|
for (const [k, v] of new URLSearchParams(raw)) out[k] = v;
|
|
@@ -96,7 +113,16 @@ export function createTunnelGateRoutes(tunnelManager: TunnelManager): readonly R
|
|
|
96
113
|
sendJson(res, 429, { error: "Too many gate verification attempts. Wait a minute and try again." });
|
|
97
114
|
return;
|
|
98
115
|
}
|
|
99
|
-
|
|
116
|
+
let form: Record<string, unknown>;
|
|
117
|
+
try {
|
|
118
|
+
form = await readFormBody(req);
|
|
119
|
+
} catch (err) {
|
|
120
|
+
if (err instanceof BodyTooLargeError) {
|
|
121
|
+
sendError(res, 413, err.message);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
throw err;
|
|
125
|
+
}
|
|
100
126
|
// Issue #237 W3: gate tokens are 128-bit base64url and therefore
|
|
101
127
|
// case-sensitive - only surrounding whitespace is normalized (the
|
|
102
128
|
// old .toUpperCase() fold belonged to the retired 8-char token).
|
|
@@ -210,7 +236,13 @@ export function createTunnelManagementRoutes(tunnelManager: TunnelManager, deps:
|
|
|
210
236
|
try {
|
|
211
237
|
const body = await readFormBody(req) as { token?: unknown };
|
|
212
238
|
token = String(body.token ?? "");
|
|
213
|
-
} catch {
|
|
239
|
+
} catch (err) {
|
|
240
|
+
if (err instanceof BodyTooLargeError) {
|
|
241
|
+
sendError(res, 413, err.message);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
/* fall through to env */
|
|
245
|
+
}
|
|
214
246
|
if (!token.trim()) {
|
|
215
247
|
const envToken = selfHostedTokenFromEnv();
|
|
216
248
|
if (!envToken) { sendError(res, 400, "connector token required (or set TEAMCLAW_TUNNEL_TOKEN)"); return; }
|
package/src/protocol.ts
CHANGED
|
@@ -83,6 +83,8 @@ async function parseJsonBody(req: IncomingMessage): Promise<Record<string, unkno
|
|
|
83
83
|
export const MAX_JSON_BODY_BYTES = 8 * 1024 * 1024;
|
|
84
84
|
/** Repo bundle imports are binary git bundles - large, but still bounded. */
|
|
85
85
|
export const MAX_BUNDLE_BODY_BYTES = 256 * 1024 * 1024;
|
|
86
|
+
/** Tunnel gate / connector-token form bodies: a token is a few dozen bytes. */
|
|
87
|
+
export const MAX_FORM_BODY_BYTES = 64 * 1024;
|
|
86
88
|
|
|
87
89
|
export class BodyTooLargeError extends Error {
|
|
88
90
|
constructor(readonly limitBytes: number) {
|