Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NXDRIVE-2930: Fix code scanning issue #4913

Merged
merged 7 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changes/5.5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Release date: `2024-xx-xx`
## Packaging / Build

- [NXDRIVE-2928](https://jira.nuxeo.com/browse/NXDRIVE-2928): Fix security issue IDNA vulnerable to denial of service from specially crafted inputs to idna.encode
- [NXDRIVE-2930] (https://jira.nuxeo.com/browse/NXDRIVE-2930): Fix code scanning issue
- [NXDRIVE-2936] (https://jira.nuxeo.com/browse/NXDRIVE-2936): Fix security issue Requests Session object does not verify requests after making first request with verify=False

## Tests
Expand Down
6 changes: 3 additions & 3 deletions nxdrive/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ def get_certificate_details(

def concat_all_certificates(files: List[Path]) -> Optional[Path]:
"""Craft a all-in-one certificate with ones from cacert and custom ones."""
from hashlib import md5
from hashlib import sha256

import certifi

Expand Down Expand Up @@ -713,7 +713,7 @@ def concat_all_certificates(files: List[Path]) -> Optional[Path]:
log.warning("No valid certificate found.")
return None

name = md5(certificates).hexdigest()
name = sha256(certificates).hexdigest()
folder = Options.nxdrive_home
final_file: Path = folder / f"ndrive_{name}.pem"

Expand All @@ -726,7 +726,7 @@ def concat_all_certificates(files: List[Path]) -> Optional[Path]:

log.info(f"Saved the final certificate to {str(final_file)!r}, including:")
for cert_file in cert_files:
log.info(f" >>> {str(cert_file)!r}")
log.debug(f"Certificate file path: {str(cert_file)!r}")
final_file.write_bytes(certificates)
else:
log.info(f"Will use the final certificate from {str(final_file)!r}")
Expand Down