fix(tradein/lead): phone digit-guard, убрать dead landing-литерал, 152-ФЗ audit (R2) #2497
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#2497
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/tradein-lead-hardening"
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?
R2 MEDIUM ×2 + LOW — lead endpoint hardening
[MED] Phone-валидация принимала мусор без цифр —
_PHONE_PATTERNделал цифры опциональными («(()) -- ..» матчил). Fix:field_validator("phone")требует 10-15 реальных цифр (len(re.sub(r"\D","",phone))) поверх формат-маски → junk → 422.[MED]
source="landing"funnel недостижим — endpoint auth-gated (401 без X-Authenticated-User), публичного landing-route нет. Fix: убран мёртвый литералLiteral["result","landing"]→["result"](честный контракт; RBAC не трогаю).[LOW] 152-ФЗ — consent хранился голым boolean. Fix: client_ip (X-Forwarded-For) +
_CONSENT_POLICY_VERSIONв audit-log + TODO (в таблицеtrade_in_leadsнет колонок под IP/policy/snapshot — миграция вне scope, задокументирована).Тесты: 9 lead passed (digit-free 422, too-few-digits 422, landing 422); ruff clean.
- [MED] phone: маска r"^[+]?[\d\s().-]{5,32}$" делала цифры опциональными ("(()) -- .." проходило) — добавлен field_validator, требующий 10-15 реальных цифр (re.sub(r"\D","")), формат-толерантность сохранена. - [MED] source: убран мёртвый литерал "landing" из Literal — воронка недостижима (rbac_guard закрывает /lead 401 без X-Authenticated-User, публичного лендинг-роута нет), контракт больше не обещает невозможное. - [LOW] 152-ФЗ: захват client_ip (X-Forwarded-For -> peer) и _CONSENT_POLICY_VERSION в audit-лог; live-схема trade_in_leads не имеет колонок под IP/policy/consent-snapshot -> TODO на follow-up миграцию (out of scope), durable proof-of-consent gap задокументирован. Тесты: +digit-free/too-few-digits phone 422, +source=landing 422, estimate-тест переведён на source=result. 9/9 pass, ruff clean.