mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 09:37:50 -05:00
fix(staff): a Discord sign-in asks for the 2FA code, and the bot needs one too
Since7dee290a Discord account linked to a staff member opened the moderator panel for 12 hours on Discord's word alone, with no password and no 2FA code, though the normal sign-in asks for both every time; and sinceb11ae1dthe bot took /moderate and /burrow commands from that Discord account alone. The link outlives a new password and "sign out everywhere", so a taken-over Discord account was enough to act as the staff member. The admin dashboard's Discord sign-in (adminDashboardAccess) skipped its password the same way. - /mod/discord/callback and /admin/discord/callback no longer sign in: they keep a pending sign-in for 5 minutes (a Strict cookie) and the page asks for the linked account's 2FA code (POST .../api/discord/code). Five wrong codes and it must start again at Discord. The admin one also needs the account to have 2FA on and not be locked. - the bot's commands and buttons count only for a staff member with a panel session that took a code (modpanel.discordBot.commandActor): the password sign-in, or Discord and a code; not the game's token sign-in. A new password, signing out everywhere or 2FA turned off end those sessions (forget), and so the bot's use. Whose Discord it is still keeps linked staff out of /discord moderation, and lets them close tickets. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
83c2fc3b0b
commit
3b53c8dab8
5 files changed
+278
-25
No files matched your search
+4
-2
@@ -322,7 +322,9 @@ const commandDefinitions = () => [
|
||||
.addSubcommand(command => command.setName("close").setDescription("Close this support ticket")),
|
||||
].map(command => command.toJSON());
|
||||
|
||||
const actorFor = interaction => modpanel.discordBot.actor(interaction.user.id);
|
||||
// a command or button counts for a staff member signed in to the panel with
|
||||
// their 2FA code (modpanel.discordBot.commandActor): Discord alone is not them.
|
||||
const actorFor = interaction => modpanel.discordBot.commandActor(interaction.user.id);
|
||||
|
||||
const reportButton = report => new ActionRowBuilder().addComponents(
|
||||
new ButtonBuilder().setCustomId(`${REPORT_BUTTON_PREFIX}${report.id}:handled`).setLabel("Mark handled").setStyle(ButtonStyle.Success),
|
||||
@@ -543,7 +545,7 @@ const handleTicket = async interaction => {
|
||||
return;
|
||||
}
|
||||
const owner = ticketOwner(interaction.channel);
|
||||
const staff = actorFor(interaction);
|
||||
const staff = modpanel.discordBot.actor(interaction.user.id);
|
||||
if (!owner || (owner !== interaction.user.id && !staff)) {
|
||||
await interaction.editReply(failure("Only the ticket opener or linked Burrow staff can close this ticket."));
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user