Skip to content

Commit 8aa67c5

Browse files
committed
Remove unused fcl_redirect_url redirect and DEEPLINK/RPC strategy
1 parent 5e44c67 commit 8aa67c5

7 files changed

Lines changed: 11 additions & 132 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@onflow/fcl-core": patch
3+
"@onflow/fcl-react-native": patch
4+
---
5+
6+
Remove the unused `fcl_redirect_url` redirect path in `sendMsgToFCL` and the `DEEPLINK/RPC` strategy. The redirect passed an attacker-controllable URL to `window.location.href` (DOM-XSS / open-redirect) and was only used by `DEEPLINK/RPC`, which no wallets implement.

‎packages/fcl-core/src/wallet-utils/send-msg-to-fcl.ts‎

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
import {
2-
FCL_REDIRECT_URL_PARAM_NAME,
3-
FCL_RESPONSE_PARAM_NAME,
4-
} from "../utils/constants"
51
import {onMessageFromFCL} from "./on-message-from-fcl"
62

73
export interface PollingResponse {
@@ -14,8 +10,8 @@ export interface PollingResponse {
1410

1511
/**
1612
* @description Sends messages from a wallet or service back to the parent FCL application. This function
17-
* handles communication between wallet UIs (running in iframes, popups, or redirects) and the main FCL
18-
* application. It automatically detects the communication method (redirect, iframe, or popup) and sends
13+
* handles communication between wallet UIs (running in iframes or popups) and the main FCL
14+
* application. It automatically detects the communication method (iframe or popup) and sends
1915
* the message accordingly.
2016
*
2117
* @param type The message type identifier (e.g., "FCL:VIEW:RESPONSE", "FCL:VIEW:READY")
@@ -41,15 +37,7 @@ export interface PollingResponse {
4137
* })
4238
*/
4339
export const sendMsgToFCL = (type: string, msg?: PollingResponse): void => {
44-
const data = {...msg, type}
45-
46-
const urlParams = new URLSearchParams(window.location.search)
47-
const redirectUrl = urlParams.get(FCL_REDIRECT_URL_PARAM_NAME)
48-
if (redirectUrl) {
49-
const url = new URL(redirectUrl)
50-
url.searchParams.append(FCL_RESPONSE_PARAM_NAME, JSON.stringify(data))
51-
window.location.href = url.href
52-
} else if (window.location !== window.parent.location) {
40+
if (window.location !== window.parent.location) {
5341
window.parent.postMessage({...msg, type}, "*")
5442
} else if (window.opener) {
5543
window.opener.postMessage({...msg, type}, "*")

‎packages/fcl-react-native/src/utils/react-native/ServiceDiscovery.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const useServiceDiscovery = ({fcl}) => {
2626
const requestBody = {
2727
fclVersion: VERSION,
2828
userAgent: "ReactNative",
29-
supportedStrategies: ["WC/RPC", "DEEPLINK/RPC"],
29+
supportedStrategies: ["WC/RPC"],
3030
}
3131

3232
// Fetch wallets from Discovery API
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import {CORE_STRATEGIES, getExecHttpPost} from "@onflow/fcl-core"
22
import {execLocal} from "./exec-local"
3-
import {execDeeplinkRPC} from "./strategies/deeplink-rpc"
43
import {execDiscoveryRN} from "./strategies/discovery-rn"
54
import {DISCOVERY_RN_METHOD} from "./constants"
65

76
export const coreStrategies = {
87
[CORE_STRATEGIES["HTTP/RPC"]]: getExecHttpPost(execLocal),
98
[CORE_STRATEGIES["HTTP/POST"]]: getExecHttpPost(execLocal),
10-
[CORE_STRATEGIES["DEEPLINK/RPC"]]: execDeeplinkRPC,
119
[DISCOVERY_RN_METHOD]: execDiscoveryRN,
1210
}

‎packages/fcl-react-native/src/utils/react-native/strategies/deeplink-rpc.js‎

Lines changed: 0 additions & 42 deletions
This file was deleted.

‎packages/fcl-react-native/src/utils/react-native/strategies/discovery-rn.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {config} from "@onflow/config"
1818
* 4. This function executes → shows ConnectModal with wallet list
1919
* 5. User selects wallet
2020
* 6. Returns {status: "REDIRECT", data: walletService}
21-
* 7. FCL core executes the wallet service (WC/RPC or DEEPLINK/RPC)
21+
* 7. FCL core executes the wallet service (WC/RPC)
2222
*
2323
* @param {object} params - Strategy execution parameters
2424
* @param {object} params.service - The discovery service to execute

‎packages/fcl-react-native/src/utils/react-native/strategies/utils/browser.js‎

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)