Repository navigation
eth: reject unsafe EIP-712 numbers - #141
Open
benma-agent wants to merge 1 commit into
Open
benma-agent wants to merge 1 commit into
benma-agent wants to merge 1 commit into
Conversation
benma-agent
added a commit
to benma-agent/bitbox-api-ts
that referenced
this pull request
Nov 29, 2026
JavaScript can round integer values before they reach the EIP-712 encoder. Checking only integrality accepts those rounded values without warning. Require safe integers for number inputs. Keep decimal strings and bigint inputs for exact values outside ±(2^53 - 1), and document that converting an already-rounded number cannot restore the original digits. Related: - [bitbox02-api-go #199](BitBoxSwiss/bitbox02-api-go#199) - [bitbox-api-rs #141](BitBoxSwiss/bitbox-api-rs#141)
benma-agent
force-pushed
the
benma-agent/eip712-exact-json-integers
branch
from
November 29, 2026 08:20
5fce867 to
5dcd801
Compare
benma-agent
added a commit
to benma-agent/bitbox02-api-go
that referenced
this pull request
Nov 29, 2026
Decode JSON numbers as exact text so values such as 9007199254740993 are not rounded before encoding. Use math/big's rational parser to accept integral decimal and exponent forms, rejecting fractions and values outside the 256-bit range. Related: - [Rust BitBoxSwiss#141](BitBoxSwiss/bitbox-api-rs#141) - [TypeScript BitBoxSwiss#18](BitBoxSwiss/bitbox-api-ts#18)
benma-agent
force-pushed
the
benma-agent/eip712-exact-json-integers
branch
2 times, most recently
from
November 29, 2026 08:24
6091e6d to
51d846f
Compare
benma-agent
added a commit
to benma-agent/bitbox02-api-go
that referenced
this pull request
Nov 29, 2026
Decode JSON numbers as exact text so values such as 9007199254740993 are not rounded before encoding. Parse integer notation directly with math/big, rejecting decimal points, exponents, and values outside 256 bits. Related: - [Rust BitBoxSwiss#141](BitBoxSwiss/bitbox-api-rs#141) - [TypeScript BitBoxSwiss#18](BitBoxSwiss/bitbox-api-ts#18)
benma-agent
added a commit
to benma-agent/bitbox02-api-go
that referenced
this pull request
Nov 29, 2026
Require decoded numeric values to be integers within the JavaScript safe-integer range, matching the TypeScript client. Decimal and exponent notation remains accepted when it decodes to a safe integer. Use decimal strings for larger values. Related: - [Rust BitBoxSwiss#141](BitBoxSwiss/bitbox-api-rs#141) - [TypeScript BitBoxSwiss#18](BitBoxSwiss/bitbox-api-ts#18)
EIP-712 numeric values outside the safe integer range can lose precision when decoded as floating point. Reject numeric values outside ±(2^53 - 1), requiring decimal strings for larger integers. Keep integral numeric forms such as 128.0 and 1e3, and parse JSON floats with round-trip precision at the safe-range boundaries. Related fixes: - Go: BitBoxSwiss/bitbox02-api-go#199 - TypeScript: BitBoxSwiss/bitbox-api-ts#18
benma-agent
force-pushed
the
benma-agent/eip712-exact-json-integers
branch
from
November 29, 2026 08:27
51d846f to
154370b
Compare
benma
marked this pull request as ready for review
November 29, 2026 08:30
This branch has not been 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.
EIP-712 numeric values outside the safe integer range can lose precision
when decoded as floating point.
Reject numeric values outside ±(2^53 - 1), requiring decimal strings for
larger integers. Keep integral numeric forms such as 128.0 and 1e3, and
parse JSON floats with round-trip precision at the safe-range boundaries.
Related fixes: