Skip to content

Commit adf021f

Browse files
committed
Use pulp_hashlib in receive_artifact()
Replace raw hashlib with pulp_hashlib.new() so that digest creation goes through the allowed-algorithm gate and works on FIPS-enabled systems. closes #2256 Signed-off-by: Kush Gupta <kushalgupta@gmail.com> Made-with: Cursor
1 parent c81d744 commit adf021f

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

CHANGES/2256.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Used ``pulp_hashlib.new()`` instead of raw ``hashlib`` in ``receive_artifact()`` to fix ``UnsupportedDigestmodError`` on FIPS-enabled systems.

pulp_container/app/registry_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
from django.conf import settings
2828

29+
from pulpcore.plugin import pulp_hashlib
2930
from pulpcore.plugin.models import Artifact, ContentArtifact, UploadChunk
3031
from pulpcore.plugin.files import PulpTemporaryUploadedFile
3132
from pulpcore.plugin.tasking import dispatch
@@ -1452,7 +1453,7 @@ def receive_artifact(self, chunk):
14521453
size = 0
14531454
hashers = {}
14541455
for algorithm in Artifact.DIGEST_FIELDS:
1455-
hashers[algorithm] = getattr(hashlib, algorithm)()
1456+
hashers[algorithm] = pulp_hashlib.new(algorithm)
14561457
while True:
14571458
subchunk = chunk.read(2000000)
14581459
if not subchunk:

0 commit comments

Comments
 (0)