fix: verified correctness and safety fixes - #675
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
Too many files changed for review (535 files, 100 file limit). |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest updates on your projects. Learn more about Unkey Deploy
|
Depends on #672 and #673 (stacked on codex/test-quality).
Every item here was reproduced as a failing test or live repro first, then fixed, then re-verified. Items that could not be reproduced as real bugs were deliberately skipped (see below).
Fixed
1. IPv6 visitors silently lost geo enrichment (
apps/basket/src/utils/ip-geo.ts)The hand-rolled
ipv6Regexonly matched the fully-expanded 8-group form, so real addresses (2a00:1450:4009:81f::200e,2001:db8::1,::ffff:8.8.8.8) failed validation andgetGeoshort-circuited toreason: "invalid_or_local_ip". Silent data loss, no error. Replaced both regexes withnode:net.isIP(stdlib, zero cost). Repro'd before, test added, green after.2. Audit CSV exports mangled in Excel (
packages/services/src/audit.ts)No UTF-8 BOM (non-ASCII actor names mis-decoded) and
\ninstead of RFC 4180\r\n. Now emits BOM + CRLF; regression pinned.3. Two
sanitizeStringimplementations had silently diverged (packages/validationvsapps/basket)Same name, same signature, different output: basket loop-strips nested tags (
<scr<script>ipt>->iptalert(1)), validation single-passed (scrscriptiptalert(1)/script). Ported the loop into validation so both are identical; two stale tests that pinned the weaker behavior updated.4. IP allowlist helper failed open (
apps/basket/src/utils/origin-ip-validation.ts)isValidIpFromSettings("", ["203.0.113.5"])returnedtrue. Not exploitable through the current caller (which guards withtrustedIp &&), but the helper is re-exported fromhooks/auth.tsas a public surface. Now denies empty/whitespace IPs when an allowlist is configured, while still allowing everything when no allowlist is set.Deliberately not done (bug could not be reproduced)
__proto__/constructor/prototype/case variants and the JSONpropertiespath, all clean. Even 20,000-deep nesting neither crashes nor stalls. No reproducible bug means no swap.Validation
check-types 35/35, lint clean, full turbo test suite green, basket 567/567 with live services.