Skip to content
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

fix: connect request completed source validation #11701

Merged
merged 4 commits into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions app/components/Views/AccountConnect/AccountConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ const AccountConnect = (props: AccountConnectProps) => {
const sdkConnection = SDKConnect.getInstance().getConnection({
channelId: channelIdOrHostname,
});

const isOriginMMSDKRemoteConn = sdkConnection !== undefined;

const dappIconUrl = sdkConnection?.originatorInfo?.icon;
Expand Down Expand Up @@ -174,9 +175,10 @@ const AccountConnect = (props: AccountConnectProps) => {
channelIdOrHostname,
]);

const urlWithProtocol = (hostname && !isUUID(hostname))
? prefixUrlWithProtocol(hostname)
: domainTitle;
const urlWithProtocol =
hostname && !isUUID(hostname)
? prefixUrlWithProtocol(hostname)
: domainTitle;

const isAllowedOrigin = useCallback((origin: string) => {
const { PhishingController } = Engine.context;
Expand Down Expand Up @@ -236,15 +238,16 @@ const AccountConnect = (props: AccountConnectProps) => {
// walletconnect channelId format: app.name.org
// sdk channelId format: uuid
// inappbrowser channelId format: app.name.org but origin is set
if (channelIdOrHostname) {
if (sdkConnection) {
return SourceType.SDK;
}
if (isOriginWalletConnect) {
return SourceType.WALLET_CONNECT;
}

if (sdkConnection) {
return SourceType.SDK;
}

return SourceType.IN_APP_BROWSER;
}, [sdkConnection, channelIdOrHostname]);
}, [isOriginWalletConnect, sdkConnection]);

// Refreshes selected addresses based on the addition and removal of accounts.
useEffect(() => {
Expand Down
Loading