-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
release: 7.61.4 #24221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release: 7.61.4 #24221
Changes from all commits
eb642e2
8240280
4a50956
222b538
7c6f4aa
9ce86cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,8 @@ import logger from './logger'; | |
| import { ACTIONS, PREFIXES } from '../../../constants/deeplinks'; | ||
| import { decompressPayloadB64 } from '../utils/compression-utils'; | ||
| import { whenStoreReady } from '../utils/when-store-ready'; | ||
| import { ORIGIN_METAMASK } from '@metamask/controller-utils'; | ||
| import { rpcErrors } from '@metamask/rpc-errors'; | ||
| import { INTERNAL_ORIGINS } from '../../../constants/transaction'; | ||
|
|
||
| /** | ||
| * The ConnectionRegistry is the central service responsible for managing the | ||
|
|
@@ -111,15 +112,18 @@ export class ConnectionRegistry { | |
|
|
||
| try { | ||
| const connReq = this.parseConnectionRequest(url); | ||
| // Prevent external connections from using internal origins | ||
| // This is an external connection (SDK V2), so block any internal origin | ||
| if ( | ||
| (connReq.metadata.dapp.url && | ||
| connReq.metadata.dapp.url === ORIGIN_METAMASK) || | ||
| (connReq.metadata.dapp.name && | ||
| connReq.metadata.dapp.name === ORIGIN_METAMASK) | ||
| INTERNAL_ORIGINS.includes(connReq.metadata.dapp.url) || | ||
| INTERNAL_ORIGINS.includes(connReq.metadata.dapp.name) | ||
| ) { | ||
| throw new Error('Connections from metamask origin are not allowed'); | ||
| throw rpcErrors.invalidParams({ | ||
| message: 'External transactions cannot use internal origins', | ||
| }); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Undefined values may incorrectly match in origin checkThe Additional Locations (1) |
||
| } | ||
| connInfo = this.toConnectionInfo(connReq); | ||
|
|
||
| this.hostapp.showConnectionLoading(connInfo); | ||
| conn = await Connection.create( | ||
| connInfo, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing truthiness guards may block legitimate connections
The new
INTERNAL_ORIGINS.includes()check lacks truthiness guards, unlike the existing check at lines 29-34. TheINTERNAL_ORIGINSarray containsprocess.env.MM_FOX_CODE, which may beundefinedin some environments. IforiginatorInfo.urlororiginatorInfo.titleis alsoundefined(possible since these come from external SDK types with optional fields), thenINTERNAL_ORIGINS.includes(undefined)would returntrue, incorrectly blocking legitimate connections. The check should follow the same pattern as lines 29-34 by adding truthiness guards likeoriginatorInfo.url && INTERNAL_ORIGINS.includes(originatorInfo.url).