@teamclaws/teamclaw 2026.11.11 → 2026.11.12

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.
@@ -147,10 +147,10 @@ async function taskCheckpointRoute(ctx) {
147
147
  await handleTaskCheckpointRequest(ctx.deps, ctx.req, ctx.res, ctx.pathname);
148
148
  }
149
149
  async function taskResultContractRoute(ctx) {
150
- await handleTaskResultContractRequest(ctx.deps, ctx.req, ctx.res, ctx.pathname);
150
+ await handleTaskResultContractRequest(ctx.deps, ctx.req, ctx.res, ctx.pathname, ctx.peer);
151
151
  }
152
152
  async function taskResultRoute(ctx) {
153
- await handleTaskResultRequest(ctx.deps, ctx.req, ctx.res, ctx.pathname);
153
+ await handleTaskResultRequest(ctx.deps, ctx.req, ctx.res, ctx.pathname, ctx.peer);
154
154
  }
155
155
  async function taskExecutionEventRoute(ctx) {
156
156
  await handleTaskExecutionEventRequest(ctx.deps, ctx.req, ctx.res, ctx.pathname);
@@ -1,4 +1,5 @@
1
1
  import { generateId, parseJsonBody, sendError, sendJson } from "../protocol.js";
2
+ import { isProtectionOn } from "./security.js";
2
3
  import { normalizeRecommendedSkills, validateActiveRoleId } from "../profile-loader.js";
3
4
  import { deriveProjectSlug, deriveStableProjectKey } from "../openclaw-workspace.js";
4
5
  import { backfillWorkerProgressContract, enrichDeliverablesWithPreviewInference, normalizeTaskHandoffContract, normalizeWorkerProgressContract, normalizeWorkerTaskResultContract, } from "../interaction-contracts.js";
@@ -433,11 +434,42 @@ export async function handleTaskCheckpointRequest(deps, req, res, pathname) {
433
434
  }
434
435
  sendJson(res, 200, { ok: true, updatedAt: task.checkpoint?.updatedAt });
435
436
  }
437
+ /**
438
+ * ClawHub security review 2026.11.11: a submitted previewCommand is run by
439
+ * the controller as a shell process (restricted env, confined cwd - but still
440
+ * arbitrary code as the controller user). While device protection is off,
441
+ * only loopback / LAN peers (the owner's own workers) may supply one; a
442
+ * remote unpaired caller's contract is recorded WITHOUT preview fields so it
443
+ * can never trigger a process. Protection on: the device gate authenticated
444
+ * the caller, so nothing is stripped.
445
+ */
446
+ export function stripPreviewCommandsForUntrustedPeer(body, peer, protectionOn) {
447
+ if (protectionOn || !peer || peer.loopback || peer.lan) {
448
+ return;
449
+ }
450
+ for (const key of ["contract", "resultContract"]) {
451
+ const raw = body[key];
452
+ if (!raw || typeof raw !== "object") {
453
+ continue;
454
+ }
455
+ const deliverables = raw.deliverables;
456
+ if (!Array.isArray(deliverables)) {
457
+ continue;
458
+ }
459
+ for (const deliverable of deliverables) {
460
+ if (deliverable && typeof deliverable === "object") {
461
+ delete deliverable.previewCommand;
462
+ delete deliverable.previewCwd;
463
+ }
464
+ }
465
+ }
466
+ }
436
467
  // POST /api/v1/tasks/:id/result-contract
437
- export async function handleTaskResultContractRequest(deps, req, res, pathname) {
468
+ export async function handleTaskResultContractRequest(deps, req, res, pathname, peer) {
438
469
  const { logger, getTeamState, updateTeamState } = deps;
439
470
  const taskId = pathname.split("/")[4];
440
471
  const body = await parseJsonBody(req);
472
+ stripPreviewCommandsForUntrustedPeer(body, peer, isProtectionOn(getTeamState()));
441
473
  const contract = normalizeWorkerTaskResultContract(body.contract ?? body.resultContract);
442
474
  const workerId = typeof body.workerId === "string" ? body.workerId : undefined;
443
475
  const currentTask = getTeamState()?.tasks[taskId];
@@ -485,10 +517,11 @@ export async function handleTaskResultContractRequest(deps, req, res, pathname)
485
517
  sendJson(res, 201, { task: serializeTask(state.tasks[taskId]) });
486
518
  }
487
519
  // POST /api/v1/tasks/:id/result
488
- export async function handleTaskResultRequest(deps, req, res, pathname) {
520
+ export async function handleTaskResultRequest(deps, req, res, pathname, peer) {
489
521
  const { logger, getTeamState, updateTeamState } = deps;
490
522
  const taskId = pathname.split("/")[4];
491
523
  const body = await parseJsonBody(req);
524
+ stripPreviewCommandsForUntrustedPeer(body, peer, isProtectionOn(getTeamState()));
492
525
  let result = typeof body.result === "string" ? body.result : "";
493
526
  let error = typeof body.error === "string" ? body.error : undefined;
494
527
  const workerId = typeof body.workerId === "string" ? body.workerId : undefined;
@@ -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.11",
5
+ "version": "2026.11.12",
6
6
  "activation": {
7
7
  "onStartup": true
8
8
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamclaws/teamclaw",
3
- "version": "2026.11.11",
3
+ "version": "2026.11.12",
4
4
  "description": "OpenClaw virtual software team orchestration plugin - controller, role-based workers, Web UI with internet tunnel sharing",
5
5
  "private": false,
6
6
  "keywords": [
@@ -338,11 +338,11 @@ async function taskCheckpointRoute(ctx: RouteContext): Promise<void> {
338
338
  }
339
339
 
340
340
  async function taskResultContractRoute(ctx: RouteContext): Promise<void> {
341
- await handleTaskResultContractRequest(ctx.deps, ctx.req, ctx.res, ctx.pathname);
341
+ await handleTaskResultContractRequest(ctx.deps, ctx.req, ctx.res, ctx.pathname, ctx.peer);
342
342
  }
343
343
 
344
344
  async function taskResultRoute(ctx: RouteContext): Promise<void> {
345
- await handleTaskResultRequest(ctx.deps, ctx.req, ctx.res, ctx.pathname);
345
+ await handleTaskResultRequest(ctx.deps, ctx.req, ctx.res, ctx.pathname, ctx.peer);
346
346
  }
347
347
 
348
348
  async function taskExecutionEventRoute(ctx: RouteContext): Promise<void> {
@@ -18,6 +18,7 @@ import type {
18
18
  WorkerProgressContract,
19
19
  } from "../types.js";
20
20
  import { generateId, parseJsonBody, sendError, sendJson } from "../protocol.js";
21
+ import { isProtectionOn, type SecurityPeer } from "./security.js";
21
22
  import { normalizeRecommendedSkills, validateActiveRoleId } from "../profile-loader.js";
22
23
  import { deriveProjectSlug, deriveStableProjectKey } from "../openclaw-workspace.js";
23
24
  import {
@@ -522,11 +523,47 @@ export async function handleTaskCheckpointRequest(deps: ControllerTaskDomainDeps
522
523
  sendJson(res, 200, { ok: true, updatedAt: task.checkpoint?.updatedAt });
523
524
  }
524
525
 
526
+ /**
527
+ * ClawHub security review 2026.11.11: a submitted previewCommand is run by
528
+ * the controller as a shell process (restricted env, confined cwd - but still
529
+ * arbitrary code as the controller user). While device protection is off,
530
+ * only loopback / LAN peers (the owner's own workers) may supply one; a
531
+ * remote unpaired caller's contract is recorded WITHOUT preview fields so it
532
+ * can never trigger a process. Protection on: the device gate authenticated
533
+ * the caller, so nothing is stripped.
534
+ */
535
+ export function stripPreviewCommandsForUntrustedPeer(
536
+ body: Record<string, unknown>,
537
+ peer: SecurityPeer | undefined,
538
+ protectionOn: boolean,
539
+ ): void {
540
+ if (protectionOn || !peer || peer.loopback || peer.lan) {
541
+ return;
542
+ }
543
+ for (const key of ["contract", "resultContract"]) {
544
+ const raw = body[key];
545
+ if (!raw || typeof raw !== "object") {
546
+ continue;
547
+ }
548
+ const deliverables = (raw as { deliverables?: unknown }).deliverables;
549
+ if (!Array.isArray(deliverables)) {
550
+ continue;
551
+ }
552
+ for (const deliverable of deliverables) {
553
+ if (deliverable && typeof deliverable === "object") {
554
+ delete (deliverable as Record<string, unknown>).previewCommand;
555
+ delete (deliverable as Record<string, unknown>).previewCwd;
556
+ }
557
+ }
558
+ }
559
+ }
560
+
525
561
  // POST /api/v1/tasks/:id/result-contract
526
- export async function handleTaskResultContractRequest(deps: ControllerTaskDomainDeps, req: IncomingMessage, res: ServerResponse, pathname: string): Promise<void> {
562
+ export async function handleTaskResultContractRequest(deps: ControllerTaskDomainDeps, req: IncomingMessage, res: ServerResponse, pathname: string, peer?: SecurityPeer): Promise<void> {
527
563
  const { logger, getTeamState, updateTeamState } = deps;
528
564
  const taskId = pathname.split("/")[4]!;
529
565
  const body = await parseJsonBody(req);
566
+ stripPreviewCommandsForUntrustedPeer(body, peer, isProtectionOn(getTeamState()));
530
567
  const contract = normalizeWorkerTaskResultContract(body.contract ?? body.resultContract);
531
568
  const workerId = typeof body.workerId === "string" ? body.workerId : undefined;
532
569
  const currentTask = getTeamState()?.tasks[taskId];
@@ -576,10 +613,11 @@ export async function handleTaskResultContractRequest(deps: ControllerTaskDomain
576
613
  }
577
614
 
578
615
  // POST /api/v1/tasks/:id/result
579
- export async function handleTaskResultRequest(deps: ControllerTaskDomainDeps, req: IncomingMessage, res: ServerResponse, pathname: string): Promise<void> {
616
+ export async function handleTaskResultRequest(deps: ControllerTaskDomainDeps, req: IncomingMessage, res: ServerResponse, pathname: string, peer?: SecurityPeer): Promise<void> {
580
617
  const { logger, getTeamState, updateTeamState } = deps;
581
618
  const taskId = pathname.split("/")[4]!;
582
619
  const body = await parseJsonBody(req);
620
+ stripPreviewCommandsForUntrustedPeer(body, peer, isProtectionOn(getTeamState()));
583
621
  let result = typeof body.result === "string" ? body.result : "";
584
622
  let error = typeof body.error === "string" ? body.error : undefined;
585
623
  const workerId = typeof body.workerId === "string" ? body.workerId : undefined;