From b1414a76b85faf1e8e85ac85260164018ccce5a1 Mon Sep 17 00:00:00 2001 From: Stephen Niedzielski Date: Wed, 11 Nov 2026 20:30:00 -0700 Subject: [PATCH] Limit Mop to the installation subreddit The Target ID field could be edited before submitting, so a moderator could mop a comment or post in another subreddit they moderate. Make the field read-only and reject targets outside the installation subreddit. --- src/core/nuke.ts | 8 ++++++++ src/routes/menu.ts | 1 + 2 files changed, 9 insertions(+) diff --git a/src/core/nuke.ts b/src/core/nuke.ts index 2d779ea..2f3a5b6 100644 --- a/src/core/nuke.ts +++ b/src/core/nuke.ts @@ -64,6 +64,10 @@ export async function handleNukePost(props: NukePostProps) { return { success: false, message: "Can't get user" }; } + if (post.subredditId !== props.subredditId) { + return { success: false, message: 'You can only mop this subreddit.' }; + } + const modPermissions = await user.getModPermissionsForSubreddit( post.subredditName ); @@ -148,6 +152,10 @@ export async function handleNuke(props: NukeProps) { return { success: false, message: "Can't get user" }; } + if (comment.subredditId !== props.subredditId) { + return { success: false, message: 'You can only mop this subreddit.' }; + } + const modPermissions = await user.getModPermissionsForSubreddit( comment.subredditName ); diff --git a/src/routes/menu.ts b/src/routes/menu.ts index c190567..7526da4 100644 --- a/src/routes/menu.ts +++ b/src/routes/menu.ts @@ -11,6 +11,7 @@ const buildNukeFields = (targetId: string): FormField[] => [ type: 'string', helpText: 'Auto-filled from the selected item.', required: true, + disabled: true, defaultValue: targetId, }, {