Skip to content

feat(lint): validate EIP-712 format keys in v2 linter - #307

Open
manuelwedler wants to merge 1 commit into
LedgerHQ:mainfrom
manuelwedler:feat/lint-v2-eip712-keys
Open

feat(lint): validate EIP-712 format keys in v2 linter#307
manuelwedler wants to merge 1 commit into
LedgerHQ:mainfrom
manuelwedler:feat/lint-v2-eip712-keys

Conversation

@manuelwedler

Copy link
Copy Markdown

The display.formats key pattern in the v2 schema was loosened in ethereum/ERCs#1868, so malformed EIP-712 keys now pass schema validation — whitespace in particular is accepted anywhere. But the key MUST be exactly encodeType(primaryType): wallets compute the type hash from the message being signed and compare it against keccak256(TYPE_KEY), so any deviation means the descriptor silently never applies.

  • Adds ValidateEIP712KeysLinter, validating keys purely syntactically (the descriptor holds neither the domain nor the struct definitions).
  • Checks: encodeType grammar and whitespace, duplicate types/members, valid atomic types, referenced types defined and reachable, dependent types sorted by name.
  • Tolerates colon-namespaced type names (e.g. Hyperliquid's HyperliquidTransaction:Withdraw), consistently with parse_encode_type (fix: allow colon in EIP-712 type names in encodeType parser #289).
  • Verified against registry master: 0 errors across all 125 eip712-* root descriptors.

v2 descriptors no longer embed EIP-712 schemas: the display.formats key is
itself the schema, and MUST be the encodeType string of the message primary
type, so that keccak256(TYPE_KEY) matches the type hash the wallet computes
from the message. A malformed key silently never matches.

Add ValidateEIP712KeysLinter, checking keys purely syntactically (neither the
domain nor the struct definitions are available in the descriptor): encodeType
grammar and whitespace, duplicate types and members, valid atomic types,
referenced types defined and reachable, and dependent types sorted by name.

Colon namespaced type names (e.g. Hyperliquid's HyperliquidTransaction:Withdraw)
are tolerated, consistently with parse_encode_type.
@manuelwedler
manuelwedler requested a review from a team as a code owner July 27, 2026 14:05
@ledger-wiz-cspm-secret-detection

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings 1 Low
Software Management Finding Software Management Findings -
Total 1 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant