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
+65
-30
@@ -4,36 +4,71 @@
|
||||
<div class="jumbotron">
|
||||
<div class="container">
|
||||
<h1>Cheat Monitor</h1>
|
||||
<p class="text-muted mb-0">
|
||||
Personal flags submitted by an account they don't belong to. The
|
||||
submission still counts: review the reports and act on the scoreboard.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div id="cheat" class="row">
|
||||
<div class="col-md-12">
|
||||
{% if reports.items %}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">ID</th>
|
||||
<th scope="col">Challenge</th>
|
||||
<th scope="col">Submitted by</th>
|
||||
{% if teams_mode %}<th scope="col">Team</th>{% endif %}
|
||||
<th scope="col">Flag owner</th>
|
||||
{% if teams_mode %}<th scope="col">Owner's team</th>{% endif %}
|
||||
<th scope="col">Flag</th>
|
||||
<th scope="col">Date</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for report in reports.items %}
|
||||
<tr>
|
||||
<th scope="row">{{ report.id }}</th>
|
||||
<td><a href="{{ url_for('admin.challenges_detail', challenge_id=report.challenge.id) }}">{{ report.challenge.name }}</a></td>
|
||||
<td><a href="{{ url_for('admin.users_detail', user_id=report.cheater.id) }}">{{ report.cheater.name }}</a></td>
|
||||
{% if teams_mode %}
|
||||
<td>{% if report.cheater.team %}<a href="{{ url_for('admin.teams_detail', team_id=report.cheater.team.id) }}">{{ report.cheater.team.name }}</a>{% endif %}</td>
|
||||
{% endif %}
|
||||
<td><a href="{{ url_for('admin.users_detail', user_id=report.owner.id) }}">{{ report.owner.name }}</a></td>
|
||||
{% if teams_mode %}
|
||||
<td>{% if report.owner.team %}<a href="{{ url_for('admin.teams_detail', team_id=report.owner.team.id) }}">{{ report.owner.team.name }}</a>{% endif %}</td>
|
||||
{% endif %}
|
||||
<td><code>{{ report.flag.content }}</code></td>
|
||||
<td><span data-time="{{ report.date | isoformat }}"></span></td>
|
||||
<td>
|
||||
<form method="POST" action="{{ url_for(endpoint + '.dismiss_report', report_id=report.id) }}">
|
||||
<input type="hidden" name="nonce" value="{{ Session.nonce }}">
|
||||
<input type="hidden" name="page" value="{{ reports.page }}">
|
||||
<button type="submit" class="btn btn-sm btn-outline-secondary" title="Dismiss this report">Dismiss</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% if reports.pages > 1 %}
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
{% for page in range(1, reports.pages + 1) %}
|
||||
<li class="page-item{{ ' active' if page == reports.page }}">
|
||||
<a class="page-link" href="{{ url_for(endpoint + '.show_cheaters', page=page) }}">{{ page }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<p class="text-center text-muted">No reports.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div id="cheat" class="row">
|
||||
<div class="col-md-12">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<td scope="col" width="10px"><b>ID</b></td>
|
||||
<td scope="col"><b>Challenge</b></td>
|
||||
<td scope="col"><b>Cheat User</b></td>
|
||||
<td scope="col"><b>Helper User</b></td>
|
||||
<td scope="col"><b>Flag</b></td>
|
||||
<td scope="col"><b>Date</b></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for cheater in cheaters %}
|
||||
<tr>
|
||||
<th scope="row" class="text-center">{{ loop.index }}</th>
|
||||
<td><a href="{{ request.script_root }}/admin/challenges/{{ cheater.challenge.id }}">{{ cheater.challenge.name }}</a></td>
|
||||
<td><a href="{{ request.script_root }}/admin/users/{{ cheater.cheater.id }}">{{ cheater.cheater.name }}</a></td>
|
||||
<td><a href="{{ request.script_root }}/admin/users/{{ cheater.helper.id }}">{{ cheater.helper.name }}</a></td>
|
||||
<td>{{ cheater.flag.content }}</td>
|
||||
<td>{{cheater.date}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user