fix: Reliable cheat reports and a usable admin side
Reports - Sharing within a team is no longer reported: owner and submitter are compared by account (the team in teams mode), not by user. - Admins (e.g. testing in preview mode) are never reported. - A personal flag without a valid owner no longer crashes the submission (int() of its data raised a 500); empty flags never match. - One report per cheater, challenge and flag (unique constraint plus a check before inserting): "all" logic re-checks every earlier submission on each attempt, which created duplicates. Migration 5b1e0c7d9a24 drops existing duplicates and adds the constraint. - Every new report is logged. Matching uses hmac.compare_digest. Flags and helpers - The admin flag forms sent the owner as "user id", which CTFd's flag API ignores: personal flags created by admins had no owner. They now send "data", with labels bound to their inputs. - create_flag_if_missing only considers personal flags, deterministically. Plugin - Migrations run under the plugin's real directory (was "cheaters"); asset paths follow the directory instead of hardcoding it. - Model renamed CheatReport (owner instead of helper); table and column names unchanged. Dates stored in UTC. - Admin page: newest first, paginated, related rows loaded with the page, real report ids, url_for links, team columns in teams mode, local-time dates, and a Dismiss action. - README (install as ctfd_cheaters, "any" logic, API for other plugins); pyrightconfig without an absolute path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
47b9a8a7f1
commit
8084b3996a
9 files changed
+368
-132
No files matched your search
+9
-9
@@ -1,14 +1,14 @@
|
||||
<label>
|
||||
Personal<br>
|
||||
<small>Enter personal flag data</small>
|
||||
</label>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="content" value="{{ content }}">
|
||||
<label for="personal-flag-content">
|
||||
Personal<br>
|
||||
<small>The flag content</small>
|
||||
</label>
|
||||
<input type="text" class="form-control" id="personal-flag-content" name="content" value="{{ content }}">
|
||||
</div>
|
||||
<label>
|
||||
<small>User id for whom the flag is for</small>
|
||||
</label>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="user id" value="{{ data }}">
|
||||
<label for="personal-flag-owner">
|
||||
<small>Id of the user this flag belongs to</small>
|
||||
</label>
|
||||
<input type="number" min="1" class="form-control" id="personal-flag-owner" name="data" value="{{ data }}" required>
|
||||
</div>
|
||||
<input type="hidden" name="type" value="personal">
|
||||
+9
-9
@@ -1,15 +1,15 @@
|
||||
<label>
|
||||
Personal<br>
|
||||
<small>Enter personal flag data</small>
|
||||
</label>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="content" value="{{ content }}">
|
||||
<label for="personal-flag-content">
|
||||
Personal<br>
|
||||
<small>The flag content</small>
|
||||
</label>
|
||||
<input type="text" class="form-control" id="personal-flag-content" name="content" value="{{ content }}">
|
||||
</div>
|
||||
<label>
|
||||
<small>User id for whom the flag is for</small>
|
||||
</label>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="user id" value="{{ data }}">
|
||||
<label for="personal-flag-owner">
|
||||
<small>Id of the user this flag belongs to</small>
|
||||
</label>
|
||||
<input type="number" min="1" class="form-control" id="personal-flag-owner" name="data" value="{{ data }}" required>
|
||||
</div>
|
||||
<input type="hidden" name="type" value="personal">
|
||||
<input type="hidden" name="id" value="{{ id }}">
|
||||
|
||||
Reference in new issue
Block a user