test: add docker proof for plugin binding command escape ...
steipete
·
2026-05-23
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1673,6 +1673,7 @@
|
1673 | 1673 | "test:docker:openai-web-search-minimal": "bash scripts/e2e/openai-web-search-minimal-docker.sh", |
1674 | 1674 | "test:docker:openwebui": "bash scripts/e2e/openwebui-docker.sh", |
1675 | 1675 | "test:docker:pi-bundle-mcp-tools": "bash scripts/e2e/pi-bundle-mcp-tools-docker.sh", |
| 1676 | +"test:docker:plugin-binding-command-escape": "bash scripts/e2e/plugin-binding-command-escape-docker.sh", |
1676 | 1677 | "test:docker:plugin-lifecycle-matrix": "bash scripts/e2e/plugin-lifecycle-matrix-docker.sh", |
1677 | 1678 | "test:docker:plugin-update": "bash scripts/e2e/plugin-update-unchanged-docker.sh", |
1678 | 1679 | "test:docker:plugins": "bash scripts/e2e/plugins-docker.sh", |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Verifies the plugin-owned conversation binding command escape regression in |
| 3 | +# Docker. The focused Vitest cases assert that real authorized commands escape, |
| 4 | +# while unknown or unauthorized slash text stays with the bound plugin. |
| 5 | +set -euo pipefail |
| 6 | + |
| 7 | +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" |
| 8 | +source "$ROOT_DIR/scripts/lib/docker-e2e-image.sh" |
| 9 | + |
| 10 | +IMAGE_NAME="${OPENCLAW_PLUGIN_BINDING_COMMAND_ESCAPE_E2E_IMAGE:-openclaw-plugin-binding-command-escape-e2e}" |
| 11 | +CONTAINER_NAME="openclaw-plugin-binding-command-escape-e2e-$$" |
| 12 | +RUN_LOG="$(mktemp -t openclaw-plugin-binding-command-escape-log.XXXXXX)" |
| 13 | +FOCUSED_TEST_REGEX="lets authorized plugin-owned binding commands fall through to command processing|keeps authorized unknown slash text in a plugin-owned binding routed to the bound plugin|keeps unauthorized plugin-owned binding slash text routed to the bound plugin" |
| 14 | + |
| 15 | +cleanup() { |
| 16 | + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true |
| 17 | + rm -f "$RUN_LOG" |
| 18 | +} |
| 19 | +trap cleanup EXIT |
| 20 | + |
| 21 | +docker_e2e_build_or_reuse \ |
| 22 | +"$IMAGE_NAME" \ |
| 23 | + plugin-binding-command-escape \ |
| 24 | +"$ROOT_DIR/scripts/e2e/plugin-binding-command-escape.Dockerfile" \ |
| 25 | +"$ROOT_DIR" |
| 26 | + |
| 27 | +echo "Running plugin binding command escape Docker E2E..." |
| 28 | +set +e |
| 29 | +docker run --rm \ |
| 30 | + --name "$CONTAINER_NAME" \ |
| 31 | + -e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \ |
| 32 | + -e "FOCUSED_TEST_REGEX=$FOCUSED_TEST_REGEX" \ |
| 33 | + -e OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/tmp/openclaw-vitest-cache \ |
| 34 | +"$IMAGE_NAME" \ |
| 35 | + bash -lc 'set -euo pipefail; corepack enable; node scripts/run-vitest.mjs src/auto-reply/reply/dispatch-from-config.test.ts -- --reporter=verbose -t "$FOCUSED_TEST_REGEX"' \ |
| 36 | +>"$RUN_LOG" 2>&1 |
| 37 | +status=$? |
| 38 | +set -e |
| 39 | + |
| 40 | +if [ "$status" -ne 0 ]; then |
| 41 | +echo "Docker plugin binding command escape smoke failed" |
| 42 | + cat "$RUN_LOG" |
| 43 | +exit "$status" |
| 44 | +fi |
| 45 | + |
| 46 | +echo "OK" |
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +FROM node:24-bookworm-slim@sha256:e8e2e91b1378f83c5b2dd15f0247f34110e2fe895f6ca7719dbb780f929368eb |
| 2 | + |
| 3 | +RUN apt-get update \ |
| 4 | +&& apt-get install -y --no-install-recommends ca-certificates git python3 \ |
| 5 | +&& rm -rf /var/lib/apt/lists/* |
| 6 | + |
| 7 | +RUN corepack enable |
| 8 | + |
| 9 | +WORKDIR /workspace/openclaw |
| 10 | +COPY . . |
| 11 | + |
| 12 | +RUN pnpm install --frozen-lockfile |
| 13 | + |
| 14 | +CMD ["bash"] |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -462,6 +462,11 @@ export const mainLanes = [
|
462 | 462 | "session-runtime-context", |
463 | 463 | "OPENCLAW_SKIP_DOCKER_BUILD=1 pnpm test:docker:session-runtime-context", |
464 | 464 | ), |
| 465 | +lane("plugin-binding-command-escape", "pnpm test:docker:plugin-binding-command-escape", { |
| 466 | +e2eImageKind: false, |
| 467 | +resources: ["npm"], |
| 468 | +stateScenario: "empty", |
| 469 | +}), |
465 | 470 | lane("commitments-safety", "OPENCLAW_SKIP_DOCKER_BUILD=1 pnpm test:docker:commitments-safety", { |
466 | 471 | stateScenario: "empty", |
467 | 472 | }), |
@@ -713,6 +718,11 @@ const primaryReleasePathChunks = {
|
713 | 718 | "session-runtime-context", |
714 | 719 | "OPENCLAW_SKIP_DOCKER_BUILD=1 pnpm test:docker:session-runtime-context", |
715 | 720 | ), |
| 721 | +lane("plugin-binding-command-escape", "pnpm test:docker:plugin-binding-command-escape", { |
| 722 | +e2eImageKind: false, |
| 723 | +resources: ["npm"], |
| 724 | +stateScenario: "empty", |
| 725 | +}), |
716 | 726 | lane("commitments-safety", "OPENCLAW_SKIP_DOCKER_BUILD=1 pnpm test:docker:commitments-safety", { |
717 | 727 | stateScenario: "empty", |
718 | 728 | }), |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -705,6 +705,21 @@ describe("scripts/lib/docker-e2e-plan", () => {
|
705 | 705 | expect(plan.needs.package).toBe(true); |
706 | 706 | }); |
707 | 707 | |
| 708 | +it("plans the plugin binding command escape lane as source Docker proof", () => { |
| 709 | +const plan = planFor({ selectedLaneNames: ["plugin-binding-command-escape"] }); |
| 710 | + |
| 711 | +expect(plan.lanes).toHaveLength(1); |
| 712 | +const lane = requireFirstLane(plan); |
| 713 | +expect(lane.command).toBe("pnpm test:docker:plugin-binding-command-escape"); |
| 714 | +expect(lane.imageKind).toBeUndefined(); |
| 715 | +expect(lane.live).toBe(false); |
| 716 | +expect(lane.name).toBe("plugin-binding-command-escape"); |
| 717 | +expect(lane.resources).toEqual(["docker", "npm"]); |
| 718 | +expect(lane.stateScenario).toBe("empty"); |
| 719 | +expect(plan.needs.e2eImage).toBe(false); |
| 720 | +expect(plan.needs.package).toBe(false); |
| 721 | +}); |
| 722 | + |
708 | 723 | it("plans the live plugin tool lane as package-backed OpenAI proof", () => { |
709 | 724 | const plan = planFor({ selectedLaneNames: ["live-plugin-tool"] }); |
710 | 725 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。