Add anti-fraud verification questions and scam warnings

- posts can carry up to 3 verification questions (post_verification_questions,
  changelog 026); to contact the author one answers them first
- POST /api/v1/posts/{id}/claim creates a PENDING chat with the answers as a
  CLAIM message; the claimant cannot write or see the phone until the author
  approves via POST /api/v1/chats/{chatId}/verification
- plain first message to such a post and phone reveal return 403
  VERIFICATION_REQUIRED; GET /api/v1/chats/{chatId} exposes the status
- FraudSignals flags prepayment, card data (Luhn) and SMS-code requests in
  messages (MessageDto.fraudSignal); ChatDto.otherUserCreatedAt for new accounts
- claim limits: 5 per day per account, 2 per post per 30 days, 10/h per IP
- docs/anti-fraud.md, tests

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
SlimusMinus
2026-11-11 01:04:31 +03:00
parent f73f164fae
commit e02f8cdb6b
39 changed files with 1211 additions and 25 deletions

View File

@@ -22,7 +22,9 @@
Задача подписана HMAC, привязана к объявлению, живёт 2 минуты и принимается один раз.
Номер отдаётся только у активных объявлений с согласием. Оба эндпоинта публичные,
регистрация не нужна.
регистрация не нужна. Исключение — объявление с контрольными вопросами: номер получает только
автор и заявитель, чьи ответы автор подтвердил, остальным — 403 `VERIFICATION_REQUIRED`
([anti-fraud.md](anti-fraud.md)).
Время решения (JS, худший случай, десктоп; телефон в 3–5 раз медленнее, в среднем — вдвое быстрее):