Skip to content

qa-lab: add Matrix live transport QA lane - #64489

Merged
gumadeiras merged 31 commits into
mainfrom
codex/matrix-qa-harness-plan
Apr 10, 2026
Merged

gumadeiras merged 31 commits into
mainfrom
codex/matrix-qa-harness-plan

Conversation

@gumadeiras

@gumadeiras gumadeiras commented Apr 10, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Problem: qa-lab had no real Matrix live transport lane, so transport regressions around readiness, mention gating, sender allowlists, reply shape, reactions, and restart/resume could slip past the synthetic qa-channel suite.
  • Why it matters: live transport behavior needs protocol-level verification against the real channel/plugin path, not just seeded agent tasks or synthetic mocks.
  • What changed: added a Docker-backed Matrix live QA lane, expanded shared live-transport runtime helpers, preserved richer channel runtime status metadata, moved live transport CLI ownership into lane-scoped registries, and documented transport coverage plus Telegram QA prerequisites.
  • What did NOT change (scope boundary): no Matrix E2EE coverage, no CI-by-default Matrix live lane, no broad Telegram scenario expansion beyond the existing Telegram live lane, and no change to the synthetic qa-channel lane's role.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: there was no real Matrix transport lane in qa-lab, and the shared live-transport seams were too weak for one. The work exposed missing coverage and weak abstractions around Docker health parsing, per-actor Matrix sync state, live-lane startup/cleanup, and lane-specific CLI ownership.
  • Missing detection / guardrail: no end-to-end Matrix lane, no shared live-transport contract coverage map, and no seam tests for Docker-backed harness startup plus multi-actor Matrix scenarios.
  • Contributing context (if known): the existing QA surface mixed synthetic repo-backed checks with a narrow Telegram live lane, leaving Matrix transport behavior unexercised.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file:
    • extensions/qa-lab/src/docker-up.runtime.test.ts
    • extensions/qa-lab/src/live-transports/matrix/matrix-driver-client.test.ts
    • extensions/qa-lab/src/live-transports/matrix/matrix-harness.runtime.test.ts
    • extensions/qa-lab/src/live-transports/matrix/matrix-live-scenarios.test.ts
    • extensions/qa-lab/src/live-transports/matrix/matrix-live.runtime.test.ts
    • extensions/qa-lab/src/live-transports/shared/live-gateway.runtime.test.ts
    • src/plugin-sdk/status-helpers.test.ts
  • Scenario the test should lock in: Docker-backed Matrix harness startup, documented docker compose ps --format json parsing, actor-scoped Matrix /sync cursors, Matrix canary/thread/top-level/reaction/restart/allowlist behavior, and shared live-lane status propagation.
  • Why this is the smallest reliable guardrail: the failures cross protocol, runtime, and CLI seams. Helper-only coverage would miss the actual transport and startup boundaries.
  • Existing test that already covers this (if any): the new focused Matrix/shared tests plus the Matrix live lane itself.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

  • New pnpm openclaw qa matrix live transport lane with a disposable local Matrix homeserver harness and Matrix-specific artifacts.
  • Live transport lanes now have lane-owned CLI registration under extensions/qa-lab/src/live-transports/* with shared live-lane option/runtime helpers.
  • channels.status now preserves richer runtime connectivity metadata for channel runtimes that expose it.
  • Docs now show transport coverage as tables and document Telegram QA prerequisites explicitly.

Diagram (if applicable)

Before:
[qa-channel synthetic suite]
[telegram live lane]
[matrix live lane missing]

After:
[qa-lab CLI]
  -> [live-transports/shared]
  -> [live-transports/matrix] -> [Docker Matrix harness] -> [real Matrix plugin path]
  -> [live-transports/telegram]

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (Yes)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:
    • The Matrix lane adds intentional local Docker-backed Matrix traffic for QA. The shared Docker/health helpers now use SSRF-guarded fetches where applicable, and the Matrix harness stays loopback/local by default.

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node 24, pnpm, Docker via Colima, Tuwunel ghcr.io/matrix-construct/tuwunel:v1.5.1
  • Model/provider: mock-openai
  • Integration/channel (if any): Matrix, Telegram
  • Relevant config (redacted): local QA env; disposable local Matrix homeserver; Telegram QA docs/env updated but Telegram live E2E not run on this machine

Steps

  1. pnpm check
  2. pnpm test extensions/qa-lab/src/docker-up.runtime.test.ts extensions/qa-lab/src/live-transports/matrix/matrix-harness.runtime.test.ts
  3. timeout 420 pnpm openclaw qa matrix --provider-mode mock-openai --output-dir .artifacts/qa-e2e/matrix-final-20260410-1923

Expected

  • Matrix live lane provisions a disposable homeserver, reaches ready state, and passes canary plus the full Matrix scenario set.
  • Focused Docker and Matrix harness tests stay green.

Actual

  • pnpm check passed on the PR head.
  • Focused Docker and Matrix harness tests passed (2 files, 11 tests).
  • pnpm openclaw qa matrix --provider-mode mock-openai passed on the PR head (10/10).

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios:
    • full Matrix live lane on the PR head with canary plus all Matrix scenarios
    • focused Docker + Matrix harness seam tests on the PR head
    • repo gate pnpm check on the PR head
  • Edge cases checked:
    • Docker Compose --format json array parsing
    • Matrix actor-specific sync cursor ownership across driver/observer flows
    • top-level vs threaded reply isolation
    • reaction observation
    • restart/resume
    • mention gating and sender allowlist blocking
  • What you did not verify:
    • live-frontier Matrix run
    • Telegram full live E2E on this machine

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (Yes)
  • Migration needed? (No)
  • If yes, exact upgrade steps:
    • Matrix QA can optionally use OPENCLAW_QA_MATRIX_TUWUNEL_IMAGE to override the pinned homeserver image.
    • Telegram live E2E still requires the documented Telegram QA env vars.

Risks and Mitigations

  • Risk:
    • Matrix live QA touches shared qa-lab live-transport seams, so regressions could spill into Telegram or future live lanes.
    • Mitigation:
      • shared live-lane helper extraction, focused seam tests, and current-head Matrix live-lane validation.
  • Risk:
    • Telegram live coverage is still much thinner than Matrix live coverage.
    • Mitigation:
      • docs now state the current transport coverage explicitly, and the live-transport structure is ready for incremental Telegram expansion.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: qa-lab size: XL maintainer Maintainer-authored PR labels Apr 10, 2026
@gumadeiras
gumadeiras marked this pull request as ready for review April 10, 2026 20:16
Copilot AI review requested due to automatic review settings April 10, 2026 20:16
@gumadeiras

Copy link
Copy Markdown
Member Author

@greptile review

@gumadeiras

Copy link
Copy Markdown
Member Author

@codex review

@gumadeiras gumadeiras self-assigned this Apr 10, 2026
@greptile-apps

greptile-apps Bot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a Docker-backed Matrix live QA lane to qa-lab, grouped under extensions/qa-lab/src/live-transports/, alongside shared live-lane startup/cleanup helpers, a standard transport scenario contract layer, and expanded status-helpers.ts to propagate runtime connectivity fields (connected, restartPending, reconnectAttempts, etc.) used by the new Matrix readiness gate. The Telegram lane is refactored to use the same shared helpers, and live transport lanes now omit qa-channel from child config.

Confidence Score: 5/5

Safe to merge; all remaining findings are P2 style/cleanup suggestions that do not affect correctness.

The Matrix live lane implementation is thorough: Docker health parsing, readiness gating, shared live-lane contract, and status-helper propagation are all handled correctly. The two findings are a small dead-code block and a minor sleep-style inconsistency — neither affects runtime behavior.

extensions/qa-lab/src/live-transports/matrix/matrix-live.runtime.ts — two P2 suggestions on lines 252 and 527–535

Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/qa-lab/src/live-transports/matrix/matrix-live.runtime.ts
Line: 527-535

Comment:
**Unreachable cleanup-error branch**

When `cleanupErrors.length > 0`, lines 435–441 already push a `"Matrix cleanup"` check with `status: "fail"` into `checks`. That makes `failedChecks.length > 0`, so the guard at line 515 throws first — this block is never reached. It's dead code and can be removed.

```suggestion
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/qa-lab/src/live-transports/matrix/matrix-live.runtime.ts
Line: 252

Comment:
**Inconsistent sleep: global `setTimeout` vs imported `sleep`**

The file imports `import { setTimeout as sleep } from "node:timers/promises"` at the top, but `waitForMatrixChannelReady` uses the global callback-based `setTimeout` here. Prefer the already-imported promise-based alias for consistency.

```suggestion
    await sleep(pollMs);
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "qa-lab: drop live transport finder cruft" | Re-trigger Greptile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a real, Docker-backed Matrix “live transport” QA lane to qa-lab, while refactoring Telegram’s live lane to share a common live-transport scenario contract and improving runtime status propagation needed for readiness gating.

Changes:

  • Introduces a Matrix live QA lane (Docker Tuwunel harness + driver client + scenario suite + CLI command + docs).
  • Adds shared live-transport scenario selection/coverage helpers and standardizes Telegram live lane around them (including improved cleanup + artifact error formatting).
  • Extends runtime status snapshots to preserve transport connectivity metadata used by readiness checks; refactors shared Docker helper utilities.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/plugin-sdk/status-helpers.ts Extends runtime account status snapshots with connectivity/health metadata fields.
src/plugin-sdk/status-helpers.test.ts Adds coverage to ensure connectivity metadata is preserved in snapshots.
extensions/qa-lab/src/qa-gateway-config.ts Adds includeQaChannel toggle so live-lane gateway children can omit qa-channel.
extensions/qa-lab/src/qa-gateway-config.test.ts Tests default inclusion and explicit omission of qa-channel.
extensions/qa-lab/src/mock-openai-server.ts Updates directive parsing to prefer the latest “exact marker/reply exactly” instruction.
extensions/qa-lab/src/mock-openai-server.test.ts Verifies latest-directive behavior with multi-turn inputs.
extensions/qa-lab/src/live-transports/telegram/telegram-live.runtime.ts Refactors Telegram live lane to shared gateway harness + shared scenario contract + improved cleanup/artifact errors.
extensions/qa-lab/src/live-transports/telegram/telegram-live.runtime.test.ts Adds coverage checks against the shared live-transport baseline contract.
extensions/qa-lab/src/live-transports/shared/live-transport-scenarios.ts New shared scenario contract/types + selection + coverage/missing helpers.
extensions/qa-lab/src/live-transports/shared/live-transport-scenarios.test.ts Tests selection, error messaging, ordering, and coverage/missing computations.
extensions/qa-lab/src/live-transports/shared/live-lane-helpers.ts New shared helpers for cleanup issue aggregation + standardized artifact error formatting.
extensions/qa-lab/src/live-transports/shared/live-gateway.runtime.ts New shared live-lane gateway harness (gateway child + optional mock provider + aggregated shutdown errors).
extensions/qa-lab/src/live-transports/shared/live-gateway.runtime.test.ts Tests mock wiring, frontier wiring, and aggregated shutdown error behavior.
extensions/qa-lab/src/live-transports/matrix/matrix-live.runtime.ts New Matrix live lane runner (harness + provisioning + readiness gating + scenarios + artifacts).
extensions/qa-lab/src/live-transports/matrix/matrix-live.runtime.test.ts Tests config injection, artifact redaction, readiness gating logic, and summary shaping.
extensions/qa-lab/src/live-transports/matrix/matrix-live-scenarios.ts New Matrix scenario definitions + execution logic + standard-contract coverage reporting.
extensions/qa-lab/src/live-transports/matrix/matrix-live-scenarios.test.ts Tests default scenario set, prompt shape, unknown IDs, and baseline contract coverage.
extensions/qa-lab/src/live-transports/matrix/matrix-harness.runtime.ts New Docker-backed Tuwunel harness runtime (compose generation, health waiting, host/container URL fallback).
extensions/qa-lab/src/live-transports/matrix/matrix-harness.runtime.test.ts Tests compose/manifest writing, startup flow, empty health fallback, and container-IP fallback.
extensions/qa-lab/src/live-transports/matrix/matrix-driver-client.ts New Matrix driver client for provisioning + sync polling + message/thread/reaction primitives + event normalization.
extensions/qa-lab/src/live-transports/matrix/matrix-driver-client.test.ts Tests mention formatting, normalization, reaction send, UIAA auth progression, and provisioning behavior.
extensions/qa-lab/src/gateway-child.ts Threads includeQaChannel into gateway config construction.
extensions/qa-lab/src/docker-up.runtime.ts Refactors Docker-up runtime to use shared docker helper utilities and safer URL fallback.
extensions/qa-lab/src/docker-runtime.ts New shared Docker utilities (exec, host-port selection, health checks, compose service URL resolution, health parsing).
extensions/qa-lab/src/cli.ts Adds pnpm openclaw qa matrix command wiring + options.
extensions/qa-lab/src/cli.runtime.ts Adds runtime dispatch for Matrix QA lane and updates Telegram import path to new location.
extensions/qa-lab/src/cli.runtime.test.ts Tests Matrix command path resolution + provider-mode defaulting behavior.
docs/help/testing.md Documents Matrix live lane + shared transport contract and current coverage matrix.
docs/concepts/qa-e2e-automation.md Adds Matrix live lane guidance and explains the shared contract/coverage model.

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@aisle-research-bot

aisle-research-bot Bot commented Apr 10, 2026 •

Copy link
Copy Markdown

🔒 Aisle Security Analysis

We found 5 potential security issue(s) in this PR:

# Severity Title
1 🟡 Medium Telegram bot token may be logged in cleartext on SSRF-block events
2 🟡 Medium Arbitrary file write via unvalidated outputDir in runMatrixQaLive()
3 🟡 Medium Arbitrary file write via unvalidated outputDir in runTelegramQaLive()
4 🟡 Medium Docker Compose YAML injection via unquoted Matrix QA image override
5 🟡 Medium Docker Compose YAML injection via unescaped Matrix QA harness parameters
1. 🟡 Telegram bot token may be logged in cleartext on SSRF-block events
Property Value
Severity Medium
CWE CWE-532
Location src/infra/net/fetch-guard.ts:391-395

Description

fetchWithSsrFGuard() logs blocked URL fetch attempts using parsedUrl.origin + parsedUrl.pathname. For Telegram Bot API calls the token is embedded in the path (/bot<token>/...), so if a request is rejected with SsrFBlockedError (e.g., due to DNS pinning/IP classification), the bot token can be written to logs.

  • Input: params.url may contain secrets in the URL path (Telegram bot tokens: https://api.telegram.org/bot<token>/<method>)
  • Sink: logWarn(...) writes the full origin+pathname without applying redactSensitiveText
  • Impact: Secrets can be exposed to console output and file logs

Vulnerable code:

logWarn(
  `security: blocked URL fetch (${context}) target=${parsedUrl.origin}${parsedUrl.pathname} reason=${err.message}`,
);

Recommendation

Redact sensitive data from logged URLs (or avoid logging paths entirely).

Suggested fix (redact before logging):

import { redactSensitiveText } from "../../logging/redact.js";

​// ...
const target = `${parsedUrl.origin}${parsedUrl.pathname}`;
logWarn(
  `security: blocked URL fetch (${context}) target=${redactSensitiveText(target)} reason=${redactSensitiveText(err.message)}`,
);

Even better: log only hostname (and maybe a hash of the path) for security events:

logWarn(`security: blocked URL fetch (${context}) host=${parsedUrl.hostname} reason=${redactSensitiveText(err.message)}`);
2. 🟡 Arbitrary file write via unvalidated outputDir in runMatrixQaLive()
Property Value
Severity Medium
CWE CWE-22
Location extensions/qa-lab/src/live-transports/matrix/matrix-live.runtime.ts:268-273

Description

runMatrixQaLive() accepts an optional outputDir and uses it directly for filesystem writes.

  • params.outputDir is not validated (absolute paths allowed, .. segments allowed)
  • The function creates the directory recursively and writes multiple artifacts beneath it
  • If a caller can influence outputDir (e.g., programmatic usage outside the CLI path resolver), this enables writing files to arbitrary locations on the host filesystem

Vulnerable code:

const outputDir =
  params.outputDir ??
  path.join(repoRoot, ".artifacts", "qa-e2e", `matrix-${Date.now().toString(36)}`);
await fs.mkdir(outputDir, { recursive: true });

Downstream sinks include fs.writeFile(path.join(outputDir, ...)) for reports/summaries/observed events.

Recommendation

Validate outputDir inside runMatrixQaLive() (defense-in-depth), not only in CLI wrappers.

Example fix (reuse the repo-relative resolver):

import { resolveRepoRelativeOutputDir } from "../../cli-paths.js";

const repoRoot = path.resolve(params.repoRoot ?? process.cwd());
const resolvedOutputDir =
  resolveRepoRelativeOutputDir(repoRoot, params.outputDir) ??
  path.join(repoRoot, ".artifacts", "qa-e2e", `matrix-${Date.now().toString(36)}`);
await fs.mkdir(resolvedOutputDir, { recursive: true });

Also consider rejecting paths containing symlinks that escape the repo root if you need stronger guarantees.

3. 🟡 Arbitrary file write via unvalidated outputDir in runTelegramQaLive()
Property Value
Severity Medium
CWE CWE-22
Location extensions/qa-lab/src/live-transports/telegram/telegram-live.runtime.ts:683-688

Description

runTelegramQaLive() accepts an optional outputDir and uses it directly for filesystem writes.

  • params.outputDir is not validated (absolute paths allowed, .. segments allowed)
  • The function creates the directory recursively and writes artifacts beneath it (report/summary/observed messages)
  • If a caller can influence outputDir (e.g., programmatic usage outside the CLI path resolver), this enables writing files to arbitrary locations on the host filesystem

Vulnerable code:

const outputDir =
  params.outputDir ??
  path.join(repoRoot, ".artifacts", "qa-e2e", `telegram-${Date.now().toString(36)}`);
await fs.mkdir(outputDir, { recursive: true });

Downstream sinks include fs.writeFile(path.join(outputDir, ...)).

Recommendation

Validate outputDir inside runTelegramQaLive() (defense-in-depth), not only in CLI wrappers.

Example fix (reuse the repo-relative resolver):

import { resolveRepoRelativeOutputDir } from "../../cli-paths.js";

const repoRoot = path.resolve(params.repoRoot ?? process.cwd());
const resolvedOutputDir =
  resolveRepoRelativeOutputDir(repoRoot, params.outputDir) ??
  path.join(repoRoot, ".artifacts", "qa-e2e", `telegram-${Date.now().toString(36)}`);
await fs.mkdir(resolvedOutputDir, { recursive: true });

If symlink escape is a concern, resolve/realpath and re-check containment before writing.

4. 🟡 Docker Compose YAML injection via unquoted Matrix QA image override
Property Value
Severity Medium
CWE CWE-94
Location extensions/qa-lab/src/live-transports/matrix/matrix-harness.runtime.ts:94-110

Description

renderMatrixQaCompose interpolates the Docker image name directly into a generated docker-compose.matrix-qa.yml without quoting or validation.

  • Input source: image parameter or env var OPENCLAW_QA_MATRIX_TUWUNEL_IMAGE (trimmed only)
  • Sink: written into Docker Compose YAML (image: ${params.image}) and then executed with docker compose up -d
  • Impact: a crafted value containing newlines/colon-indented YAML could inject additional Compose keys (e.g., volumes, privileged, network_mode, etc.), potentially leading to unexpected host filesystem access or privilege escalation when the harness is run (including in CI if user-controlled inputs can influence this value).

Vulnerable code:

return `services:
  matrix-qa-homeserver:
    image: ${params.image}
    ...
`;

Recommendation

Treat the image reference as untrusted input and prevent YAML/compose injection.

Options:

  1. Strictly validate the image reference against an allowlist/regex and reject anything with whitespace/control characters:
function assertSafeImageRef(image: string) {
  if (!/^[a-z0-9./:_-]+(@​sha256:[a-f0-9]{64})?$/.test(image)) {
    throw new Error(`Invalid Docker image reference`);
  }
}
  1. Generate YAML safely using a YAML serializer (recommended) so values are properly quoted/escaped:
import yaml from "yaml";

const composeObj = {
  services: {
    [MATRIX_QA_SERVICE]: {
      image,
      ports: [`127.0.0.1:${homeserverPort}:${MATRIX_QA_INTERNAL_PORT}`],
      environment: { /* ... */ },
      volumes: ["./data:/var/lib/tuwunel"],
    },
  },
};

await fs.writeFile(composeFile, yaml.stringify(composeObj), { mode: 0o600 });

Additionally, consider pinning to a digest (e.g., image@​sha256:...) or implementing an explicit allowlist for CI usage.

5. 🟡 Docker Compose YAML injection via unescaped Matrix QA harness parameters
Property Value
Severity Medium
CWE CWE-74
Location extensions/qa-lab/src/live-transports/matrix/matrix-harness.runtime.ts:94-121

Description

The Matrix QA harness writes a docker-compose.matrix-qa.yml file by interpolating strings directly into YAML. Some of these values can come from environment variables or function parameters and are not escaped/validated.

Impact:

  • An attacker who can influence these values can inject additional YAML keys/services (via newlines/quotes/colon characters), causing docker compose up -d to execute attacker-controlled containers and potentially mount host paths (developer/CI host compromise).

Key issues:

  • image is inserted unquoted into YAML.
  • registrationToken and serverName are inserted inside double quotes but are not escaped; a value containing " or newlines can break out of the quoted scalar.

Vulnerable code:

return `services:\n  ${MATRIX_QA_SERVICE}:\n    image: ${params.image}\n...
      TUWUNEL_REGISTRATION_TOKEN: "${params.registrationToken}"\n      TUWUNEL_SERVER_NAME: "${params.serverName}"\n`;

Data flow:

  • inputs: params.image (or env OPENCLAW_QA_MATRIX_TUWUNEL_IMAGE), params.registrationToken, params.serverName
  • sink: compose YAML written to disk and then executed by docker compose ... up -d in startMatrixQaHarness()

Recommendation

Avoid hand-rolling YAML with string interpolation for untrusted values.

Preferred fix: build a JS object and serialize with a YAML library that correctly quotes/escapes strings.

import yaml from "yaml";

const doc = {
  services: {
    [MATRIX_QA_SERVICE]: {
      image: params.image,
      ports: [`127.0.0.1:${params.homeserverPort}:${MATRIX_QA_INTERNAL_PORT}`],
      environment: {
        TUWUNEL_ADDRESS: "0.0.0.0",
        TUWUNEL_ALLOW_ENCRYPTION: "false",
        TUWUNEL_ALLOW_FEDERATION: "false",
        TUWUNEL_ALLOW_REGISTRATION: "true",
        TUWUNEL_DATABASE_PATH: "/var/lib/tuwunel",
        TUWUNEL_PORT: String(MATRIX_QA_INTERNAL_PORT),
        TUWUNEL_REGISTRATION_TOKEN: params.registrationToken,
        TUWUNEL_SERVER_NAME: params.serverName,
      },
      volumes: ["./data:/var/lib/tuwunel"],
    },
  },
};

await fs.writeFile(composeFile, yaml.stringify(doc), { encoding: "utf8", mode: 0o600 });

Additional hardening (recommended):

  • Validate image against a strict allowlist/regex (e.g., ^[a-z0-9./:_-]+$) and reject any value containing whitespace/newlines.
  • Validate serverName similarly (DNS-like pattern) and reject control characters.
  • If values must be user-overridable, document that they are treated as code/config and should not be sourced from untrusted inputs.

Analyzed PR: #64489 at commit 93ce6e1

Last updated on: 2026-04-10T23:41:10Z

@gumadeiras
gumadeiras force-pushed the codex/matrix-qa-harness-plan branch from a288019 to d6d41d4 Compare April 10, 2026 20:41

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d6d41d4efe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@gumadeiras

Copy link
Copy Markdown
Member Author

Bot/check triage:

Fixed:

  • check-additional: valid. The raw fetch() guard was tripped in extensions/qa-lab/src/docker-up.runtime.ts and extensions/qa-lab/src/live-transports/matrix/matrix-harness.runtime.ts. Both now use the SSRF-guarded health fetch helper.
  • Codex host/container fallback comment: valid. The Matrix harness now keeps the host URL unless the container URL is actually reachable, so transient host-port warmup failures do not switch onto an unroutable bridge IP.
  • Matrix cleanup thread: valid. Cleanup-only failures now keep their dedicated error path instead of being swallowed by the generic failure heading.
  • Copilot UIAA flow thread: valid. Registration now rejects flows that include unsupported stages instead of silently filtering them down.
  • Greptile sleep nit: fixed while touching the same loop.
  • Aisle item 2: reasonable hardening, but severity overstated. The Matrix harness now publishes the homeserver on loopback only.

Rejected / no PR action:

  • security-fast: unrelated to this PR. No package.json or lockfile changes here, and the failing audit is the existing transitive basic-ftp advisory under @mariozechner/pi-ai -> proxy-agent -> pac-proxy-agent -> get-uri -> basic-ftp.
  • Aisle item 1 (compose/YAML injection): not a security bug under SECURITY.md. The claimed inputs are trusted operator-controlled env/config for a local QA harness; no OpenClaw trust-boundary bypass.
  • Aisle items 3 and 5 (captured content artifacts): opt-in debug capture flags, default-redacted, local QA artifacts. Under SECURITY.md, this is trusted-operator/debug behavior, not a vulnerability absent a boundary bypass.
  • Aisle item 4 (registration token in compose file): ephemeral QA-only token written to local run artifacts with 0600; same trust-model reasoning as above. Hardening possible, but not a security bug for this PR.

Targeted validation run:

  • pnpm run lint:tmp:no-raw-channel-fetch
  • pnpm tsgo
  • pnpm test extensions/qa-lab/src/live-transports/matrix/matrix-harness.runtime.test.ts extensions/qa-lab/src/live-transports/matrix/matrix-live.runtime.test.ts
  • pnpm test extensions/qa-lab/src/docker-up.runtime.test.ts extensions/qa-lab/src/live-transports/matrix/matrix-live-scenarios.test.ts
  • pnpm test extensions/qa-lab/src/live-transports/matrix/matrix-driver-client.test.ts extensions/qa-lab/src/live-transports/matrix/matrix-live.runtime.test.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 398b136eb8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@gumadeiras

Copy link
Copy Markdown
Member Author

Follow-up bot/security triage on the latest head:

Fixed:

  • Late Matrix fallback thread: valid. extensions/qa-lab/src/live-transports/matrix/matrix-harness.runtime.ts now keeps probing both host and container Matrix URLs after the initial host miss, and picks whichever actually becomes healthy first.
  • Exact-marker thread: valid. extensions/qa-lab/src/live-transports/matrix/matrix-live-scenarios.ts now requires exact marker-body matches instead of substring matches, so reply-format regressions stop slipping through.

Rejected / no PR action under SECURITY.md:

  • Aisle YAML-injection claim: trusted operator-controlled local QA image/config input, no documented trust-boundary bypass.
  • Aisle symlink-overwrite claim: depends on attacker-controlled pre-existing symlink/hardlink state in trusted local paths, explicitly out of scope.
  • Aisle mock-server regex DoS claim: QA-only mock surface; scanner report depends on operator-exposed/dev binding assumptions and does not show a documented auth/policy/sandbox boundary bypass. Not treating as a PR blocker here.

Targeted validation for this follow-up:

  • pnpm tsgo
  • pnpm test extensions/qa-lab/src/live-transports/matrix/matrix-harness.runtime.test.ts extensions/qa-lab/src/live-transports/matrix/matrix-live-scenarios.test.ts

@gumadeiras
gumadeiras force-pushed the codex/matrix-qa-harness-plan branch 2 times, most recently from 7c69070 to e859084 Compare April 10, 2026 22:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b473af743c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread extensions/qa-lab/src/docker-runtime.ts Resolved
@gumadeiras
gumadeiras force-pushed the codex/matrix-qa-harness-plan branch 3 times, most recently from 2fccaa1 to 93ce6e1 Compare April 10, 2026 23:29
@gumadeiras
gumadeiras force-pushed the codex/matrix-qa-harness-plan branch from 93ce6e1 to ae9bb37 Compare April 10, 2026 23:35
@gumadeiras
gumadeiras merged commit 25445a9 into main Apr 10, 2026
7 checks passed
@gumadeiras
gumadeiras deleted the codex/matrix-qa-harness-plan branch April 10, 2026 23:35
@gumadeiras

Copy link
Copy Markdown
Member Author

Merged via squash.

Thanks @gumadeiras!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ae9bb37751

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
Merged via squash.

Prepared head SHA: ae9bb37
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
Merged via squash.

Prepared head SHA: ae9bb37
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
Merged via squash.

Prepared head SHA: ae9bb37
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
Merged via squash.

Prepared head SHA: ae9bb37
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
Merged via squash.

Prepared head SHA: ae9bb37
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
Merged via squash.

Prepared head SHA: ae9bb37
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
steipete added a commit that referenced this pull request Oct 13, 2026
Consolidate image traversal, request observation ownership, bus waiters,
Slack response classification, Node selection and WebSocket decoding.
Retire the generic Windows executable export after its Node caller moved;
keep trusted taskkill/PowerShell paths and all environment validation.
Remove duplicate planner validation and unsupported private lifecycle guards.
Keep external evidence validation, security authority, resource limits and
ordinary write-capable shutdown settlement.

Also preserve WhatsApp audio preflight when enabling message actions and
avoid recording a POSIX pipe-drain failure during the normal TERM grace.

Best-effort tradeoffs accepted:
- Bus cloning trusts its private typed event union. 0ebeee8 added the
  unsupported-kind throw only for lint; fabricated internal kinds now fail
  naturally, and a new typed variant must update this owner at compile time.
- Overlapping private QA driver transitions are unsupported; callers await
  them. #113855 introduced synthetic interleavings, not a human incident.
- Canonical smoke selection is trusted instead of revalidated; #114055 was
  an ownership cutover. A future selector defect belongs at that owner.
- Wire image inputs are parsed JSON trees. #71311 introduced no human
  cyclic-input incident; unsupported internal cyclic objects are best effort.
- Fabricated cyclic/BigInt tool outputs now fail clearly instead of becoming
  empty evidence. 195e721 added stabilization, not a human incident.
- Reinstalling the private AIMock mount is unsupported. bdc9c60 added
  speculative guards; the actual owner installs it once before start.
- Obsolete repeated observer disposal after port reuse can remove the newer
  QA lookup. 6386dc4 was an affinity repair, not a disposal incident;
  normal unique-port ownership and stop ordering prevent that lifecycle.
- Local non-federated Matrix joins fail immediately on setup errors; #64489
  added initial coverage, not a reported transient-join incident. Rerun the
  QA command after an unusual setup fault.
- Artifact publication is trusted after its awaited atomic writer. #92606
  added suite execution, not a missing-write incident; deletion afterward
  is reported by normal readers.
- Native browser JSON needs no branded rawJSON surrogate workaround.
  #140882 added that generality without a human incident; a future branded
  producer must own its serialization contract.
- Insertion-only pending caches clear directly on settlement. #113926 and
  #128379 supplied no human successor-eviction incident; no replacement can
  precede these finalizers. Real close-time successor checks stay.
- Re-registering the identical private borrowed-relay handle is unsupported.
  #128379/#133706 introduced no such incident; the owner creates fresh handles
  and current authority and distinct-successor comparisons remain.
- Inconclusive Linux process snapshots conservatively stay alive until the
  next check. #132230/#131643 used controlled fault injection, not a human
  actual-use incident. Final unconfirmed settlement retains state for retry.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…0889)

Consolidate image traversal, request observation ownership, bus waiters,
Slack response classification, Node selection and WebSocket decoding.
Retire the generic Windows executable export after its Node caller moved;
keep trusted taskkill/PowerShell paths and all environment validation.
Remove duplicate planner validation and unsupported private lifecycle guards.
Keep external evidence validation, security authority, resource limits and
ordinary write-capable shutdown settlement.

Also preserve WhatsApp audio preflight when enabling message actions and
avoid recording a POSIX pipe-drain failure during the normal TERM grace.

Best-effort tradeoffs accepted:
- Bus cloning trusts its private typed event union. f993a27 added the
  unsupported-kind throw only for lint; fabricated internal kinds now fail
  naturally, and a new typed variant must update this owner at compile time.
- Overlapping private QA driver transitions are unsupported; callers await
  them. openclaw#113855 introduced synthetic interleavings, not a human incident.
- Canonical smoke selection is trusted instead of revalidated; openclaw#114055 was
  an ownership cutover. A future selector defect belongs at that owner.
- Wire image inputs are parsed JSON trees. openclaw#71311 introduced no human
  cyclic-input incident; unsupported internal cyclic objects are best effort.
- Fabricated cyclic/BigInt tool outputs now fail clearly instead of becoming
  empty evidence. 5929e9a added stabilization, not a human incident.
- Reinstalling the private AIMock mount is unsupported. e98e098 added
  speculative guards; the actual owner installs it once before start.
- Obsolete repeated observer disposal after port reuse can remove the newer
  QA lookup. ace0e05 was an affinity repair, not a disposal incident;
  normal unique-port ownership and stop ordering prevent that lifecycle.
- Local non-federated Matrix joins fail immediately on setup errors; openclaw#64489
  added initial coverage, not a reported transient-join incident. Rerun the
  QA command after an unusual setup fault.
- Artifact publication is trusted after its awaited atomic writer. openclaw#92606
  added suite execution, not a missing-write incident; deletion afterward
  is reported by normal readers.
- Native browser JSON needs no branded rawJSON surrogate workaround.
  openclaw#140882 added that generality without a human incident; a future branded
  producer must own its serialization contract.
- Insertion-only pending caches clear directly on settlement. openclaw#113926 and
  openclaw#128379 supplied no human successor-eviction incident; no replacement can
  precede these finalizers. Real close-time successor checks stay.
- Re-registering the identical private borrowed-relay handle is unsupported.
  openclaw#128379/openclaw#133706 introduced no such incident; the owner creates fresh handles
  and current authority and distinct-successor comparisons remain.
- Inconclusive Linux process snapshots conservatively stay alive until the
  next check. openclaw#132230/openclaw#131643 used controlled fault injection, not a human
  actual-use incident. Final unconfirmed settlement retains state for retry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: qa-lab maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants