Skip to content

[2026.10.9] fix(security): bound A2UI Zod 3 traversal on stable - #187303

Merged
RomneyDa merged 7 commits into
release/2026.10.9from
security/a2ui-zod3-early-bounds-stable
Oct 29, 2026
Merged

RomneyDa merged 7 commits into
release/2026.10.9from
security/a2ui-zod3-early-bounds-stable

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Draft scope and provenance

Base: release/2026.10.8 at 5413218. A2UI 0.12.0, retaining Zod 3.25.76 and all public declarations/exports. No broad Zod-4 migration, A2UI removal, or vendored-parser replacement.

This is a local Zod-3 adaptation, not a cherry-pick or upstream Zod-3 release. It implements early upper-bound rejection from Colin McDonnell's upstream Zod commit a0ebf970f2d752e5f58527cd2942ff48be4f46bd (colinhacks/zod#6652; GHSA-mrhx-c7xc-m3w5). Only three parser branches are changed in the TypeScript source and its ESM/CJS runtime outputs. Original copyright and licensing are unchanged. The existing Discord-focused local adaptation informed the approach, but this patch targets the separately installed Zod package, not Discord's embedded parser.

Behavior and reachability

Oversized array max/exact-length and set max/exact-size abort before element or outer-refinement work. Valid transforms and preprocessors, lower-bound failures, wrong input types and successful union alternatives remain covered. Intentional compatibility delta: the rejected branch is aborted, so element issues disappear and a failing union may return invalid_union instead of a dirty branch's too_big.

A2UI 0.12 catalog loading turns JSON Schema maxItems into a real Zod array bound. A regression loads a function catalog through the public Catalog API, then proves the generated bounded schema rejects oversized arguments without visiting an element. Catalog schema generation and existing resolution/validation tests remain passing.

The exact-version pnpm patch also reaches other direct consumers of Zod 3.25.76 and zod-to-json-schema. It does not patch Zod-4 subpaths or the parser embedded in Discord's SDK. No advisory-wide clearance is claimed. No new protocol-wide resource bound is added.

Actual validation

  • New regression: unpatched checkout fails all 21 assertions/tests; patched checkout passes 21/21, across ESM/CJS, sync/async and the real A2UI Catalog integration.
  • Native Vitest wrapper passes. Production Canvas bundles build without the undefined-ZodEffects warning caused by the rejected broad migration.
  • Installed-package byte comparison: exactly src/v3/types.ts, v3/types.js and v3/types.cjs change. All declarations and other package files are identical. Patched TypeScript parser source compiles.
  • Strict public declarations retain the same six pre-existing v0_8 declaration errors, byte-identical diagnostics before/after; no new public-type failure or migration.
  • Existing self-contained upstream tests: 258/258 pass before and after.

Gate status

The package-patch guard registration is included in the current head. Independent ClawSweeper review and hosted CI have completed against this exact head. The prior draft hold is resolved under the assigned backport landing scope.

shakkernerd and others added 2 commits October 27, 2026 13:12
Passive macOS Gateway stops now preserve an absent current-profile service definition without invoking uninstall, while explicit low-level ghost recovery remains available.

Release adaptation: the 2026.10.8 backport of #180390 removed the absent-plist
guard from GatewayLaunchAgentManager's disable path without main's follow-up,
so every passive stop with no LaunchAgent plist ran `openclaw gateway uninstall`
(mac validation: GatewayProcessManagerTests "pause preserves unretainable
services" [absent]). Stable has no migration-pending custody or `.authority`
wrapper, so the guard checks `custody.definition.plist` directly. Mac-only
post-tag fix; npm, Docker and Linux bytes are unaffected.

(cherry picked from commit cb10ec4)
Local Zod-3 adaptation of Colin McDonnell upstream a0ebf970f2d752e5f58527cd2942ff48be4f46bd / colinhacks/zod#6652. Preserve public declarations and the existing package-patch approval gate.

Co-authored-by: RomneyDa <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

Register only [email protected] at its existing patch path, retain rejection of other versions and paths, and document removal gates. Local follow-up to the attributed Colin McDonnell Zod adaptation; no guard logic is disabled.

Co-authored-by: RomneyDa <[email protected]>
@RomneyDa
RomneyDa marked this pull request as ready for review October 29, 2026 04:34
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR patches Zod 3.25.76 to reject oversized bounded arrays and sets before parsing their elements.

Example: An A2UI function declares values with maxItems: 1 and receives {"values":["a","b"]}.

  • Before: Zod reports the size violation but still parses both elements.
  • After: Zod reports the size violation without parsing either element.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-supported, with meaningful dependency-boundary coverage; the supplied behavioral evidence remains harness-based.
Proof confidence 🦐 gold shrimp (3/6) The maintainer-authored PR is outside the ordinary contributor proof gate; its supplied validation describes installed Zod and public Catalog regressions plus Canvas builds, without claiming a shipped Canvas runtime trace.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Oversized collections can consume element-validation work even when a declared upper bound already makes them invalid.
Reason: The maintainer-authored direction is a focused stable-line mitigation, and its stated scope correctly excludes unbounded collections and separately embedded parsers.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this focused stable-branch mitigation remains useful, and no introduced correctness defect was found; GitHub now reports the previous conflict resolved.

Priority: P2
Reviewed head: 6ab895eaa445451e5de6dd4f97a782d77f18817e

Before merge

  • Await maintainer action - The PR owner must resolve the explicit “do not mark ready” hold before landing.

Findings

None.

Agent review details

How this fits together

The stable Canvas plugin bundles A2UI, whose Catalog loader converts JSON Schema collection bounds into Zod validators; this patch changes rejection inside the shared Zod parser.

flowchart LR
  A[Catalog JSON Schema] --> B[A2UI Catalog loader]
  B --> C[Bounded Zod schema]
  D[Function arguments] --> C
  C --> E[Early size rejection]
  C --> F[Element parsing for permitted sizes]
Loading

Technical review

Best possible solution:

Retain the narrow exact-version parser adaptation for stable, preserving its documented rejection semantics and upstream removal conditions.

Do we have a high-confidence way to reproduce the issue?

Published Zod 3 source visibly continues into element traversal after upper-bound failures, and published A2UI 0.12.0 converts maxItems into that affected bound; no target code was executed during this review.

Is this the best way to solve the issue?

The change fixes traversal in the shared parser, keeps source and both runtime formats aligned, and avoids a broad schema-major migration or caller-side duplicate validation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 11091f0bf62f.

Provenance checked

  • Zod 3 collection failure handling changes intended behavior with a stated reason (unknown: Published Zod 3 source accumulates size and element errors, but the historical rationale for continuing traversal was not established; upstream commit a0ebf970f2d752e5f58527cd2942ff48be4f46bd supplies the stated mitigation rationale.)
  • Package-patch allowlist changes intended behavior with a stated reason (0916a19: The original guard blocks new package patches in favor of upstream fixes; the explicit exact-version registration follows the existing exception mechanism without weakening rejection logic.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned patch and exact registration: The introduced diff changes three parser branches in each of the TypeScript, ESM, and CJS files, registers only [email protected], and updates its lockfile identities without changing package versions. (patches/[email protected]:7, 6ab895eaa445)
  • Real dependency boundary in regression: The regression resolves A2UI's installed Zod, exercises ESM/CJS and synchronous/asynchronous parsing, and loads maxItems through the public Catalog API rather than substituting its schema. (test/scripts/a2ui-zod-bounds.regression.mjs:89, 6ab895eaa445)
  • Dependency contract and adaptation source: The patch directly modifies this dependency, establishing its relevance: Zod 3's array and set parsers record size issues and then traverse elements, while the cited upstream change independently establishes early upper-bound rejection as the mitigation. (packages/zod/src/v3/types.ts:2267, 7baee4e17f86)
  • Published A2UI consumer contract: The regression imports this dependency's public Catalog API, establishing its relevance; inspection of the published @a2ui/[email protected] archive confirms that schema_loader.js maps maxItems to arr.max and Catalog validation consumes the resulting schema. (typescript/web_core/src/catalog/schema_loader.js:304)
  • Main has a different product boundary: Current main no longer depends on A2UI in Canvas after its intentional retirement in refactor(canvas)!: retire A2UI widgets and content-kind hooks #182109; that removal does not repair the supported stable branch's retained parser. (extensions/canvas/package.json:10, 11091f0bf62f)
  • Intentional compatibility tradeoff: The maintainer-authored PR explicitly accepts omitted element/refinement issues and possible invalid_union errors for rejected oversized branches; the patch documentation and regression preserve that stated choice. (patches/README.md:146, 6ab895eaa445)

PR surface

Tests +140, Docs +40, Config +1, Other +71. Total +252 across 8 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 140 0 +140
Docs 1 40 0 +40
Config 1 1 0 +1
Generated 0 0 0 0
Other 3 78 7 +71
Total 8 259 7 +252

Labels

Label changes:

  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • remove status: ⏳ waiting on author: Current PR status label is status: ⏳ waiting on maintainer.

Label justifications:

  • P2: This mitigates unnecessary traversal of oversized collections with declared bounds on the stable branch; it does not establish a protocol-wide availability failure.
  • merge-risk: 🚨 compatibility: All consumers resolving Zod 3.25.76 receive intentionally changed invalid-input diagnostics and refinement behavior, a tradeoff explicitly recorded by the maintainer author.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Optionally provide a sanitized stable Canvas runtime trace showing an oversized bounded collection rejected before element work.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-29T04:41:29.707Z sha 4e35db7 :: blocked before merge. :: none
  • reviewed 2026-10-29T06:36:28.323Z sha 25d2c64 :: needs changes before merge. :: none

Reviewed October 29, 2026, 3:05 AM ET / 07:05 UTC (Revision 3).

@RomneyDa
RomneyDa changed the base branch from release/2026.10.8 to release/2026.10.9 October 29, 2026 05:08
@openclaw-barnacle openclaw-barnacle Bot added the app: macos App: macos label Oct 29, 2026
@RomneyDa RomneyDa changed the title fix(security): bound A2UI Zod 3 traversal on stable [2026.10.9] fix(security): bound A2UI Zod 3 traversal on stable Oct 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts and removed app: macos App: macos labels Oct 29, 2026
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. labels Oct 29, 2026
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 29, 2026
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@RomneyDa
RomneyDa merged commit 83b90b0 into release/2026.10.9 Oct 29, 2026
114 checks passed
@RomneyDa
RomneyDa deleted the security/a2ui-zod3-early-bounds-stable branch October 29, 2026 07:19
@clawsweeper

clawsweeper Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: M status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants