SmartlyDressedGames/Unturned-3.x-Community

Redacting information in log files

Opened this issue · 3 comments

It was brought to my attention by asineth0 that the server logs for the vanilla game show IPs due to BattlEye.

image

People consistently post logs for the official discord and other community hubs to receive support. If the owner of a large server posted their logs in/on one of those sites and had bad blood with someone, that someone could potentially attack the most active players on that server. I believe we've been promoting the posting of logs on UO for a very long time.

I'm not sure what the solution could be for this, whether it be a separate debug log for more obvious problems like exceptions and errors or simply putting BattlEye logs in a separate file.

Interesting point! The same could be argued for details like the server's IP. Will adjust the name of the issue.

Implemented for the next update! There are a couple of new properties and functions for those who want to use them:

Logs.ShouldRedactLogs defaults to true. Can be turned off by adding -UnredactedLogs to the command-line.

Logs.RedactionReplacement is a string to replace text with. Defaults to [redacted].

Logs.RedactIPv4Addresses replaces text that looks like an IP in the string. Wrote some test cases for it so hopefully relatively robust. For example, "abc 1.2.3.4 def" becomes "abc [redacted] def" but "abc 1.2.3.4.5 def" doesn't.

Vanilla uses RedactIPv4Addresses for messages from BattlEye's pfnPrintMessage callback. The "allowed IP for Workshop downloads" is also redacted.

If any other messages that should be redacted come to mind, let me know! Thanks for bringing this up. :)

Amazing!