Repository navigation
fix(typedData): validate struct names in validateTypedData - #5308
Merged
Merged
Conversation
`validateTypedData` validates every key of `types` once. A struct name must contain only letters, digits, `_` and `$`, and must not be `address`, `bool`, `string`, or `int`, `uint` or `bytes` followed only by digits. Struct names such as `intent` and `bytesInfo` are accepted, and names such as `uint256[]`, `uint7` and `bytes32` are rejected, also when a field references them only as array elements. `findTypeDependencies` strips only the array suffix of a field type, so the encoded type includes struct names that contain `$`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Bm5cqLUPRzJwRDAciDwTss
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 9e803db The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Merged
jxom
pushed a commit
that referenced
this pull request
Oct 26, 2026
Struct name validation in `validateTypedData` (#5308) raised the `viem` (esm) bundle to 88.02 kB, 20 B over its limit. The limit is 1 kB higher. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011rqkaz4bQxmMPuJJUx2aCi
jxom
added a commit
that referenced
this pull request
Oct 26, 2026
Struct name validation in `validateTypedData` (#5308) raised the `viem` (esm) bundle to 88.02 kB, 20 B over its limit. The limit is 1 kB higher. Claude-Session: https://claude.ai/code/session_011rqkaz4bQxmMPuJJUx2aCi Co-authored-by: Claude <[email protected]>
This was referenced Nov 1, 2026
jxom
added a commit
to wevm/ox
that referenced
this pull request
Nov 1, 2026
…s, and `AbiItem` (#561) * fix: validate struct names and field types in `TypedData.assert` Ports wevm/viem#5308 and wevm/viem#5370. A struct name must contain only letters, digits, `_` and `$`, and must not be a Solidity type. A field type must be a struct in `types` or an EIP-712 atomic or dynamic type, so `uint`, `uint7` and `bytes0` throw the new `TypedData.InvalidTypeError`. Every struct is checked, including structs referenced only as array elements. `findTypeDependencies` strips only the array suffix, so struct names with `$` are encoded. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D3nmWgFaNg3t1E6VyYCzXq * fix: reject a tip above a zero `maxFeePerGas` in transaction envelopes Ports wevm/viem#5318 and wevm/viem#5319. `TxEnvelopeEip1559.assert` and `TxEnvelopeTempo.assert` compared fees only when both were truthy, so a zero `maxFeePerGas` skipped the check. `deserialize` for EIP-1559, EIP-4844, EIP-7702, and Tempo envelopes reads an empty `maxFeePerGas` as zero when a tip is set. `TipAboveFeeCapError` and `FeeCapTooHighError` now show zero values. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D3nmWgFaNg3t1E6VyYCzXq * fix: treat indistinguishable overloads as ambiguous in `AbiItem.fromAbi` Ports wevm/viem#5339. Distinct types that both match an argument, such as `bytes32` and `bytes` or `uint256` and `int256`, and arrays of the same element type with different shapes now throw `AbiItem.AmbiguityError` instead of resolving to the last match. An integer overload matches only a value in its range, and a fixed bytes overload matches only a value of its size. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D3nmWgFaNg3t1E6VyYCzXq --------- Co-authored-by: Claude <[email protected]>
jxom
added a commit
to wevm/ox
that referenced
this pull request
Nov 1, 2026
…d `AbiItem` (#560) * fix: validate struct names and field types in `TypedData.assert` Ports wevm/viem#5308 and wevm/viem#5370. A struct name must contain only letters, digits, `_` and `$`, and must not be a Solidity type. A field type must be a struct in `types` or an EIP-712 atomic or dynamic type, so `uint`, `uint7` and `bytes0` throw the new `TypedData.InvalidTypeError`. Every struct is checked, including structs referenced only as array elements. `findTypeDependencies` strips only the array suffix, so struct names with `$` are encoded. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D3nmWgFaNg3t1E6VyYCzXq * fix: reject a tip above a zero `maxFeePerGas` in transaction envelopes Ports wevm/viem#5318 and wevm/viem#5319. `TxEnvelopeEip1559.assert` and `TxEnvelopeTempo.assert` compared fees only when both were truthy, so a zero `maxFeePerGas` skipped the check. `deserialize` for EIP-1559, EIP-4844, EIP-7702, and Tempo envelopes reads an empty `maxFeePerGas` as zero when a tip is set. `TipAboveFeeCapError` and `FeeCapTooHighError` now show zero values. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D3nmWgFaNg3t1E6VyYCzXq * fix: treat indistinguishable overloads as ambiguous in `AbiItem.fromAbi` Ports wevm/viem#5339. Distinct types that both match an argument, such as `bytes32` and `bytes` or `uint256` and `int256`, and arrays of the same element type with different shapes now throw `AbiItem.AmbiguityError` instead of resolving to the last match. An integer overload matches only a value in its range, and a fixed bytes overload matches only a value of its size. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D3nmWgFaNg3t1E6VyYCzXq --------- Co-authored-by: Claude <[email protected]>
1 task done
This branch was successfully deployed
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.
Supersedes #5305.
validateTypedDatarejected every struct name that starts withint,uintorbytes, so a valid struct such asintentorbytesInfomadehashTypedDatathrow. #5305 matched the whole name against the integer and bytes regexes instead. That change also accepted names that the prefix check rejected, such asuint256[], and reopened #2888 with a hash collision:validateTypedDatanow validates every key oftypesonce, before it validates the message. A struct name must contain only letters, digits,_and$. It must not beaddress,bool,string, orint,uintorbytesfollowed only by digits.findTypeDependenciesnow strips only the array suffix, asvalidateTypedDatadoes, so a struct name that contains$is included in the encoded type.intent,bytesInfo,uintPairFoo$BarFoo$Barleft out of the encoded typeFoo.BarFoo.Barleft out of the encoded typeuint256[],uint7,uint256bytes32, referenced only asbytes32[]bytes32values left out of the hashPoints for review:
typesthat no field references are now validated too. Typed data with an unused key such asuint256now throws. ethers rejects unused types entirely.uint7andbytes33names are rejected even though they are not valid Solidity types, since ethers fails on them with "invalid numeric width" or "invalid bytes width".TypedData.validateReferenceandfindTypeDependencieshave the same logic as before this change, so ox needs the same fix.Validation:
pnpm test --run --project core src/utils/typedData.test.ts src/utils/signature/hashTypedData.test.tspasses (62 tests), and 13 of them fail onmain. Theintent,bytesInfo,interval,uintPair,Foo$Barandintent[]hashes match ethers 6.13.4. The ERC-7739 suites need Anvil and the contracts build, so they run only in CI.Generated by Claude Code