vacp2p / nim-libp2p

libp2p implementation in Nim
https://vacp2p.github.io/nim-libp2p/docs/
MIT License
242 stars 52 forks source link

do not log yamux buffers without sanitization (trace log level) #1046

Closed etan-status closed 4 months ago

etan-status commented 4 months ago

The Msg Rcv trace log does not sanitize the buffer against binary data, which may trigger oddities in the terminal displaying it, as binary control characters get interpreted. Using shortLog instead is consistent with Mplex and displays the start and end as hex. It makes more sense anyway because the exchanged messages actually do contain binary headers very often, and displaying these as string is most likely incorrect.

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 82.80%. Comparing base (6c87348) to head (b66a1c3).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1046/graphs/tree.svg?width=650&height=150&src=pr&token=UR5JRQ249W&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im)](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1046?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im) ```diff @@ Coverage Diff @@ ## unstable #1046 +/- ## ============================================ + Coverage 82.77% 82.80% +0.03% ============================================ Files 91 91 Lines 15604 15604 ============================================ + Hits 12916 12921 +5 + Misses 2688 2683 -5 ``` | [Files](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1046?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im) | Coverage Δ | | |---|---|---| | [libp2p/muxers/yamux/yamux.nim](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1046?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im#diff-bGlicDJwL211eGVycy95YW11eC95YW11eC5uaW0=) | `88.34% <100.00%> (ø)` | | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1046/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im)