mt: restore destructive-action confirmations (F1)
Inline onsubmit="return confirm(...)" never ran under our CSP (no script-src
'unsafe-inline'), and the global submit listener in mt.js fired the fetch
without checking e.defaultPrevented — so delete-thread, remove-post, delete-tag,
and stop-tracking-all submitted instantly with no prompt and no way to cancel.
The two defects masked each other: relaxing the CSP alone would still ship
broken.
Drive the prompt from a data-confirm attribute read in the mt.js submit handler,
and bail early when another handler has already prevented the submit.
Ultra-fuzz Run #2 finding F1.
Co-Authored-By
Claude Opus 4.8 <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-06-18 20:09 UTC
<form method="post" action="/p/{{ community_slug }}/moderation/flags/{{ flag.flag_id }}/remove" class="form-inline" onsubmit="return confirm('Remove this post and resolve all flags on it?')">
109
+
<form method="post" action="/p/{{ community_slug }}/moderation/flags/{{ flag.flag_id }}/remove" class="form-inline" data-confirm="Remove this post and resolve all flags on it?">
<form method="post" action="/p/{{ community_slug }}/{{ category_slug }}/{{ thread_id }}/posts/{{ post.id }}/remove" class="form-inline" onsubmit="return confirm('Remove this post? The content will be hidden but preserved for audit.')">
89
+
<form method="post" action="/p/{{ community_slug }}/{{ category_slug }}/{{ thread_id }}/posts/{{ post.id }}/remove" class="form-inline" data-confirm="Remove this post? The content will be hidden but preserved for audit.">