Retrieved article excerpt
Open article · Retrieved 2026-10-26T12:27:23.298234+00:00
## Repository navigation
# v3: `.max()` on arrays and sets doesn't stop parsing (CVE-2023-54404) #6653
New issue
Copy link
New issue
Copy link
Open
Open
[v3: `.max()` on arrays and sets doesn't stop parsing (CVE-2023-54404)](https://github.com/colinhacks/zod/issues/6653#top)#6653
Copy link
## Description
[@dokson](https://github.com/dokson)
[dokson](https://github.com/dokson)
opened [on Oct 9, 2026](https://github.com/colinhacks/zod/issues/6653#issue-5782339138)
Issue body actions
Re: [#6643 (comment)](https://github.com/colinhacks/zod/issues/6643#issuecomment-6061657433)
v3 checks the bound first but only marks the result dirty, so every element is still parsed:
```
z.array(z.string().uuid()).max(100).safeParse(Array(1_000_000).fill(0));
// 1,000,001 issues
```
Fix (same approach as [#6652](https://github.com/colinhacks/zod/pull/6652)), returns `too_big` before the walk: [dokson@9f5b6c52](https://github.com/dokson/zod/commit/9f5b6c52)
Reactions are currently unavailable
## Activity
1. ### parnilV06 commented on Oct 10, 2026
[@parnilV06](https://github.com/parnilV06)
[parnilV06](https://github.com/parnilV06)
[on Oct 10, 2026](https://github.com/colinhacks/zod/issues/6653#issuecomment-6093878791)
More actions
Hey , I would like to work on this issue .
2. ### AdityaTalikoti commented on Oct 10, 2026
[@AdityaTalikoti](https://github.com/AdityaTalikoti)
[AdityaTalikoti](https://github.com/AdityaTalikoti)
[on Oct 10, 2026](https://github.com/colinhacks/zod/issues/6653#issuecomment-6094084509)
More actions
Hi, I’d like to work on this issue.
I’ll ensure that `.max()` checks the size of arrays and sets before parsing their elements, and add regression tests for oversized inputs. Could you please assign this issue to me?
3. ### colinhacks commented on Oct 12, 2026
[@colinhacks](https://github.com/colinhacks)
[colinhacks](https://github.com/colinhacks)
[on Oct 12, 2026](https://github.com/colinhacks/zod/issues/6653#issuecomment-6129512194)
Last edited by colinhacks
Owner
More actions
New versions of v3 are no longer being published, and I do not consider this a vulnerability. That security advisory was probably agent-written and has caused more harm than good imo.
👎React with 👎5Reacted by TheMly, Manel, s-aree, realsarm and martzology
😕React with 😕4Reacted by Alessandro Colace, s-aree, realsarm and martzology
4. [colinhacks](https://github.com/colinhacks)
closed this as [completed](https://github.com/colinhacks/zod/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted)[on Oct 12, 2026](https://github.com/colinhacks/zod/issues/6653#event-33068741309)
5. [colinhacks](https://github.com/colinhacks)
reopened this [on Oct 12, 2026](https://github.com/colinhacks/zod/issues/6653#event-33068742252)
6. ### dokson commented on Oct 12, 2026
[@dokson](https://github.com/dokson)
[dokson](https://github.com/dokson)
[on Oct 12, 2026](https://github.com/colinhacks/zod/issues/6653#issuecomment-6130907318)
ContributorAuthor
More actions
> New versions of v3 are no longer being published, and I do not consider this a vulnerability. That security advisory was probably agent-written and has caused more harm than good imo.
Agreed, but this was just a minimal fix
7. ### TheMly commented on Oct 13, 2026
[@TheMly](https://github.com/TheMly)
[TheMly](https://github.com/TheMly)
[on Oct 13, 2026](https://github.com/colinhacks/zod/issues/6653#issuecomment-6143736401)
Last edited by TheMly
More actions
[@colinhacks](https://github.com/colinhacks) we're a bit surprised by that response honestly, especially given what the [documentation says about v3 still receiving security fixes and bug fixes](https://zod.dev/library-authors).
If no new v3 versions will be released, how are existing users supposed to receive those fixes? This seems contradictory to what is in the Zod documentation.
Also, whether the advisory was written by an AI agent or not, the vulnerability is real. The issue demonstrates a reproducible resource exhaustion problem where Zod continues validating an oversized array and potentially accumulates a huge number of errors, even when `.max()` has already evaluated the input to be too large by itself.
I understand encouraging users to migrate to v4, but that's completely different from providing security fixes for v3 as promised... Could you clarify how these two positions, both written in the documentation, are consistent between themselves?
As users relying on Zod across multiple repositories, and surely I'm not alone on this, we'd appreciate a clear answer on this topic.
👍React with 👍9Reacted by Alessandro Colace, Dayvid Castro, Dayvid Castro, andrewaustin, Manel, Joren Verbesselt, s-aree, realsarm and martzology
8. ### febzerp1999 commented on Oct 24, 2026
[@febzerp1999](https://github.com/febzerp1999)
[febzerp1999](https://github.com/febzerp1999)
[on Oct 24, 2026](https://github.com/colinhacks/zod/issues/6653#issuecomment-6377796777)
More actions
For reference: this code also ships inside zod 4 as the `zod/v3` entry point, and it is unchanged in 4.6.6 and 4.6.7 ([#6652](https://github.com/colinhacks/zod/pull/6652) changed only `src/v4`). Scanners treat those versions as fixed for [GHSA-mrhx-c7xc-m3w5](https://github.com/advisories/GHSA-mrhx-c7xc-m3w5 "GHSA-mrhx-c7xc-m3w5"). On zod 4.6.7 from npm, the example above still reports one issue per element through `zod/v3`, and a single `too_big` through `zod`.
9. ### smarchessault commented on Oct 24, 2026
[@smarchessault](https://github.com/smarchessault)
[smarchessault](https://github.com/smarchessault)
[on Oct 24, 2026](https://github.com/colinhacks/zod/issues/6653#issuecomment-6378452980) – with [ChatGPT Codex Connector](https://www.chatgpt.com)
More actions
Hi Colin, thanks for clarifying that v3 releases have stopped. I'm trying to work out the supported path for apps whose dependencies still require Zod 3.
For example, the published @copilotkit/runtime 1.79.1 and @ag-ui/client 1.0.3 packages still depend on Zod 3, while [GHSA-mrhx-c7xc-m3w5](https://github.com/advisories/GHSA-mrhx-c7xc-m3w5 "GHSA-mrhx-c7xc-m3w5") lists 4.6.6 as the patched version.
Is there any recommended mitigation for those users while the dependencies catch up, or is migrating the dependencies to the v4 API the only supported option? I also saw the comment about zod/v3 inside v4, so I don't want to assume that changing the package version alone addresses it.
Thanks for any guidance.
👍React with 👍1Reacted by Ross Solomon
[Sign up for free](https://github.com/signup?return_to=https://github.com/colinhacks/zod/issues/6653) **to join this conversation on GitHub.** Already have an account? [Sign in to comment](https://github.com/login?return_to=https://github.com/colinhacks/zod/issues/6653)
## Metadata
## Metadata
### Assignees
No one assigned
### Labels
No labels
No labels
### Projects
No projects
### Milestone
No milestone
### Relationships
None yet
### Development
No branches or pull requests
## Issue actions
- Open in GitHub Copilot app