From fa4b6f6908b51d5abf762f335e9a46749f939e1e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 16 Feb 2023 16:12:56 +0000 Subject: [PATCH] fix: avoid broadcasting tx through query (backport #15044) (#15046) Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com> --- baseapp/abci.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/baseapp/abci.go b/baseapp/abci.go index 1e8cf7506..459a1aacc 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -507,6 +507,10 @@ func (app *BaseApp) Query(req abci.RequestQuery) (res abci.ResponseQuery) { telemetry.IncrCounter(1, "query", req.Path) defer telemetry.MeasureSince(time.Now(), req.Path) + if req.Path == "/cosmos.tx.v1beta1.Service/BroadcastTx" { + return sdkerrors.QueryResult(sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "can't route a broadcast tx message"), app.trace) + } + // handle gRPC routes first rather than calling splitPath because '/' characters // are used as part of gRPC paths if grpcHandler := app.grpcQueryRouter.Route(req.Path); grpcHandler != nil {