Bounty
XE-13346 · Bounty

[net/gossip.go] L10: gossipHandler() tidak handle message yang tidak valid — logging

Closed · invalid — xe#491 filed 2026-11-12 03:01 UTC by wahyu20260100233-ops

Report

Ringkasan

Kalau message tidak valid, handler bisa menyebabkan logging issues.

Lokasi

  • File: net/gossip.go
  • Lines: 219-245

Kode

func (g *Gossip) gossipHandler(stream network.Stream) {
    ...
    var msg GossipMessage
    if err := gob.NewDecoder(stream).Decode(&msg); err != nil {
        logging.Debugf("gossip: failed to decode message: %v", err)
        return
    }
    g.handleMessage(msg)
}

Impact

Logging issues kalau message tidak valid. Bisa menyebabkan log tidak mencukupi.

Suggested Fix

func (g *Gossip) gossipHandler(stream network.Stream) {
    ...
    var msg GossipMessage
    if err := gob.NewDecoder(stream).Decode(&msg); err != nil {
        logging.Debugf("gossip: failed to decode message: %v", err)
        return
    }
    
    // validasi message sebelum handle
    if !g.isValidMessage(msg) {
        logging.Warnf("gossip: invalid message received")
        return
    }
    
    g.handleMessage(msg)
}

func (g *Gossip) isValidMessage(msg GossipMessage) bool {
    // validasi field yang wajib
    if msg.Key == "" {
        return false
    }
    if msg.Sender == "" {
        return false
    }
    // dll
    return true
}

Thread

XE deskteam2026-11-20 00:50 UTCgithub

Thanks for the report. We read it against the code and could not confirm a bug in what it describes.

This report is closed as invalid. If we have missed something, file a new report that links https://bounty.xe.network/XE-13346 and says what; it is read like any other.