Skip to content
This repository was archived by the owner on Aug 13, 2026. It is now read-only.

fix: apply min/max modifiers to ZodNumber in secureZodParser - #6672

Open
Osamaali313 wants to merge 1 commit into
FlowiseAI:mainfrom
Osamaali313:bugfix/zodnumber-min-max
Open

fix: apply min/max modifiers to ZodNumber in secureZodParser#6672
Osamaali313 wants to merge 1 commit into
FlowiseAI:mainfrom
Osamaali313:bugfix/zodnumber-min-max

Conversation

@Osamaali313

Copy link
Copy Markdown

Description

SecureZodSchemaParser.applyModifiers (packages/components/src/secureZodParser.ts) applies .min() / .max() for ZodString and ZodArray, but has no ZodNumber branch — so numeric bounds are silently dropped:

case 'max':
    if (modifier.args[0] !== undefined) {
        if (zodType._def?.typeName === 'ZodString') { ... }
        else if (zodType._def?.typeName === 'ZodArray') { ... }
        // no ZodNumber branch
    }

A user schema like z.number().min(0).max(100) therefore accepts out-of-range values (e.g. 999, -50). This parser is used by the Structured Output Parser (Advanced) and Custom Tool nodes, so LLM structured output / tool arguments that the author explicitly bounded are passed through unvalidated. The sibling int case already branches on ZodNumber, confirming numeric modifiers are meant to apply.

Repro (schema z.object({ score: z.number().min(0).max(100) })): before, score: 999 and score: -50 are accepted; after, they're rejected (too_big / too_small), while a z.string().max(5) control already worked.

Fix

Add the missing ZodNumber branch to both min and max:

} else if (zodType._def?.typeName === 'ZodNumber') {
    zodType = (zodType as z.ZodNumber).max(modifier.args[0])   // and .min(...) in the min case
}

String/array bounds are unchanged. (There was no existing test file for secureZodParser.ts; happy to add one if you'd like.)

applyModifiers handled .min()/.max() for ZodString and ZodArray but not
ZodNumber, so numeric bounds in a user schema (e.g. z.number().min(0).max(100))
were silently discarded and out-of-range values passed validation. The sibling
`int` case already branches on ZodNumber, confirming numeric modifiers are
meant to apply. Add the missing ZodNumber branch to both min and max.
Copilot AI review requested due to automatic review settings July 26, 2026 20:32
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

dblagbro added a commit to dblagbro/flow-wiser that referenced this pull request Aug 12, 2026
upstream-archive/ preserves 347 open pull requests from FlowiseAI/Flowise,
captured 2026-08-05 before the 2026-08-10 archive lock, as git am-able patches
with original authorship intact. Three have been acted on -- FlowiseAI#6682 and FlowiseAI#6683
(CVEs, with anupamme preserved as commit author) and FlowiseAI#6706 (connect-sqlite3).
The other 344 have never been reviewed.

MANIFEST.md is explicit that the snapshot exists so the backlog stays
"reviewable and re-appliable". It was captured, not fulfilled. Nothing was lost;
nothing was gained either.

These are the last contributions the upstream community will ever make to this
codebase -- upstream is archived and will accept nothing further. They are
Apache-2.0, they carry their authors' names, and Flow-Wiser exists as a
continuation fork. They are also the cheapest fixes this project will ever get:
129 titles begin with "fix", already written and tested by someone else.

Records the shape (129 fix / 173 feat / 5 security / 7 chore / 21 draft), the age
skew toward 2026-06 and 2026-07 which suggests most still apply cleanly, and
names the three unadopted security PRs as the place to start: FlowiseAI#6672, FlowiseAI#5371 and
FlowiseAI#5255 -- contributor-authored hardening that the 116-advisory sweep would not
have caught.

Two constraints stated plainly. Fifteen patches are permanently incomplete: they
touched enterprise/ or IdentityManager.ts, and 196 hunk bodies totalling 14,224
lines were redacted on 2026-08-06 because diff context carries licensed file
fragments. They must not be reconstructed -- that is reading licensed content,
which ADR-0002 forbids. And apply with --keep-non-patch so authorship survives;
a contribution merged without its author's name is a contribution stolen.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants