From 361c1cce2fa49fd0436fbff2ad87c8e4469f4e2c Mon Sep 17 00:00:00 2001 From: mrtolkien Date: Tue, 18 Jul 2023 23:04:40 +0900 Subject: [PATCH] fix: better imports --- fastapi_simple_security/_security_secret.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastapi_simple_security/_security_secret.py b/fastapi_simple_security/_security_secret.py index 7977bd9..94b0a4c 100644 --- a/fastapi_simple_security/_security_secret.py +++ b/fastapi_simple_security/_security_secret.py @@ -1,9 +1,9 @@ """Secret dependency. """ import os +import secrets import uuid import warnings -from secrets import compare_digest from typing import Optional from fastapi import Security @@ -71,7 +71,7 @@ async def secret_based_security(header_param: Optional[str] = Security(secret_he ) # We simply return True if the given secret-key has the right value - if not compare_digest(header_param, secret.value): + if not secrets.compare_digest(header_param, secret.value): raise HTTPException( status_code=HTTP_403_FORBIDDEN, detail="Wrong secret key. If not set through environment variable \