Skip to content

Commit

Permalink
Fix vuln 458 (#25)
Browse files Browse the repository at this point in the history
* fix: valide wallet and provider inputs

* fix: valide wallet and provider inputs
  • Loading branch information
LordCheta authored Nov 3, 2023
1 parent 8888618 commit 1e2dc4b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
import { getChangePubkeyLegacyMessage, getChangePubkeyMessage, MAX_TIMESTAMP, isNFT } from './utils';
import { Transaction, submitSignedTransaction } from './operations';
import { AbstractWallet } from './abstract-wallet';

export { Transaction, RootstockOperation, submitSignedTransaction, submitSignedTransactionsBatch } from './operations';

export class Wallet extends AbstractWallet {
Expand Down Expand Up @@ -66,6 +65,16 @@ export class Wallet extends AbstractWallet {
throw new Error('If you passed signer, you must also pass ethSignerType.');
}

// Validate that ethWallet is valid Ethereum signer
if (!(ethWallet instanceof ethers.Signer)) {
throw new Error('Invalid Ethereum signer');
}

// validate that provider is valid rollup provider
if (!(provider instanceof SyncProvider)) {
throw new Error('Invalid rif-rollup provider');
}

const ethMessageSigner = new EthMessageSigner(ethWallet, ethSignerType);
const wallet = new Wallet(
ethWallet,
Expand Down

0 comments on commit 1e2dc4b

Please sign in to comment.