fix: allow redelegation signing for internal accounts from external requests#7918
Open
osobot-ai wants to merge 2 commits intoMetaMask:mainfrom
Open
fix: allow redelegation signing for internal accounts from external requests#7918osobot-ai wants to merge 2 commits intoMetaMask:mainfrom
osobot-ai wants to merge 2 commits intoMetaMask:mainfrom
Conversation
…equests The validateDelegation function previously blocked all delegation signing from external origins when the delegator was an internal account. This was overly restrictive — it should only block root delegations (where authority equals ROOT_AUTHORITY). Redelegations are safe because the signer is not the root delegator and can only pass on permissions already granted to them. Fixes MetaMask#7917
Addresses Cursor Bugbot review: if the authority field is missing or undefined, treat it as a root delegation and block the request. This ensures fail-closed behavior — only explicitly non-root authorities (redelegations) are allowed through.
Author
|
Addressed @cursor-bot's review — good catch on the missing Updated to fail-closed: if Added a test case for the missing authority scenario as well. See commit 77575e4. |
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.
Explanation
This PR fixes the
validateDelegationfunction inpackages/signature-controller/src/utils/validation.tsto distinguish between root delegations and redelegations.The Problem
Currently,
validateDelegationblocks ALL delegation signing requests from external origins when the delegator is an internal account. This prevents users from redelegating permissions that were granted to them, which is a legitimate and safe operation.The Fix
The delegation message includes an
authorityfield that indicates whether this is a root delegation or a redelegation:authority=0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff(ROOT_AUTHORITY) — the EOA is creating a new delegation from scratch, granting access to its own funds. This should remain blocked for external requests.authority=<parent delegation hash>— the EOA is passing on permissions that were already granted to it. This is safe because the signer cannot exceed the permissions of the parent delegation.The fix adds a check for the
authorityfield: only block whenauthority === ROOT_AUTHORITY.Security Analysis
Allowing redelegation signing is safe because:
Changes
ROOT_AUTHORITYandAUTHORITY_FIELDconstants tovalidation.tsvalidateDelegationto check theauthorityfield — only blocks root delegationsauthority: ROOT_AUTHORITYfor root delegation scenariosFixes #7917
References
Note
Medium Risk
Changes signature-request validation rules for external origins, which can affect authorization boundaries around internal accounts. The logic is narrowly scoped and fail-closed when
authorityis missing, but still impacts security-sensitive signing behavior.Overview
Fixes delegation validation so external origins can request redelegation signatures from internal accounts, while still blocking root delegations.
validateDelegationnow inspects the typed-dataauthorityfield (fail-closed when missing) and only rejects when it equalsROOT_AUTHORITY, with updated error messaging.Updates and expands tests to cover root vs non-root
authoritycases, and documents the behavior change in thesignature-controllerchangelog.Written by Cursor Bugbot for commit 77575e4. This will update automatically on new commits. Configure here.