Add Bot Activity admin panel: banned-IP view + recent events + emergency unban #23
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature/bot-activity-admin"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds a new admin-only Bot Activity tab exposing the
botScoremiddleware's scoring/ban state. Previously that state lived only in the in-memorystoreMap with no API or persistence � the only visibility was tailing container logs.Changes
Server
botScore.js: bounded (300-entry) most-recent-first ring buffer recordingscan/login-fail/honeypotevents plus a distinctbanevent when a hit crosses the threshold. AddsrecentEvents(),listState()(per-IP score/banned/bannedUntil/lastSeen), andunban(ip).botActivity.controller.js+ routesGET /admin/bot-activityandPOST /admin/bot-activity/unban, both behind the existingrequireRole('admin')RBAC gate; IP validated withisIP(). Unban is activity-logged with the admin username (action: botscore.unban).Client
api.admin.botActivity()/unbanIp().BotActivityAdmin.jsxview: a currently-banned table (IP / score / banned until / Unban) and a recent-events feed (when / IP / reason / path / points / score), following the existinguseAsync+adm-table/panel-flatpatterns.AdminLayout+ route inApp.jsx.Tests & docs
botScore.test.jscases (buffer ordering + ban event, buffer cap,listState,unbanclears/lifts a ban, guard lets an unbanned IP through). All 45 server tests pass; client build is clean.Scope
Read + emergency-unban only � no ban-add or scoring-weight editing from the UI. Buffer is in-memory (matches the store); not persisted to the DB. Admin-only via existing RBAC.
Verification
npm test(server): 45/45 pass.npm run build(client): clean; dev preview mounts with no console errors,/admin/bot-activitycorrectly redirects to the login gate.?? Generated with Claude Code