fix(staff): check every moderator panel action, end panel sessions with the rest

From the 18 October security audit (S-9, S-10).

- the moderator panel only refused a role the actions in its permission
  map. hardware bans and lifting them were missing from it, and answering
  ban appeals (which lifts the ban, the address's too), name requests,
  paintings and reports were checked for player.view alone, so a Helper
  could do all of them. each now needs its own permission (address.ban,
  player.ban, player.names, items.approve, player.warn), with the rank
  check the other actions have, and an action missing from the map is
  refused. the page hides what the role cannot do.
- a new password, "Sign out everywhere", locking the account, turning 2FA
  off or deleting the account now also ends its moderator panel sessions,
  as the admin panel's reset already did, so a stolen panel session does
  not outlive them.
- test/staff.js covers both, and fails without either fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
SnipzilandClaude Opus 5.5 committed 2026-10-18 13:17:58 -04:00
1 parent a359371a48
commit 1e365b95c5
6 files changed
+181 -33

No files matched your search

+8 -1
View File
@@ -308,6 +308,13 @@ const unban = id => {
return ban;
};
// one ban as kept, with the account it was made with (accountId), or null:
// for the moderator panel to see whose it is before lifting it.
const banById = id => {
const row = db().prepare("SELECT * FROM device_bans WHERE id = ?").get(Number(id));
return row ? banRow(row) : null;
};
// the bans, newest first: their ids, and the accounts that used them.
const MAX_LISTED_ACCOUNTS = 20;
const list = () => db().prepare("SELECT * FROM device_bans ORDER BY id DESC").all().map(banRow)
@@ -418,4 +425,4 @@ const noteLauncher = (token, hasIds) => {
};
const launcherOutdated = token => outdatedTokens.has(tokenKey(token));
module.exports = {noteLauncher, launcherOutdated, load, read, banOf, banOfAccount, seen, alts, knownFor, banAccount, accountsUnder, unban, list, idsFor, bansOfAccount, search, bannedId, alerts, alertsOf, forget, clientHash};
module.exports = {noteLauncher, launcherOutdated, load, read, banOf, banOfAccount, seen, alts, knownFor, banAccount, accountsUnder, unban, banById, list, idsFor, bansOfAccount, search, bannedId, alerts, alertsOf, forget, clientHash};