Browse Source

reactors: omit incoming message bytes from reactor logs (#5743)

After a reactor has failed to parse an incoming message, it shouldn't output the "bad" data into the logs, as that data is unfiltered and could have anything in it. (We also don't think this information is helpful to have in the logs anyways.)
pull/5745/head
Tess Rinearson 4 years ago
committed by GitHub
parent
commit
79890d8393
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 7 additions and 7 deletions
  1. +1
    -1
      blockchain/v0/reactor.go
  2. +1
    -1
      blockchain/v2/reactor.go
  3. +1
    -1
      consensus/reactor.go
  4. +1
    -1
      mempool/reactor.go
  5. +1
    -1
      p2p/pex/pex_reactor.go
  6. +1
    -1
      statesync/reactor.go
  7. +1
    -1
      test/maverick/consensus/reactor.go

+ 1
- 1
blockchain/v0/reactor.go View File

@ -209,7 +209,7 @@ func (bcR *BlockchainReactor) respondToPeer(msg *bcproto.BlockRequest,
func (bcR *BlockchainReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) {
msg, err := bc.DecodeMsg(msgBytes)
if err != nil {
bcR.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes)
bcR.Logger.Error("Error decoding message", "src", src, "chId", chID, "err", err)
bcR.Switch.StopPeerForError(src, err)
return
}


+ 1
- 1
blockchain/v2/reactor.go View File

@ -461,7 +461,7 @@ func (r *BlockchainReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) {
msg, err := bc.DecodeMsg(msgBytes)
if err != nil {
r.logger.Error("error decoding message",
"src", src.ID(), "chId", chID, "msg", msg, "err", err, "bytes", msgBytes)
"src", src.ID(), "chId", chID, "msg", msg, "err", err)
_ = r.reporter.Report(behaviour.BadMessage(src.ID(), err.Error()))
return
}


+ 1
- 1
consensus/reactor.go View File

@ -230,7 +230,7 @@ func (conR *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) {
msg, err := decodeMsg(msgBytes)
if err != nil {
conR.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes)
conR.Logger.Error("Error decoding message", "src", src, "chId", chID, "err", err)
conR.Switch.StopPeerForError(src, err)
return
}


+ 1
- 1
mempool/reactor.go View File

@ -165,7 +165,7 @@ func (memR *Reactor) RemovePeer(peer p2p.Peer, reason interface{}) {
func (memR *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) {
msg, err := memR.decodeMsg(msgBytes)
if err != nil {
memR.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes)
memR.Logger.Error("Error decoding message", "src", src, "chId", chID, "err", err)
memR.Switch.StopPeerForError(src, err)
return
}


+ 1
- 1
p2p/pex/pex_reactor.go View File

@ -241,7 +241,7 @@ func (r *Reactor) logErrAddrBook(err error) {
func (r *Reactor) Receive(chID byte, src Peer, msgBytes []byte) {
msg, err := decodeMsg(msgBytes)
if err != nil {
r.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes)
r.Logger.Error("Error decoding message", "src", src, "chId", chID, "err", err)
r.Switch.StopPeerForError(src, err)
return
}


+ 1
- 1
statesync/reactor.go View File

@ -100,7 +100,7 @@ func (r *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) {
msg, err := decodeMsg(msgBytes)
if err != nil {
r.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes)
r.Logger.Error("Error decoding message", "src", src, "chId", chID, "err", err)
r.Switch.StopPeerForError(src, err)
return
}


+ 1
- 1
test/maverick/consensus/reactor.go View File

@ -230,7 +230,7 @@ func (conR *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) {
msg, err := decodeMsg(msgBytes)
if err != nil {
conR.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes)
conR.Logger.Error("Error decoding message", "src", src, "chId", chID, "err", err)
conR.Switch.StopPeerForError(src, err)
return
}


Loading…
Cancel
Save