From e3a8106db5574ec3713a808cdf7a0d2d177ed732 Mon Sep 17 00:00:00 2001 From: rumblefrog Date: Tue, 19 May 2026 17:48:40 -0400 Subject: [PATCH 1/9] fix(comms): surface SteamID validation errors on the comms-add form (#1420) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "Add a block" form silently no-op'd on invalid SteamID input — the reporter typed garbage in the SteamID field, clicked submit, and got no notification anywhere. Two-layer regression: 1. The submit button was wired to a global `ProcessBan()` defined inline in `admin.comms.php`'s tail script. ProcessBan walked the form via MooTools-era `$('id')` selectors (still working at runtime via `sb.js`'s `global.$` shim that wraps `document.getElementById`), validated the SteamID client-side, and emitted feedback through `sb.message.show` / `sb.message.error`. Those helpers paint into `#dialog-placement` / `#dialog-title` / `#dialog-content-text` — v1.x chrome ids the v2.0 theme doesn't render anywhere. Every error path silently no-op'd against missing DOM targets; the operator saw nothing. 2. Server-side, `api_comms_add` called `SteamID::toSteam2($raw)` unconditionally. The SteamID lib's `resolveInputID` throws a generic `\Exception` for unrecognised input shapes; the dispatcher's `Throwable` fallback in `Api::handle` wraps that as a generic `server_error` envelope (HTTP 500), NOT a structured `validation` ApiError with `field=steam`. So even if the chrome HAD painted the toast correctly, the operator would have seen "Internal server error" instead of "Please enter a valid Steam ID". `api_bans_add` had the same server-side gap on its STEAM-type branch — the only reason it surfaced visible feedback at all was that the bans-add form's IIFE was already on the modern `window.SBPP.showToast` path (the comms-add form was never migrated). Closing one half without the other would have left the bans surface still vulnerable to the same 500-cascade if a hostile/curl-driven caller bypassed the form. The fix has four layers, top-to-bottom: * **Form template (sbpp2026 chrome twin)** — `web/themes/default/page_admin_comms_add.tpl` adds: - `required` on the nickname input - `required` + `pattern="STEAM_[01]:[01]:\d+|\[U:1:\d+\]|\d{17}"` + `title` + `aria-describedby` on the steam input, paired with a visible accepted-formats helper line - `required` on the reason `