From a31513494ded85c323cd261ca803d078e5137b0a Mon Sep 17 00:00:00 2001 From: beer-1 <147697694+beer-1@users.noreply.github.com> Date: Tue, 30 Jul 2024 11:53:26 +0900 Subject: [PATCH] overwrite sender with the actual sender at hook execution --- app/hook/wasm.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/hook/wasm.go b/app/hook/wasm.go index 54c4e69..9cc79e7 100644 --- a/app/hook/wasm.go +++ b/app/hook/wasm.go @@ -7,7 +7,6 @@ import ( "cosmossdk.io/core/address" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" @@ -32,11 +31,10 @@ func (mbh WasmBridgeHook) Hook(ctx context.Context, sender sdk.AccAddress, msgBy return err } - senderAddr, err := mbh.ac.StringToBytes(msg.Sender) + // overwrite sender with the actual sender + msg.Sender, err = mbh.ac.BytesToString(sender) if err != nil { return err - } else if !sender.Equals(sdk.AccAddress(senderAddr)) { - return sdkerrors.ErrUnauthorized } ms := wasmkeeper.NewMsgServerImpl(mbh.wasmKeeper)