Skip to content

[2026.10.9] fix(discord): early-reject oversized vendored Zod input - #187296

Merged
RomneyDa merged 3 commits into
release/2026.10.9from
security/discord-vendored-zod-stable-20261029
Oct 29, 2026
Merged

RomneyDa merged 3 commits into
release/2026.10.9from
security/discord-vendored-zod-stable-20261029

Conversation

@RomneyDa

Copy link
Copy Markdown
Member

Scope

Draft targeting release/2026.10.8 (observed base 5413218d77df39edac0ee99b7838d7bac519002a, train-local qualification). Focused mitigation for the Zod parser embedded inside Discord’s browser SDK, not a broad dependency refresh or a claim of clean dependency audits.

The published @discord/[email protected] bundles its own Zod 3 implementation. Updating the separately installed Zod package does not change those bytes. A baseline regression invokes element refinements on an oversized array; the patch rejects the collection before element or outer-refinement work.

Implementation and provenance

  • Adapt the early upper-size rejection behavior from Colin McDonnell’s upstream Zod commit a0ebf970f2d752e5f58527cd2942ff48be4f46bd (colinhacks/zod#6652), referenced by GHSA-mrhx-c7xc-m3w5.
  • This is a local Zod-3 adaptation, not a cherry-pick or Zod-4 migration. Six small branches across the ESM/CJS vendored parsers change: oversized array max/exact-length and set max/exact-size return the existing invalid result before traversal.
  • Preserve valid parsing/transforms, lower-bound failures, SDK authentication/scope fallbacks, declarations and exports. Early abort intentionally omits element/refinement issues and may wrap a union branch in invalid_union; regression coverage and the patch documentation make that compatibility change explicit. The bundled Zod-3 map API has no upper-size constraint.
  • Register one exact-version package patch and regenerate only its lockfile identity. No unrelated dependency versions, audit exceptions, or check behavior change.
  • Authentication/browser-build test scaffolding is adapted from local aggregate commit 8e6f7bd28af9e7bebf03ff08bf0001e4fc7561be, authored by roboclaw-bot, preserved in f0a0c53aa23b80bd68267fc48cfdda020db77c26; this is not an upstream OpenClaw fix being backported. New early-rejection and compatibility coverage belongs to this isolated local adaptation.
  • Upstream alternative checked on 2026-10-29: SDK stable 2.5.0 and beta 3.0.0-beta.3 both fail the early-rejection regression. discord/embedded-app-sdk#318, authored by renovate-bot (head 81e49dfa871e935641d9b9591ed789e837dc89e1), remains open; it is not a published compatible fix. This small patch avoids the previous whole-parser replacement.

Validation

  • Unpatched published SDK: regression fails (oversized array executes 3 element refinements).
  • Patched parser: 48 direct ESM/CJS, sync/async regression assertions pass, including arrays, exact lengths, sets, nested paths, valid transforms and wrong input types.
  • node scripts/run-vitest.mjs run test/scripts/discord-sdk-zod.test.ts: 7 tests pass, including both SDK entrypoints and the actual production browser build.
  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.root.scripts.json --noEmit: pass.
  • Focused repository oxlint and oxfmt checks: pass.
  • pnpm install --frozen-lockfile --ignore-scripts, package-patch guard and git diff --check: pass. Native lifecycle / packaged-plugin qualification is not claimed.
  • Byte comparison of all 196 published SDK files: exactly the two vendored parser files differ. Published/installed hashes and the patch hash are documented in patches/README.md.

Boundaries / remaining gates

This is the stable train-local backport of #187289 at exact source commit 0c38cbb (author: roboclaw-bot). The 58-line patch and 208-line test file are preserved exactly. Registration is adapted to this train and its lockfile is regenerated locally. Original source/proof and #186177 remain untouched; no extended-stable or A2UI work is included.

Both the Discord SDK regression file and owning package-patch guard tests pass: 15 tests total. The direct matrix passes 48 cases on this train's installed SDK. Regenerated patch matches after normalizing optional Git hunk function labels. All 196 published files were compared: only the two documented parser files differ. These are bounded checks, not a full repository build or native lifecycle/packaged-plugin qualification.

Keep DRAFT pending canonical independent full-context review and hosted required checks. No RFR, merge, forcepush, release, audit-exception or gate changes. Root Zod remains a separate advisory scope.

Initial package-patch fixtures failed because inherited GIT_CONFIG_COUNT survived while fixture helpers removed its keys; the unchanged 15 tests passed with env -u GIT_CONFIG_COUNT. Failed and corrected receipts are retained separately.

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)
Port local adaptation 0c38cbb (roboclaw-bot, #187289) to release/2026.10.8.
Locally adapt Colin McDonnell Zod a0ebf970f2d752e5f58527cd2942ff48be4f46bd (#6652); not an upstream OpenClaw cherry-pick or major migration.
Test scaffolding: 8e6f7bd (roboclaw-bot), preserved in f0a0c53.

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.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: M labels Oct 29, 2026
@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. 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 Discord’s bundled Zod parser to reject oversized arrays and sets before processing their elements.

Example: Parse six buttons using the SDK’s five-button ShareInteraction limit.

  • Before: The parser visits the buttons before returning a size error.
  • After: The parser returns the size error without visiting the buttons.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-supported, with meaningful harness coverage but no shipped-entry-point demonstration.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its reported evidence exercises the real parser and bundler in process, while live browser and packaged-plugin qualification are explicitly unclaimed.
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 SDK inputs consume element-validation work despite exceeding an existing collection limit.
Reason: The maintainer-selected mitigation repairs the bundled implementation directly and explicitly accepts its limited error-reporting tradeoff.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR open: it provides a focused, maintainer-authored mitigation for a verified dependency parser defect, with no discrete patch bug found.

Priority: P2
Reviewed head: 3a622aac9791850ed39f27d1098378b7a2b7cd9a

Before merge

  • Resolve merge risk - A maintainer must attribute or resolve the failed provider-scaffold check before landing; available annotations do not establish its cause.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied validation reports parser and production-bundler harness coverage, without a shipped Activity browser run demonstrating the changed rejection.
Agent review details

How this fits together

The Discord plugin builds the embedded SDK into its Activity browser asset; SDK schemas validate values using the package’s vendored Zod implementation.

flowchart LR
  A[Discord plugin dependency] --> B[Exact version pnpm patch]
  B --> C[SDK browser bundler]
  C --> D[Activity browser asset]
  D --> E[Vendored schema parser]
  E --> F[Parsed value or size error]
Loading

Technical review

Best possible solution:

Keep the exact-version parser repair within the existing package-patch and SDK-build owners until a compatible upstream SDK supplies it.

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

Published SDK source shows upper-bound failures continuing into element traversal, and its ShareInteraction schema supplies a concrete five-button bound; no reproduction was run during this read-only review.

Is this the best way to solve the issue?

The six early-return branches fix the owning parser without replacing its API or adding competing validation, while exact-version registration bounds the dependency change.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 54818f9e6756.

Merge-risk options

Maintainer options:

  1. Attribute the scaffold failure (recommended)
    A maintainer should inspect the failed job’s accessible logs and establish whether it requires a focused repair or qualifies as an unrelated failure.

Provenance checked

  • Vendored collection-parser failure behavior changes intended behavior with a stated reason (unknown: Published SDK 2.5.0 records size errors as dirty results and continues collecting validation issues; the exact historical introduction was not established from the available vendored-source history.)
  • Package-patch approval and registration keeps the original intent (09fbd7b: Existing exact-version allowlisting constrains package patches; this change adds one matching registration without weakening the guard.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Tests +208, Docs +36, Config +1, Other +60. Total +305 across 6 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 208 0 +208
Docs 1 36 0 +36
Config 1 1 0 +1
Generated 0 0 0 0
Other 3 62 2 +60
Total 6 307 2 +305

Labels

Label changes:

  • add P2: Focused parser hardening has clear value, but the supplied evidence does not establish an urgent production outage or exploit.
  • add merge-risk: 🚨 compatibility: Oversized invalid inputs now abort before refinements and may produce a union wrapper; the maintainer explicitly documents and accepts this bounded diagnostic change.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: Focused parser hardening has clear value, but the supplied evidence does not establish an urgent production outage or exploit.
  • merge-risk: 🚨 compatibility: Oversized invalid inputs now abort before refinements and may produce a union wrapper; the maintainer explicitly documents and accepts this bounded diagnostic change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Rank-up moves

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

  • Demonstrate the bounded rejection through the built Activity SDK in a browser, with sanitized runtime output.

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.

Reviewed October 29, 2026, 12:40 AM ET / 04:40 UTC.

@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(discord): early-reject oversized vendored Zod input [2026.10.8] [2026.10.9] fix(discord): early-reject oversized vendored Zod input Oct 29, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the app: macos App: macos label Oct 29, 2026
@RomneyDa
RomneyDa merged commit e65c278 into release/2026.10.9 Oct 29, 2026
108 checks passed
@RomneyDa
RomneyDa deleted the security/discord-vendored-zod-stable-20261029 branch October 29, 2026 06:02
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants