Skip to content

Commit bde3830

Browse files
authored
Add comments to supress CodeQL alerts (Azure#13332)
* Add CodeQL compatibility comments for legacy hash usage Added comments referencing CodeQL [SM02167] and [SM04388] to clarify the use of legacy hash algorithms (e.g., md5, sha1, SHA1) and certain cryptographic imports for backward compatibility and non-security purposes.
1 parent 228c00d commit bde3830

17 files changed

Lines changed: 18 additions & 18 deletions

File tree

Solutions/CrowdStrike Falcon Endpoint Protection/Data Connectors/CrowdStrikeFalconAdversaryIntelligence/CrowdStrikeFalconThreatIntelConnector/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def generate_uuid(identifier: str):
166166
uuid.UUID: Generated UUID object based on the identifier hash
167167
"""
168168

169-
hash_value = hashlib.md5(identifier.encode())
169+
hash_value = hashlib.md5(identifier.encode()) # CodeQL [SM02167] This is only being used to generate a UUID, not for security purposes.
170170
return uuid.UUID(hash_value.hexdigest())
171171

172172

Solutions/CyberArkAudit/Data Connectors/.python_packages/lib/site-packages/azure/functions/_thirdparty/werkzeug/http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import warnings
2222
from datetime import datetime
2323
from datetime import timedelta
24-
from hashlib import md5
24+
from hashlib import md5 # CodeQL [SM02167] This is for backwards compatibility.
2525
from time import gmtime
2626
from time import time
2727

Solutions/CyberArkAudit/Data Connectors/.python_packages/lib/site-packages/azure/identity/_credentials/certificate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def extract_cert_chain(pem_bytes: bytes) -> bytes:
9494
def load_pem_certificate(certificate_data: bytes, password: Optional[bytes] = None) -> _Cert:
9595
private_key = serialization.load_pem_private_key(certificate_data, password, backend=default_backend())
9696
cert = x509.load_pem_x509_certificate(certificate_data, default_backend())
97-
fingerprint = cert.fingerprint(hashes.SHA1()) # nosec
97+
fingerprint = cert.fingerprint(hashes.SHA1()) # nosec # CodeQL [SM02167] This is for backward compatibility.
9898
return _Cert(certificate_data, private_key, fingerprint)
9999

100100

Solutions/CyberArkAudit/Data Connectors/.python_packages/lib/site-packages/azure/identity/_internal/aadclient_certificate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, pem_bytes: bytes, password: Optional[bytes] = None) -> None:
2525
self._private_key = private_key
2626

2727
cert = x509.load_pem_x509_certificate(pem_bytes, default_backend())
28-
fingerprint = cert.fingerprint(hashes.SHA1()) # nosec
28+
fingerprint = cert.fingerprint(hashes.SHA1()) # nosec # CodeQL [SM02167] This is for backward compatibility.
2929
self._thumbprint = base64.urlsafe_b64encode(fingerprint).decode("utf-8")
3030

3131
@property

Solutions/CyberArkAudit/Data Connectors/.python_packages/lib/site-packages/azure/storage/blob/_encryption.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from cryptography.hazmat.backends import default_backend
2121
from cryptography.hazmat.primitives.ciphers import Cipher
22-
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
22+
from cryptography.hazmat.primitives.ciphers.aead import AESGCM # CodeQL [SM04388] This is for backward code compatibility.
2323
from cryptography.hazmat.primitives.ciphers.algorithms import AES
2424
from cryptography.hazmat.primitives.ciphers.modes import CBC
2525
from cryptography.hazmat.primitives.padding import PKCS7

Solutions/CyberArkAudit/Data Connectors/.python_packages/lib/site-packages/azure/storage/blob/_shared/policies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def get_content_md5(data):
352352
# Since HTTP does not differentiate between no content and empty content,
353353
# we have to perform a None check.
354354
data = data or b""
355-
md5 = hashlib.md5() # nosec
355+
md5 = hashlib.md5() # nosec # CodeQL [SM02167] This is for backwards compatibility.
356356
if isinstance(data, bytes):
357357
md5.update(data)
358358
elif hasattr(data, 'read'):

Solutions/CyberArkAudit/Data Connectors/.python_packages/lib/site-packages/cryptography/hazmat/_oid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class SignatureAlgorithmOID:
142142
SignatureAlgorithmOID.ECDSA_WITH_SHA3_224: hashes.SHA3_224(),
143143
SignatureAlgorithmOID.ECDSA_WITH_SHA3_256: hashes.SHA3_256(),
144144
SignatureAlgorithmOID.ECDSA_WITH_SHA3_384: hashes.SHA3_384(),
145-
SignatureAlgorithmOID.ECDSA_WITH_SHA3_512: hashes.SHA3_512(),
145+
SignatureAlgorithmOID.ECDSA_WITH_SHA3_512: hashes.SHA3_512(), # CodeQL [SM02167] This is for compatibility.
146146
SignatureAlgorithmOID.DSA_WITH_SHA1: hashes.SHA1(),
147147
SignatureAlgorithmOID.DSA_WITH_SHA224: hashes.SHA224(),
148148
SignatureAlgorithmOID.DSA_WITH_SHA256: hashes.SHA256(),

Solutions/CyberArkAudit/Data Connectors/.python_packages/lib/site-packages/cryptography/hazmat/backends/openssl/backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Backend:
103103
hashes.SHA512,
104104
hashes.SHA512_224,
105105
hashes.SHA512_256,
106-
hashes.SHA3_224,
106+
hashes.SHA3_224, # CodeQL [SM02167] This is for backwards compatibility.
107107
hashes.SHA3_256,
108108
hashes.SHA3_384,
109109
hashes.SHA3_512,

Solutions/CyberArkAudit/Data Connectors/.python_packages/lib/site-packages/cryptography/hazmat/primitives/serialization/pkcs7.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
serialize_certificates = rust_pkcs7.serialize_certificates
2525

2626
PKCS7HashTypes = typing.Union[
27-
hashes.SHA224,
27+
hashes.SHA224, # CodeQL [SM02167] This is for compatibility.
2828
hashes.SHA256,
2929
hashes.SHA384,
3030
hashes.SHA512,

Solutions/CyberArkAudit/Data Connectors/.python_packages/lib/site-packages/cryptography/hazmat/primitives/serialization/ssh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ def verify_cert_signature(self) -> None:
914914
else:
915915
assert isinstance(signature_key, rsa.RSAPublicKey)
916916
if self._inner_sig_type == _SSH_RSA:
917-
hash_alg = hashes.SHA1()
917+
hash_alg = hashes.SHA1() # CodeQL [SM02167] This is for backward compatibility.
918918
elif self._inner_sig_type == _SSH_RSA_SHA256:
919919
hash_alg = hashes.SHA256()
920920
else:

0 commit comments

Comments
 (0)