Skip to content

[4a-followup] Collect phone number at registration to activate phone_hash anti-abuse controls #318

Description

@grantfox-oss

Context

abuse.service.ts already reads users.phone_hash to block related-account abuse (assertNotRelatedAccounts — two accounts sharing the same phone_hash can't trade with each other). POST /users/register (routes/users.ts) already accepts an optional phone_hash and stores it if provided.

The problem: no frontend flow ever sends one. registerUser() (services/api.ts:126) only posts { username, stellar_address, challenge, signature } — no phone number, no hash. Register.tsx never asks for a phone number at all. So this anti-abuse control has been dormant since it was built (#82) — every user registers with phone_hash = NULL, and #314's "[4a] Tiered KYC Gate Engine" repeated the same "populate phone_hash" acceptance criterion assuming it was a free, already-wired activation. It isn't: the backend plumbing exists, but there's no data source feeding it yet.

What this issue proposes

Add a phone number step to registration and hash it client-side before sending, so phone_hash actually gets populated going forward.

  • Add a phone number input to Register.tsx (or wherever the onboarding flow collects username today) — basic format validation, no OTP/SMS verification required for this issue (that's a separate, bigger scope)
  • Hash the phone number client-side (same approach the codebase already documents for phone_hash: a stable one-way hash, not the raw number) before calling registerUser()
  • Extend registerUser() in services/api.ts to accept and send the computed phone_hash in the existing POST /users/register body field (no backend change needed — it already accepts this)
  • Decide and document: is the phone number field required or optional at registration? (Recommendation: optional for now, since making it mandatory is a product/legal decision beyond this issue's scope — but even optional collection is strictly better than the current zero.)

Acceptance criteria

  • Register.tsx collects a phone number during registration
  • The phone number is hashed client-side before any network call — the raw number is never sent to the backend
  • registerUser() passes the computed phone_hash through to POST /users/register
  • Existing assertNotRelatedAccounts abuse check (abuse.service.ts) starts seeing non-null phone_hash values for new registrations — verify with a manual test: two new accounts using the same phone number are blocked from trading with each other
  • No raw phone number is logged or stored anywhere server-side
  • tsc --noEmit passes on the frontend

Out of scope

  • SMS/OTP verification of the phone number (this issue just collects + hashes it; verifying ownership is a separate, larger feature)
  • Backfilling phone_hash for existing registered users (out of scope — this issue is forward-looking only)
  • Making the phone field mandatory (product/legal decision, not this issue's call)

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26complexity: lowReproducible con curl/DevTools, sin setup especialenhancementNew feature or requestgood first issueGood for newcomersgrantfox:frontendGrantFox campaign - micopay/frontend surface

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions