Skip to content

Commit 0ce0c24

Browse files
committed
added checksum validation
1 parent a504b9d commit 0ce0c24

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

databusclient/deploy.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from nextcloudclient.upload import upload_to_nextcloud
1010

11-
1211
def deploy_to_databus(
1312
metadata,
1413
version_id,
@@ -25,6 +24,9 @@ def deploy_to_databus(
2524
distributions = []
2625
counter = 0
2726
for filename, checksum, size, url in metadata:
27+
# Expect a SHA-256 hex digest (64 chars). Reject others.
28+
if not isinstance(checksum, str) or len(checksum) != 64:
29+
raise ValueError(f"Invalid checksum for {filename}: expected SHA-256 hex (64 chars), got '{checksum}'")
2830
parts = filename.split(".")
2931
if len(parts) == 1:
3032
file_format = "none"

0 commit comments

Comments
 (0)