Sponsored Content
Skip to content

Log public key in addition to IP address - #5678

Merged
bthomee merged 1 commit into
developfrom
a1q123456/replace-ip-address-with-public-key-from-logs
Oct 29, 2025
Merged

Log public key in addition to IP address#5678
bthomee merged 1 commit into
developfrom
a1q123456/replace-ip-address-with-public-key-from-logs

Conversation

@a1q123456

Copy link
Copy Markdown
Contributor

High Level Overview of Change

This PR adds public keys to logs.

Context of Change

Some validators used to complain that we're logging ip addresses which can expose them to attacks. However, after we masked out the ip addresses from the logs, we're unable to debug some issues. This PR adds public key to logs to help us debug issues.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Performance (increase or change in throughput and/or latency)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)
  • Documentation update
  • Chore (no impact to binary, e.g. .gitignore, formatting, dropping support for older tooling)
  • Release

API Impact

There's no API impact.

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change (in general, breaking changes should only impact the next api_version)
  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)
  • Peer protocol change (must be backward compatible or bump the peer protocol version)

Test Plan

Regression test.

@a1q123456
a1q123456 requested review from a team, bthomee and vlntb August 13, 2025 17:33
@a1q123456

a1q123456 commented Aug 13, 2025

Copy link
Copy Markdown
Contributor Author

Example

Peer:NFO [IP Address: x.x.x.x:51235, Public Key: n9KJayybHCMmRZRo7pGavZrfi1PeFfHd89pkQskCXJwyDZT3DHri, Id: 5] close: Closed

@codecov

codecov Bot commented Aug 13, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 44.68085% with 52 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.3%. Comparing base (7d5ed0c) to head (e2ee5db).
⚠️ Report is 8 commits behind head on develop.

Files with missing lines Patch % Lines
src/xrpld/overlay/detail/PeerImp.cpp 34.5% 19 Missing ⚠️
src/xrpld/peerfinder/detail/Logic.h 46.9% 17 Missing ⚠️
src/xrpld/overlay/detail/PeerImp.h 22.2% 7 Missing ⚠️
src/xrpld/overlay/detail/OverlayImpl.cpp 42.9% 4 Missing ⚠️
src/libxrpl/resource/Consumer.cpp 0.0% 2 Missing ⚠️
src/xrpld/app/misc/detail/ValidatorList.cpp 0.0% 2 Missing ⚠️
src/xrpld/overlay/detail/ConnectAttempt.cpp 0.0% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #5678     +/-   ##
=========================================
- Coverage     78.3%   78.3%   -0.0%     
=========================================
  Files          817     817             
  Lines        68982   68979      -3     
  Branches      8332    8308     -24     
=========================================
- Hits         54023   54019      -4     
- Misses       14959   14960      +1     
Files with missing lines Coverage Δ
include/xrpl/protocol/PublicKey.h 79.1% <100.0%> (+5.5%) ⬆️
include/xrpl/resource/detail/Entry.h 100.0% <100.0%> (ø)
src/xrpld/overlay/Peer.h 100.0% <ø> (ø)
src/xrpld/peerfinder/detail/SlotImp.h 71.0% <100.0%> (+2.0%) ⬆️
src/xrpld/overlay/detail/ConnectAttempt.cpp 0.0% <0.0%> (ø)
src/libxrpl/resource/Consumer.cpp 86.0% <0.0%> (-3.1%) ⬇️
src/xrpld/app/misc/detail/ValidatorList.cpp 86.3% <0.0%> (+0.3%) ⬆️
src/xrpld/overlay/detail/OverlayImpl.cpp 32.3% <42.9%> (-0.1%) ⬇️
src/xrpld/overlay/detail/PeerImp.h 10.7% <22.2%> (-0.8%) ⬇️
src/xrpld/peerfinder/detail/Logic.h 50.6% <46.9%> (-0.2%) ⬇️
... and 1 more

... and 4 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread include/xrpl/protocol/PublicKey.h Outdated
Comment thread src/xrpld/overlay/detail/PeerImp.cpp Outdated
@a1q123456
a1q123456 requested a review from Tapanito August 14, 2025 13:29
@Tapanito

Copy link
Copy Markdown
Contributor

@a1q123456 could you update the example, please? I think by adding the public key to the prefix it'll change the output format a little.

Comment thread src/xrpld/overlay/detail/PeerImp.cpp Outdated
Comment thread src/xrpld/overlay/detail/PeerImp.cpp
@a1q123456
a1q123456 requested a review from Tapanito August 14, 2025 15:00

@Tapanito Tapanito left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Tapanito
Tapanito self-requested a review August 15, 2025 09:12
@shortthefomo

Copy link
Copy Markdown
Contributor

there are very valid reasons for not exposing IP's of validators.

one simple one is I can now simply peer with any validator I wish.

exposing the IP of validators opens them up to other attacks as well like ddos..

not a fan of this at all. if you require this debug build your own version of rippled and deploy it on the servers you need to monitor. it should not be system wide change.

@a1q123456

Copy link
Copy Markdown
Contributor Author

there are very valid reasons for not exposing IP's of validators.

one simple one is I can now simply peer with any validator I wish.

exposing the IP of validators opens them up to other attacks as well like ddos..

not a fan of this at all. if you require this debug build your own version of rippled and deploy it on the servers you need to monitor. it should not be system wide change.

Hey Fomo, we’re already logging IP addresses and this PR doesn’t log more IP addresses. Instead, it only adds public keys to help us narrow down issues, as IP addresses are masked out in UNL logs and there’s no way to figure out which validator it is in logs.

@a1q123456 a1q123456 added the Needs additional review PR requires at least one more code review approval before it can be merged label Aug 20, 2025
Comment thread src/libxrpl/resource/Consumer.cpp
Comment thread include/xrpl/protocol/PublicKey.h
@a1q123456
a1q123456 force-pushed the a1q123456/replace-ip-address-with-public-key-from-logs branch from a841fb2 to a5fd74e Compare September 25, 2025 14:17
@a1q123456
a1q123456 requested a review from bthomee September 25, 2025 14:58

@bthomee bthomee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to adding the fingerprint as a sink prefix, the logs will be growing as in the past only IDs were logged and now IP address and public key as well. By how much do you expect the logs to grow?

Comment thread src/xrpld/overlay/detail/PeerImp.cpp Outdated
PeerImp::makePrefix(std::string const& fingerprint)
{
std::stringstream ss;
ss << "[" << std::setfill('0') << std::setw(3) << fingerprint << "] ";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The std::setw(3) seems unnecessary, since the updated fingerprint now contains the IP address, public key, and node ID - which will be much longer than 3 characters.

Comment thread src/xrpld/peerfinder/detail/Logic.h Outdated
Comment thread src/xrpld/peerfinder/detail/Logic.h Outdated
case Slot::closing:
JLOG(m_journal.trace()) << beast::leftw(18) << "Logic finished "
<< slot->remote_endpoint();
<< slot->fingerprint();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm noticing a general inconsistency in how the logging happens. In PeerImp the sinks were modified to use the fingerprint as prefix, but here the sinks are unmodified but the fingerprint is added explicitly to the log message.

I would suggest to revisit the codebase add the fingerprint as prefix to sinks wherever possible. If it isn't possible in most places, so you'll have to add it manually to the log lines for many sinks, then maybe it is better to not use the fingerprint as sink prefix anywhere and just add to each log line. I'm otherwise concerned the logs end up in a hard-to-parse mess.

@a1q123456 a1q123456 Oct 6, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried running rippled for around 10 minutes for each branch and the result shows that the develop branch writes around 50 MB logs per minute and this PR writes 66 MB logs per minute, so I'd say this PR is going to increase the log file size by around 30% - 32%.

Version Duration (min) Growth rate (bytes/min) Growth rate (MB/min)
PR 10.888 66,739,865 66.74 MB/min
develop 10.727 50,785,364 50.79 MB/min

@bthomee bthomee added this to the 3.1.0 milestone Oct 3, 2025
@a1q123456
a1q123456 force-pushed the a1q123456/replace-ip-address-with-public-key-from-logs branch from 6537490 to c106139 Compare October 6, 2025 15:54
Comment thread src/xrpld/peerfinder/detail/SlotImp.h Outdated
Comment thread src/xrpld/peerfinder/detail/Logic.h Outdated
Comment thread src/xrpld/peerfinder/detail/Logic.h Outdated
Comment thread src/xrpld/peerfinder/detail/Logic.h Outdated
@bthomee
bthomee force-pushed the a1q123456/replace-ip-address-with-public-key-from-logs branch from 8ac14de to 476b2e4 Compare October 28, 2025 18:02
@bthomee bthomee removed the Needs additional review PR requires at least one more code review approval before it can be merged label Oct 28, 2025
@a1q123456 a1q123456 added the Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. label Oct 28, 2025
@bthomee
bthomee enabled auto-merge October 28, 2025 18:12
@bthomee
bthomee disabled auto-merge October 28, 2025 18:32
To protect the identity of UNL validators, the IP addresses are redacted from the log messages sent to the common Grafana instance. However, without such identifying information it is challenging to debug issues. This change adds a node's public key to logs to improve our ability to debug issues.
@bthomee
bthomee force-pushed the a1q123456/replace-ip-address-with-public-key-from-logs branch from f87e421 to e2ee5db Compare October 28, 2025 18:33
@bthomee
bthomee added this pull request to the merge queue Oct 29, 2025
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2025
@bthomee
bthomee added this pull request to the merge queue Oct 29, 2025
Merged via the queue into develop with commit ed5d6f3 Oct 29, 2025
2 of 3 checks passed
@bthomee
bthomee deleted the a1q123456/replace-ip-address-with-public-key-from-logs branch October 29, 2025 15:00
@mvadari mvadari modified the milestones: 3.1.0, 3.2.0 May 20, 2026
beartec-jpg pushed a commit to beartec-jpg/FalconLedger that referenced this pull request Jun 1, 2026
To protect the identity of UNL validators, the IP addresses are redacted from the log messages sent to the common Grafana instance. However, without such identifying information it is challenging to debug issues. This change adds a node's public key to logs to improve our ability to debug issues.

Co-authored-by: Bart Thomee <11445373+bthomee@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants