Security: a made-up x-client-ip can no longer get round the sign-in and sign-up limits #76
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/trusted-client-ip"
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?
Part of #44, and needed before #22 (going online).
Problem
x-client-ip, and the API believed that header from anyone (auth.ts).Fix
x-client-iponly from the site.DIVAN_SITE_KEYinx-site-key, compared timing-safe. Set the same key for the API and the site in production.web/src/lib/auth.ts).X-Forwarded-Fora visitor sends with the real address, and Astro'sclientAddressreads the first value of that header.Tested:
npm testpasses. A new test covers:Made in a separate worktree from the latest main, so the desktop session working in
~/divanwas not touched.🤖 Generated with Claude Code