fix(security): раунд-2 SMTP-01 — отвергать управляющие символы в email
email с внутренним \r\n/табом/пробелом → header/SMTP-инъекция в письмо подтверждения. Отвергаем (краевые пробелы .strip() и так чистит). Тест на внутренние control-chars. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -182,7 +182,9 @@ def register_user(email: str, password: str, invite_token: str) -> dict:
|
||||
from db import get_user_by_email, create_user, use_invite, set_verify_code
|
||||
|
||||
email = email.lower().strip()
|
||||
if not email or "@" not in email or "/" in email or "\\" in email:
|
||||
# Управляющие символы/пробелы → header/SMTP-инъекция в письмо подтверждения (пентест
|
||||
# SMTP-01); '/'/'\\' → path-компонент в work_dir. Отвергаем.
|
||||
if not email or "@" not in email or any(c in email for c in "/\\\r\n\t "):
|
||||
return {"ok": False, "error": "Некорректный email"}
|
||||
if len(password) < 6:
|
||||
return {"ok": False, "error": "Пароль минимум 6 символов"}
|
||||
|
||||
Reference in New Issue
Block a user