fix(housekeeping): audit room and session actions

The first audit coverage pass covered economy/account-impacting HK actions, but room and session mutators still returned success without an audit row. Add audit entries for room deletion, force disconnect, room kicks, user kicks, room mute, room state changes, and successful unbans, and extend the coverage contract to keep these privileged actions tracked.
This commit is contained in:
simoleo89
2026-06-13 15:55:28 +02:00
parent dbcf139a52
commit 79d734ef26
8 changed files with 45 additions and 1 deletions
@@ -63,6 +63,11 @@ public class HousekeepingDeleteRoomEvent extends MessageHandler {
return;
}
com.eu.habbo.habbohotel.modtool.HousekeepingAuditLog.log(
this.client.getHabbo().getHabboInfo().getId(),
this.client.getHabbo().getHabboInfo().getUsername(),
ACTION_KEY, 0, "roomId=" + roomId,
this.client.getHabbo().getHabboInfo().getIpLogin());
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, true, roomId, ""));
}
}
@@ -52,6 +52,11 @@ public class HousekeepingForceDisconnectUserEvent extends MessageHandler {
// ACK first so the action result lands before the target's socket
// closes (otherwise an alerted user on the same emulator thread may
// already be torn down when we try to write).
com.eu.habbo.habbohotel.modtool.HousekeepingAuditLog.log(
this.client.getHabbo().getHabboInfo().getId(),
this.client.getHabbo().getHabboInfo().getUsername(),
ACTION_KEY, userId, "reason=" + (reason != null ? reason : ""),
this.client.getHabbo().getHabboInfo().getIpLogin());
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, true, userId, ""));
target.disconnect();
@@ -36,6 +36,11 @@ public class HousekeepingKickAllFromRoomEvent extends MessageHandler {
room.ejectAll();
com.eu.habbo.habbohotel.modtool.HousekeepingAuditLog.log(
this.client.getHabbo().getHabboInfo().getId(),
this.client.getHabbo().getHabboInfo().getUsername(),
ACTION_KEY, 0, "roomId=" + roomId,
this.client.getHabbo().getHabboInfo().getIpLogin());
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, true, roomId, ""));
}
}
@@ -60,6 +60,11 @@ public class HousekeepingKickUserEvent extends MessageHandler {
target.alert(reason);
}
com.eu.habbo.habbohotel.modtool.HousekeepingAuditLog.log(
this.client.getHabbo().getHabboInfo().getId(),
this.client.getHabbo().getHabboInfo().getUsername(),
ACTION_KEY, userId, "reason=" + (reason != null ? reason : ""),
this.client.getHabbo().getHabboInfo().getIpLogin());
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, true, userId, ""));
}
}
@@ -45,6 +45,11 @@ public class HousekeepingMuteRoomEvent extends MessageHandler {
room.setMuted(minutes > 0);
com.eu.habbo.habbohotel.modtool.HousekeepingAuditLog.log(
this.client.getHabbo().getHabboInfo().getId(),
this.client.getHabbo().getHabboInfo().getUsername(),
ACTION_KEY, 0, "roomId=" + roomId + " minutes=" + minutes + " muted=" + (minutes > 0),
this.client.getHabbo().getHabboInfo().getIpLogin());
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, true, roomId, ""));
}
}
@@ -44,6 +44,11 @@ public class HousekeepingRoomStateEvent extends MessageHandler {
room.setState(open ? RoomState.OPEN : RoomState.LOCKED);
room.save();
com.eu.habbo.habbohotel.modtool.HousekeepingAuditLog.log(
this.client.getHabbo().getHabboInfo().getId(),
this.client.getHabbo().getHabboInfo().getUsername(),
actionKey, 0, "roomId=" + roomId + " open=" + open,
this.client.getHabbo().getHabboInfo().getIpLogin());
this.client.sendResponse(new HousekeepingActionResultComposer(actionKey, true, roomId, ""));
}
}
@@ -44,6 +44,13 @@ public class HousekeepingUnbanUserEvent extends MessageHandler {
// on a never-banned user is a benign no-op that returns false.
boolean cleared = Emulator.getGameEnvironment().getModToolManager().unban(info.getUsername());
if (cleared) {
com.eu.habbo.habbohotel.modtool.HousekeepingAuditLog.log(
this.client.getHabbo().getHabboInfo().getId(),
this.client.getHabbo().getHabboInfo().getUsername(),
ACTION_KEY, userId, "username=" + info.getUsername(),
this.client.getHabbo().getHabboInfo().getIpLogin());
}
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, cleared, cleared ? userId : 0, cleared ? "" : "housekeeping.error.no_active_ban"));
}
}
@@ -17,7 +17,14 @@ class HousekeepingAuditCoverageContractTest {
"HousekeepingTradeLockUserEvent.java",
"HousekeepingGrantItemEvent.java",
"HousekeepingTransferRoomOwnershipEvent.java",
"HousekeepingSendHotelAlertEvent.java"
"HousekeepingSendHotelAlertEvent.java",
"HousekeepingDeleteRoomEvent.java",
"HousekeepingForceDisconnectUserEvent.java",
"HousekeepingKickAllFromRoomEvent.java",
"HousekeepingKickUserEvent.java",
"HousekeepingMuteRoomEvent.java",
"HousekeepingRoomStateEvent.java",
"HousekeepingUnbanUserEvent.java"
);
@Test