Skip to content

Commit 9f17823

Browse files
committed
Flag security issues to be fine
1 parent a2fcaf0 commit 9f17823

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

mergin/merginproject.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ def compare_file_sets(self, origin, current):
330330
331331
:Example:
332332
333-
>>> origin = [{'checksum': '08b0e8caddafe74bf5c11a45f65cedf974210fed', 'path': 'base.gpkg', 'size': 2793, 'mtime': '2019-08-26T11:08:34.051221+02:00'}]
334-
>>> current = [{'checksum': 'c9a4fd2afd513a97aba19d450396a4c9df8b2ba4', 'path': 'test.qgs', 'size': 31980, 'mtime': '2019-08-26T11:09:30.051221+02:00'}]
333+
>>> origin = [{'checksum': '08b0e8caddafe74bf5c11a45f65cedf974210fed', 'path': 'base.gpkg', 'size': 2793, 'mtime': '2019-08-26T11:08:34.051221+02:00'}] # pragma: allowlist secret
334+
>>> current = [{'checksum': 'c9a4fd2afd513a97aba19d450396a4c9df8b2ba4', 'path': 'test.qgs', 'size': 31980, 'mtime': '2019-08-26T11:09:30.051221+02:00'}] # pragma: allowlist secret
335335
>>> self.compare_file_sets(origin, current)
336336
{"added": [{'checksum': 'c9a4fd2afd513a97aba19d450396a4c9df8b2ba4', 'path': 'test.qgs', 'size': 31980, 'mtime': '2019-08-26T11:09:30.051221+02:00'}], "removed": [[{'checksum': '08b0e8caddafe74bf5c11a45f65cedf974210fed', 'path': 'base.gpkg', 'size': 2793, 'mtime': '2019-08-26T11:08:34.051221+02:00'}]], "renamed": [], "updated": []}
337337

mergin/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import tempfile
1010
from enum import Enum
1111
from typing import Optional, Type, Union, ByteString
12-
from .common import ClientError, WorkspaceRole
12+
from .common import ClientError
1313

1414

1515
def generate_checksum(file, chunk_size=4096):
@@ -20,7 +20,7 @@ def generate_checksum(file, chunk_size=4096):
2020
:param chunk_size: size of chunk
2121
:return: sha1 checksum
2222
"""
23-
checksum = hashlib.sha1()
23+
checksum = hashlib.sha1(usedforsecurity=False)
2424
with open(file, "rb") as f:
2525
while True:
2626
chunk = f.read(chunk_size)
@@ -306,7 +306,7 @@ def get_data_checksum(data: ByteString) -> str:
306306
:param data: data to calculate checksum
307307
:return: sha1 checksum
308308
"""
309-
checksum = hashlib.sha1()
309+
checksum = hashlib.sha1(usedforsecurity=False)
310310
checksum.update(data)
311311
return checksum.hexdigest()
312312

0 commit comments

Comments
 (0)