chore(deps): update dependency valibot to v1.4.2 [security]#16502
Open
renovate[bot] wants to merge 1 commit into
Open
chore(deps): update dependency valibot to v1.4.2 [security]#16502renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/ae96d230f310a36237f58385ca684ecb7f12d87dOpen in |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
1.2.0→1.4.2Valibot: record() issue paths can make flatten() throw for inherited Object property names
CVE-2026-59952 / GHSA-5qjj-4xww-7phc
More information
Details
Summary
valibot1.4.1 can throw aTypeErrorinside itsflatten()helper when validation issues contain attacker-controlled object keys such astoString,valueOf, orhasOwnProperty.The issue is reachable through normal
record()validation.record()intentionally filters__proto__,prototype, andconstructor, but it still accepts other own keys that collide with inheritedObject.prototypeproperties. If the record key schema or value schema rejects such an entry, Valibot creates an issue path containing that key. Passing the resulting issues to Valibot's documentedflatten()helper causesflatErrors.nested[dotPath]to resolve to the inherited method instead of an own error array, and the helper calls.push(...)on that function.This is not a global prototype pollution issue. The impact is availability/error handling: applications that validate user-controlled objects with
record()and flatten validation errors for API responses can crash the request path with aTypeErrorinstead of returning structured validation errors.Affected package
valibot1.4.1open-circle/valibot9bb6617Root cause
record()uses_isValidObjectKey()before validating record entries. The helper blocks the three classic prototype pollution keys:It does not block other inherited
Object.prototypenames such astoString,valueOf, andhasOwnProperty. These remain valid own JSON object keys and can appear in issue paths when either the record key schema or value schema rejects the entry.flatten()then creates nested error storage with an ordinary object:For a dot path such as
toString, this check reads the inheritedObject.prototype.toStringfunction:Because the inherited function is truthy,
flatten()calls.push(...)on a function and throwsTypeError: flatErrors.nested[dotPath].push is not a function.Impact
A remote attacker can trigger this if an application:
v.record(...);toString;flatten(result.issues)helper to prepare validation errors.This is a common pattern in API/form validation:
safeParse()collects issues andflatten()converts them into response-friendly error objects. Instead of a validation response, the request can hit an unexpected exception path.The same root cause can also affect manually constructed issues or other schemas that place inherited Object property names into dot paths. I am reporting the
record()path because it uses only public Valibot APIs and attacker-controlled JSON keys.Local reproduction
Run in a disposable directory:
Minimal example:
Observed output from
valibot@1.4.1:{ "name": "record value schema rejects attacker-controlled value", "key": "toString", "success": false, "issueCount": 1, "firstPath": ["toString"], "firstMessage": "Invalid type: Expected number but received \"not-a-number\"", "flattened": { "ok": false, "exception": "TypeError", "message": "flatErrors.nested[dotPath].push is not a function" } }The local PoC also reproduces the same exception for
valueOf,hasOwnProperty,isPrototypeOf,propertyIsEnumerable, andtoLocaleString. A control case with an ordinary key produces normal flattened errors.Duplicate checks performed before submission
valibotrelease is1.4.1and maps toopen-circle/valibot.gh api repos/open-circle/valibot/private-vulnerability-reportingreturned{"enabled":true}.npm auditfor a clean project containing onlyvalibot@1.4.1returned no vulnerabilities.1.2.0.valibot1.4.1returned no vulnerabilities.flatten toString,flatten hasOwnProperty,record toString,__proto__,constructor, andprototype pollutiondid not find a matching disclosure of thisrecord()issue-path /flatten()exception.open-circle/valibot#67added prototype pollution mitigation forrecord()by blacklisting__proto__,prototype, andconstructor; it does not coverflatten()collisions with other inherited property names.open-circle/valibot#1429is an open plain-object /record()type semantics PR and does not disclose thisflatten()exception behavior.Suggested remediation
Use null-prototype containers for flat error maps and/or perform own-property checks before appending:
flatErrors.nestedasObject.create(null).Object.prototype.hasOwnProperty.call(flatErrors.nested, dotPath)rather than truthiness.getDotPath()/flatten(), including inherited Object property names.flatten()with pathstoString,valueOf,hasOwnProperty,__proto__,prototype, andconstructor.Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
open-circle/valibot (valibot)
v1.4.2Compare Source
Many thanks to @Faze-up and @chatman-media for contributing to this release.
Intl.Segmenterfor non-primitive locales, preventing it from being recreated on everywords,minWords,maxWordsandnotWordsvalidation (pull request #1521)flattenmethod to handle issue path keys that collide withObject.prototypemembers liketoStringinstead of throwing aTypeError(pull request #1522)intersectschema to merge object keys that collide withObject.prototypemembers liketoStringinstead of failing to merge them (pull request #1522)v1.4.1Compare Source
intersectschema to infer correct input and output types for non-tuple array options instead ofnever(pull request #1478)v1.4.0Compare Source
Many thanks to @ksaurav24, @heiwen, @compulim, @ysknsid25, @alaycock-stripe, @IlyaSemenov, @wszgrcy, @LMGO, @yslpn, @EltonLobo07 and @Eronmmer for contributing to this release.
isoDateTimeSecondvalidation action to validate ISO date times with seconds (pull request #1418)toCamelCase,toKebabCase,toPascalCaseandtoSnakeCasetransformation actions to convert strings between common naming conventions (pull request #1457)ReadonlyOutputKeysandOutputWithReadonlytypes ofobjectschemas andWithReadonlytype ofrecordschemas to improve TypeScript type performance (pull request #1442)_LruCacheto use a TypeScriptprivatemethod instead of a#privateclass field to avoid runtime helpers in the transpiled output (pull request #1455)_isValidObjectKeyto useObject.prototype.hasOwnProperty.callinstead ofObject.hasOwnso the distributed output stays compatible with runtimes that lack the ES2022Object.hasOwnbuiltin (pull request #1421)flattenmethod to accept readonly issue arrays (pull request #1269)RangeErrorcaused by spreading large issue arrays (pull request #1437)creditCardvalidation action to reject Mastercard numbers with invalid lengths (pull request #1462)intersectschema to no longer mutate input values, allowing frozen objects and arrays to be merged (pull request #1463)v1.3.1Compare Source
MAC48_REGEX,MAC64_REGEXandMAC_REGEXto drop theiflag for better JSON Schema compatibility (pull request #1430)hashaction to use case-expanded character classes instead of theiflag (pull request #1430)v1.3.0Compare Source
Many thanks to @EskiMojo14, @yslpn, @alexilyaev, @idleberg, @BerkliumBirb and @frenzzy for contributing to this release.
guardtransformation action to narrow types using type predicates (pull request #1204)parseBooleantransformation action to parse boolean values from strings and other types (pull request #1251)isrcvalidation action to validate ISRC codes (pull request #1373)cachemethod for caching schema output by input (pull request #1170)domainvalidation action to validate domain names (pull request #1284)jwsCompactvalidation action to validate JWS compact strings (pull request #1348)creditCardvalidation action to allow 13-digit Visa card numbers (pull request #1347)isoTimestampvalidation action to allow optional space before UTC offset for PostgreSQLtimestamptzcompatibility (pull request #1195)Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.