Disable logging for specific commands

Discussion in 'Plugin Development' started by CPU Terminator, Jul 5, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    CPU Terminator

    As part of a custom password plugin, I need to filter the logging of certain commands (notably commands like /setpassword or /password) such that the plaintext password isn't leaked into the console or file log.

    Is there any particular framework within the Bukkit API or CraftBukkit instance (spigot equivalents are okay too) that allow logging to be disabled or altered for specific commands/text? I've tried cancelling the PlayerCommandPreprocessEvent at various priority levels to no avail.
     
  2. Offline

    SuperSniper

    I'd most likely just do this:

    once a player does the command that you dont want shown in console, send the console a bunch of blank messages (Clearing the Console chat)
     
  3. Cancelling PlayerCommandPreprocessEvent doesn't stop the logging? Weird... But anyway, my only other suggestion would have to be, modifying the actual CraftBukkit/Spigot JAR and checking from within there.
     
  4. Offline

    CPU Terminator

    The problem with this approach is that:

    1. We get logspam with high number of connect/disconnects of players.
    2. The password is still stored in plaintext somewhere in there.

    What's the use of a secure (NOT SHA-512, something like Scrypt/Bcrypt) password derivation algorithm if the password is just stored in plaintext. Oh well... I guess the command can get intercepted over the transmission medium anyway since minecraft has no encryption...

    I was hoping it wouldn't come to this, but is there any particular place to start? Should I try hijacking the logger instance and filtering messages there? Or is there a specific class (or collection of classes) that CraftBukkit/Spigot uses to push logs to screen and file.
     
  5. Not sure, you should try finding the source of the commands which should show where it logs commands. If you're using IntelliJ, this should be very easy as you can easily just open up a command class, such as CommandStop (I think that's what it's called) then right click and choose that "Find usages" option, which'll show the class which puts it in a command map and then from there you can go hunting, possibly having to use "Find usages" a few more times. If I get time, I'll decompile quickly and see if I can find it.
     
Thread Status:
Not open for further replies.

Share This Page