Skip to content

Commit 663052a

Browse files
authored
fix(analytics): filter out some events (#1249)
* fix(analytics): filter out some events * fix(analytics): update
1 parent 3d0ba19 commit 663052a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/sdk-socket-server-next/src/analytics-api.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,24 @@ app.post('/evt', evtMetricsMiddleware, async (_req, res) => {
272272
return res.status(400).json({ error: 'wrong event name' });
273273
}
274274

275+
const toCheckEvents = ['sdk_rpc_request_done', 'sdk_rpc_request'];
276+
const allowedMethods = [
277+
"eth_sendTransaction",
278+
"wallet_switchEthereumChain",
279+
"personal_sign",
280+
"eth_signTypedData_v4",
281+
"wallet_requestPermissions",
282+
"metamask_connectSign"
283+
];
284+
285+
// Filter: drop RPC events with unallowed methods silently, let all else through
286+
if (toCheckEvents.includes(body.event) &&
287+
(!body.params ||
288+
!body.params.method ||
289+
!allowedMethods.includes(body.params.method))) {
290+
return res.json({ success: true });
291+
}
292+
275293
let channelId: string = body.id || 'sdk';
276294
// Prevent caching of events coming from extension since they are not re-using the same id and prevent increasing redis queue size.
277295
let isExtensionEvent = body.from === 'extension';

0 commit comments

Comments
 (0)