Support smart-contract / multisig accounts (e.g. Safe) via keyring Snaps — relax the internal-account guards
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- typescript
调研方向
从 packages/signature-controller/src/utils/validation.ts 和 packages/transaction-controller/src/utils/validation.ts 开始,重点关注 validateVerifyingContract 和 internal-account calldata guard。使用 LocalSafe keyring Snap 以及所描述的 EIP-1271 和 Safe execTransaction 流程重现这些失败。当受支持的合约账户能够执行这些操作,且不会削弱现有的单密钥 EOA 保护时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
When an account-management (keyring) Snap registers a smart-contract account (e.g. a Safe multisig) as a MetaMask account, two "internal account" guards in MetaMask/core block the account's normal operations from the same MetaMask:
-
EIP-1271 signing —
eth_signTypedData_v4whosedomain.verifyingContractis the account is rejected:External signature requests cannot use internal accounts as the verifying contract
packages/signature-controller/src/utils/validation.ts(validateVerifyingContract, added in #5470) -
Executing the account's own methods —
eth_sendTransactionto the account with calldata (e.g. SafeexecTransaction) is rejected:External transactions to internal accounts cannot include data
packages/transaction-controller/src/utils/validation.ts
Why this is wrong for multisigs
Both guards assume an internal account is a single-key EOA whose key the user holds. For an M-of-N multisig that's false:
- A single signature is worthless without the threshold of other owners' signatures — a phishing dApp can't do anything with one tricked signature.
- EIP-1271 with
verifyingContract= the Safe is the defined way a Safe signature works (isValidSignature), not an exploit. - Calling a contract account's own methods with calldata (
execTransaction) is how the account is operated.
The guards should key off "is this a single-key EOA?", not "is this address one of my accounts?"
Re: the prior resolution
#6239 hit guard #1 for EIP-7702 and was closed as intentional, pointing to the Delegation Toolkit. That doesn't apply here: a Safe is an existing, deployed M-of-N contract with real owners and funds — not a 7702-upgraded EOA, an ERC-4337 account, or a MetaMask delegator. There's nothing to migrate.
Requested change (any one)
- Scope both guards to EOA-type internal accounts — skip them when the account is a contract (non-empty
eth_getCode) or a keyring-Snap-declared contract account. - Add a smart-contract account type to the Keyring API (beyond ERC-4337) so multisigs can be modeled, and apply the EOA guards only to EOAs.
- At minimum, a per-account override for these two guards.
- Or, more broadly: support common multisig wallets (e.g. Safe) as a native MetaMask account type — recognize the deployed contract, relay the signing request to its owners, and validate via EIP-1271 — so multisig support doesn't depend on each team shipping a keyring Snap, and these guards stop applying for the common case.
Reproduction
With the LocalSafe keyring Snap (Cyfrin/localsafe.eth#80, MetaMask Flask), register a deployed Safe as an account, then from the same MetaMask: a dApp eth_signTypedData_v4 with verifyingContract = the Safe hits guard #1; executing the Safe's execTransaction hits guard #2. Both work only after removing the Safe from MetaMask or using a different wallet. (EIP-1271 sign-in itself works end-to-end — verified against the MetaMask Test Dapp — so only these guards block the flow.)
Related
- core#6239 — same signing guard (EIP-7702), closed as intentional
- metamask-extension#32495 — the "cannot include data" guard (open)
- core#5470 — PR that added the signing guard
Custom EVM Account Snap allowlisting is currently paused, so this is Flask-only today; a working keyring Snap is available for repro. Reported by the LocalSafe team (Cyfrin).
Please take a look at this this video to see the multisig support "sort of" working as a snap:
- 主要语言
- TypeScript
- 星标
- 424
- 派生
- 311
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 446
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
MetaMask/core 的其他 Issue
-
EIP-1898 object selectors fail before downstream RPC in eth-json-rpc-middleware 26.0.0可能已有人在做 @debojyoti10CC 于 5 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
CI: "Validate changelog diffs" job fails on every fork-sourced pull request可能已有人在做 @Roxen-AS 于 37 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
platform-api-docs: `scan` strategy misses ESM-only packages, which ship `.d.ts` rather than `.d.cts`可能已有人在做 @gaohan1994 于 38 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
[utils] Replace the `uuid` dependency with `crypto.randomUUID()`可能已有人在做 @avantikonde 于 51 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
MetaMask/core#10210 · 1 个 reaction ·
维护者通常 1 天内回复
-
[utils] `toWei` accepts fractional wei and returns wrong values可能已有人在做 @Roxen-AS 于 37 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
相似的 Issue
-
Flaky test: selecting a portion just after inserting it can also match its Change and Delete buttons未关闭ready-for-agent
难度 2/5 1-3 小时 新手友好度 84/100
linagora/dcs-onlyoffice#172 ·
-
bug follow-up
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
nightly-tests
难度 2/5 1-3 小时 新手友好度 68/100
BlackBeltTechnology/pi-agent-dashboard#1226 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
danielmiessler/LifeOS#3028 ·
维护者通常 5 天内回复
-
execute_sql cannot create a SQLite trigger or a PostgreSQL BEGIN ATOMIC function: the statement is cut at the semicolons inside its body可能已有人在做 @goranai 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复