Skip to content

Commit 0a3237f

Browse files
committed
docs: update IMPROVEMENTS.md for 2026-03-18 security
1 parent e618365 commit 0a3237f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

IMPROVEMENTS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# PingDiff Improvement Log
22

3+
## 2026-03-18 — Security: Harden API routes and add CSP/HSTS headers
4+
5+
`/api/servers` was completely unprotected by rate limiting while `/api/results` already had it — an oversight that left the DB endpoint open to unbounded hammering. The rate-limit and IP-extraction logic was also duplicated inline, meaning the two routes could silently diverge over time. Additionally, `next.config.ts` was missing the two highest-impact HTTP security headers: Content Security Policy and HSTS.
6+
7+
Fixed by extracting a shared `rate-limit.ts` utility (named buckets, consistent IP extraction), applying rate limiting + slug validation to `/api/servers`, adding CDN caching on that endpoint, and adding CSP + HSTS to `next.config.ts`.
8+
9+
**Files changed:** `web/src/lib/rate-limit.ts` (new), `web/src/app/api/results/route.ts`, `web/src/app/api/servers/route.ts`, `web/next.config.ts`
10+
**Lines:** +127 / -35
11+
12+
313
## 2026-03-18 — Code Quality: Extract shared Navbar and Footer components
414

515
The navigation bar and footer were duplicated verbatim across 4 pages (home, dashboard, community,

0 commit comments

Comments
 (0)