log VK ID identity fields safely
This commit is contained in:
parent
7a957597de
commit
5a819b8642
1 changed files with 8 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ from base64 import urlsafe_b64encode
|
|||
from datetime import datetime, timedelta, timezone
|
||||
import hashlib
|
||||
import json
|
||||
import logging
|
||||
import secrets
|
||||
from typing import Any
|
||||
|
||||
|
|
@ -35,6 +36,7 @@ from app.models import AuthChallenge, AuthSession, PasskeyCredential
|
|||
SESSION_COOKIE = "dzen_session"
|
||||
CHALLENGE_TTL_SECONDS = 300
|
||||
ADMIN_USER_ID = b"dzen-assistant-admin"
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def utc_now() -> datetime:
|
||||
|
|
@ -157,6 +159,12 @@ async def verify_vk_access_token(access_token: str, settings: Settings) -> None:
|
|||
nested_user.get("user_id"),
|
||||
nested_user.get("id"),
|
||||
)
|
||||
logger.info(
|
||||
"VK ID user info fields=%s candidate_ids=%s allowed_user_id=%s",
|
||||
sorted(payload.keys()),
|
||||
[candidate for candidate in candidate_ids if candidate is not None],
|
||||
settings.vk_id_allowed_user_id,
|
||||
)
|
||||
valid_user_id = any(
|
||||
isinstance(candidate, (int, str))
|
||||
and str(candidate).isdigit()
|
||||
|
|
|
|||
Loading…
Reference in a new issue