Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIPS compliant #1411

Merged
merged 6 commits into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/evidently/pydantic_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import itertools
import json
import os
import sys
import warnings
from abc import ABC
from enum import Enum
Expand Down Expand Up @@ -37,6 +38,8 @@
if TYPE_CHECKING:
from evidently._pydantic_compat import DictStrAny

md5_kwargs = {"usedforsecurity": False} if sys.version_info >= (3, 9) else {}


T = TypeVar("T")

Expand Down Expand Up @@ -311,7 +314,9 @@ class Config:
is_base_type = True

def get_fingerprint(self) -> Fingerprint:
return hashlib.md5((self.__get_classpath__() + str(self.get_fingerprint_parts())).encode("utf8")).hexdigest()
return hashlib.md5(
(self.__get_classpath__() + str(self.get_fingerprint_parts())).encode("utf8"), **md5_kwargs
).hexdigest()

def get_fingerprint_parts(self) -> Tuple[FingerprintPart, ...]:
return tuple(
Expand Down Expand Up @@ -566,4 +571,4 @@ def get_object_hash_deprecated(obj: Union[BaseModel, dict]):

if isinstance(obj, BaseModel):
obj = obj.dict()
return hashlib.md5(json.dumps(obj, cls=NumpyEncoder).encode("utf8")).hexdigest() # nosec: B324
return hashlib.md5(json.dumps(obj, cls=NumpyEncoder).encode("utf8"), **md5_kwargs).hexdigest() # nosec: B324
Loading