mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-18 16:12:11 +00:00
chore(release): v1.4.38
Robustness sweep, perf hotspots, full localization, coach gate cascade closure. - /api/dashboard/summary cold-mount 4.6 s → ~500 ms via DAY-bucket sparkline + 60 s response cache. - Coach API gate inventory test surfaced and closed two orphan routes (chat[id] GET+DELETE, chat-message feedback POST). - Cross-tz fast-path runtime guard falls back to live for users more than ±3 h from UTC; proper bucket minting stays v1.5. - es / fr / it / pl coverage 27 % → 63 % (~3 400 new strings) plus three medication-cluster placeholder restorations. - IANA timezone validation closes the User.timezone self-DoS regression the new dashboard SQL would have surfaced. - Unit suite 4520 → 4524. See CHANGELOG.md for the full set.
This commit is contained in:
1 parent
fe64f66c7f
commit
a550031a84
66 files changed
+7910
-3717
No files matched your search
+12
-1
@@ -1,3 +1,4 @@
|
||||
import { isIP } from "node:net";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export function apiSuccess<T>(data: T, status = 200) {
|
||||
@@ -86,8 +87,18 @@ export async function safeJson<T = unknown>(
|
||||
*
|
||||
* Returns the resolved IP or null when no trusted source is available.
|
||||
*/
|
||||
/**
|
||||
* v1.4.38 — strict IP validation via Node's built-in `net.isIP`. The
|
||||
* earlier regex `/^[0-9a-fA-F.:]+$/` matched any structurally-broken
|
||||
* input the character set accepted (`:::`, `1.2`, `1.2.3`, `gg:hh::`).
|
||||
* The cf-connecting-ip flow trusts the header under the env flag and
|
||||
* the trusted-proxy XFF chain forwards the rightmost entry straight
|
||||
* to the rate-limiter + audit log; a malformed value would land
|
||||
* downstream unchanged. `isIP` returns 4 / 6 for valid v4 / v6 and 0
|
||||
* for anything else — invert to a boolean for the helper's surface.
|
||||
*/
|
||||
function looksLikeIp(s: string): boolean {
|
||||
return /^[0-9a-fA-F.:]+$/.test(s) && s.length >= 3 && s.length <= 45;
|
||||
return isIP(s) !== 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user