Fix all 45 audited bugs from bug-fixes.md

Verified every finding against the code, then fixed correctness (redirects,
advancement reset, duplicate heats, high-jump attempt entry, placement
ranking with tie handling, delete-dependency 500s), security (secrets out of
config, config-driven admin seed, login lockout, role authorization with
school scoping, heat-time IDOR, forwarded headers, last-admin guards),
schema integrity (nullable+filtered ExistingStudentId, unique indexes for
rounds/heats/bar heights via SchemaIntegrityFixes migration), performance
(N+1 removal in high jump/reports/standings/dashboard, SQL-side student
paging), and hygiene (duplicate notifications, auto-dismiss scope, local
bootstrap-icons, orphaned files, test-data.sql tournament creation).

FluentValidation is now registered; AutoMapper bumped to 14.0.0 (advisory
fully patched only in licence-changed 15.1.1 — documented). 11 new tests;
63/63 passing. Credential rotation and deploy-time DB_CONNECTION_STRING are
required manual follow-ups, documented in bug-fixes.md.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-11 08:30:53 -04:00
parent 78c526ee35
commit 810f721e48
93 changed files with 3251 additions and 1606 deletions

View File

@@ -28,8 +28,6 @@
</div>
</div>
<partial name="_Notification" />
<div class="card shadow-sm">
<div class="card-body p-0 table-responsive">
<table class="table table-bordered mb-0">
@@ -37,12 +35,13 @@
<tr>
<th>Student</th>
<th>School</th>
@foreach (var height in Model.OrderBy(h => h.SortOrder))
@foreach (var height in Model.OrderBy(h => h.Height))
{
<th class="text-center" style="min-width:80px">
@height.Height.ToString("0.00")m
<form asp-action="RemoveHeight" method="post" class="d-inline">
<input type="hidden" name="heightId" value="@height.HighJumpHeightId" />
<input type="hidden" name="tournamentEventLevelId" value="@telId" />
<button type="submit" class="btn btn-link btn-sm text-danger p-0" onclick="return confirm('Remove?')">x</button>
</form>
</th>
@@ -57,38 +56,30 @@
<tr>
<td>@reg.StudentName</td>
<td>@reg.SchoolName</td>
@foreach (var height in Model.OrderBy(h => h.SortOrder))
@foreach (var height in Model.OrderBy(h => h.Height))
{
var attempt = height.Attempts.FirstOrDefault(a => a.EventRegistrationId == reg.EventRegistrationId);
<td class="text-center">
@if (attempt != null)
@* One control per attempt slot, pre-selected with the recorded
result, so attempts 2 and 3 stay editable after attempt 1 is
saved (and mistakes can be corrected). *@
@for (int i = 1; i <= 3; i++)
{
@foreach (var a in new[] { attempt.Attempt1, attempt.Attempt2, attempt.Attempt3 })
{
if (a == HighJumpAttemptResult.Clear) { <span class="text-success fw-bold">O</span> }
else if (a == HighJumpAttemptResult.Fail) { <span class="text-danger fw-bold">X</span> }
else if (a == HighJumpAttemptResult.Pass) { <span class="text-muted">-</span> }
}
@if (attempt.IsEliminated) { <br/><span class="badge bg-danger">OUT</span> }
}
else
{
@for (int i = 1; i <= 3; i++)
{
<form asp-action="RecordAttempt" method="post" class="d-inline">
<input type="hidden" name="tournamentEventLevelId" value="@telId" />
<input type="hidden" name="HighJumpHeightId" value="@height.HighJumpHeightId" />
<input type="hidden" name="EventRegistrationId" value="@reg.EventRegistrationId" />
<input type="hidden" name="AttemptNumber" value="@i" />
<select name="Result" onchange="this.form.submit()" class="form-select form-select-sm d-inline" style="width:50px">
<option value="">@i</option>
<option value="Clear">O</option>
<option value="Fail">X</option>
<option value="Pass">-</option>
</select>
</form>
}
var current = i == 1 ? attempt?.Attempt1 : i == 2 ? attempt?.Attempt2 : attempt?.Attempt3;
<form asp-action="RecordAttempt" method="post" class="d-inline">
<input type="hidden" name="tournamentEventLevelId" value="@telId" />
<input type="hidden" name="HighJumpHeightId" value="@height.HighJumpHeightId" />
<input type="hidden" name="EventRegistrationId" value="@reg.EventRegistrationId" />
<input type="hidden" name="AttemptNumber" value="@i" />
<select name="Result" onchange="this.form.submit()" class="form-select form-select-sm d-inline" style="width:52px">
<option value="" selected="@(current == null)">@i</option>
<option value="Clear" selected="@(current == HighJumpAttemptResult.Clear)">O</option>
<option value="Fail" selected="@(current == HighJumpAttemptResult.Fail)">X</option>
<option value="Pass" selected="@(current == HighJumpAttemptResult.Pass)">-</option>
</select>
</form>
}
@if (attempt?.IsEliminated == true) { <br/><span class="badge bg-danger">OUT</span> }
</td>
}
</tr>