BBFbyOpus
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import hmac
|
||||
import logging
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
@@ -49,8 +50,8 @@ async def verify_token(header_value: str = Depends(api_key_header)) -> AuthConte
|
||||
status_code=HTTP_403_FORBIDDEN, detail="API-ключ не передан"
|
||||
)
|
||||
|
||||
# Мастер-ключ
|
||||
if header_value == MASTER_KEY:
|
||||
# Мастер-ключ (timing-safe сравнение)
|
||||
if hmac.compare_digest(header_value, MASTER_KEY):
|
||||
return AuthContext(is_master=True, is_admin=True, key_name="master")
|
||||
|
||||
# Ищем в БД
|
||||
|
||||
Reference in New Issue
Block a user