BanHammer 4.1: security and stability update after a full code audit
BanHammer is my moderation plugin for Paper and Folia servers: ban, mute, warn and jail players with presets, a punishment history in the database and Discord integration. After version 4.0 I reviewed the entire code base. Version 4.1.0 adds no features for their own sake – it makes the existing ones behave exactly as documented.
Security
- Player input such as appeal texts is now escaped. Previously it could be used to inject clickable commands into staff chat and hidden links into the Discord channel.
- The statistics menu checks permissions on every access instead of recognising it by its window title.
- banhammer.bypass and banhammer.ipban are now respected by every command.
- Discord webhook URLs no longer end up in the log.
Punishments that do what they should
- An unrecognised duration used to silently create a permanent punishment. Now it produces an error, and weeks, months and years are supported.
- Automatic bans after warnings no longer fire again and again; warnings can expire.
- Expired punishments are lifted reliably on Folia too.
- Jailed players can no longer escape by logging in again.
Database
Punishments are stored in SQLite or MySQL. With 4.1 MySQL works reliably, existing tables are migrated automatically on updates, and the longer names of Bedrock players via Geyser fit as well. If the database goes down, staff get an error message instead of records being lost silently.
Discord as a second pair of eyes
Every moderation action can be mirrored into a Discord channel, so the team sees what's happening on the server even when they're not in-game.
Compatibility
BanHammer 4.1.0 runs on Paper, Purpur, Spigot and Folia from Minecraft 1.21 to 26.2.
The goal stays the same: on a serious server, moderation shouldn't be a gut feeling – it should be documented and traceable.