From 962ed56ef7519a5c500900e1104724939d4d5407 Mon Sep 17 00:00:00 2001 From: samsamtrum Date: Sun, 24 May 2026 21:14:08 +0700 Subject: [PATCH] Validate user operation hash before lookup --- packages/executor/src/modules/eth.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/executor/src/modules/eth.ts b/packages/executor/src/modules/eth.ts index d9bd993f..445c45ef 100644 --- a/packages/executor/src/modules/eth.ts +++ b/packages/executor/src/modules/eth.ts @@ -19,7 +19,7 @@ import { UserOperation } from "@skandha/types/lib/contracts/UserOperation"; import { UserOperationStruct } from "@skandha/types/lib/contracts/EPv6/EntryPoint.js"; import { MempoolEntryStatus } from "@skandha/types/lib/executor"; import { BlockscoutAPI } from "@skandha/utils/lib/third-party"; -import { PublicClient, Hex, GetTransactionReturnType } from "viem"; +import { PublicClient, Hex, GetTransactionReturnType, isHex } from "viem"; import { UserOpValidationService, MempoolService, @@ -676,6 +676,12 @@ export class Eth { async getUserOperationByHash( hash: string ): Promise { + if (!isHex(hash, { strict: true }) || hash.length !== 66) { + throw new RpcError( + "Missing/invalid userOpHash", + RpcErrorCodes.INVALID_USEROP + ); + } const entry = await this.mempoolService.getEntryByHash(hash); if (entry) { if (entry.status < MempoolEntryStatus.Submitted || entry.transaction) {