Skip to content

Commit

Permalink
overwrite sender with the actual sender at hook execution
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Jul 30, 2024
1 parent ab1dff1 commit a315134
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/hook/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down

0 comments on commit a315134

Please sign in to comment.