aimhubio / aim

Aim πŸ’« β€” An easy-to-use & supercharged open-source experiment tracker.
https://aimstack.io
Apache License 2.0
4.93k stars 297 forks source link

Using Aim package on FIPS compatible machine results in Error. #3143

Open dushyantbehl opened 1 month ago

dushyantbehl commented 1 month ago

πŸ› Bug

Running AIM with any script on a FIPS server results in errors like these making it unusable.

TypeError: 'digest_size' is an invalid keyword argument for openssl_blake2b()
TypeError: 'digest_size' is an invalid keyword argument for openssl_blake2b()
Exception ignored in: 'aim.storage.hashing.hashing.hash_object'
Traceback (most recent call last):
  File "/usr/local/lib64/python3.11/site-packages/aim/storage/context.py", line 40, in _calc_hash
    return hash_auto(self._context)
           ^^^^^^^^^^^^^^^^^^^^^^^^

To reproduce

Install AIM on FIPS enabled machine and run with any script the error seems to be 100% reproducible on our end.

Expected behavior

AIM hash function to generate hash without any error.

Environment

Additional context

The problem seems to be stemming from python library hashlib, on a FIPS enabled server the _hashlib.get_fips_mode() returns 1

python3.11 
>>> import _hashlib
>>> _hashlib.get_fips_mode()
1

And API call like this fails.

>>> import hashlib
>>> hashlib.blake2b(digest_size=256 //8)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'digest_size' is an invalid keyword argument for openssl_blake2b()

While on other server it works,

python3.11
>>> import _hashlib
>>> _hashlib.get_fips_mode()
0
>>> import hashlib
>>> hashlib.blake2b(digest_size=256 //8)
<_blake2.blake2b object at 0x7fe3f5d0cc70>
SGevorg commented 2 weeks ago

@dushyantbehl we don't have access to FIPS servers. would you be open to help us fix this?