From a891802fccf900baab6f2d8f867948e280285165 Mon Sep 17 00:00:00 2001 From: Sweta Yadav Date: Mon, 20 May 2024 16:03:05 +0530 Subject: [PATCH 1/5] NXDRIVE-2930: Fix code scanning issue --- docs/changes/5.5.0.md | 1 + nxdrive/client/remote_client.py | 3 --- nxdrive/utils.py | 6 +++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/changes/5.5.0.md b/docs/changes/5.5.0.md index 829ff5fd9a..257dc7cece 100644 --- a/docs/changes/5.5.0.md +++ b/docs/changes/5.5.0.md @@ -24,6 +24,7 @@ Release date: `2024-xx-xx` - [NXDRIVE-2896](https://jira.nuxeo.com/browse/NXDRIVE-2896): Fix release build for upload/download artifact - [NXDRIVE-2926] (https://jira.nuxeo.com/browse/NXDRIVE-2926): Update github Action Runner to use mac-latest +- [NXDRIVE-2930] (https://jira.nuxeo.com/browse/NXDRIVE-2930): Fix code scanning issue ## Tests diff --git a/nxdrive/client/remote_client.py b/nxdrive/client/remote_client.py index 9764fadb94..b84b393af6 100644 --- a/nxdrive/client/remote_client.py +++ b/nxdrive/client/remote_client.py @@ -125,9 +125,6 @@ def __init__( auth = self.auth self.verification_needed = get_verify() - log.info( - f"SSL verify: {verify}-> will be changed to {self.verification_needed}" - ) self.token = token diff --git a/nxdrive/utils.py b/nxdrive/utils.py index 1b7c5cec92..a9615d3dc4 100644 --- a/nxdrive/utils.py +++ b/nxdrive/utils.py @@ -676,7 +676,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 @@ -707,7 +707,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" @@ -720,7 +720,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" >>> {str(cert_file)!r}") final_file.write_bytes(certificates) else: log.info(f"Will use the final certificate from {str(final_file)!r}") From f4afa2744744dc52f301080092f76e1ec7b65340 Mon Sep 17 00:00:00 2001 From: Sweta Yadav Date: Thu, 23 May 2024 21:00:36 +0530 Subject: [PATCH 2/5] NXDRIVE-2930: Fix code scanning issue --- nxdrive/client/remote_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nxdrive/client/remote_client.py b/nxdrive/client/remote_client.py index b84b393af6..8cca7f0424 100644 --- a/nxdrive/client/remote_client.py +++ b/nxdrive/client/remote_client.py @@ -125,7 +125,9 @@ def __init__( auth = self.auth self.verification_needed = get_verify() - + log.info( + f"SSL verify: {verify}-> will be changed to {self.verification_needed}" + ) self.token = token super().__init__( From 0a6422234758e5e21cc75fc879e6d8938f6019b0 Mon Sep 17 00:00:00 2001 From: Sweta Yadav Date: Thu, 23 May 2024 21:03:17 +0530 Subject: [PATCH 3/5] NXDRIVE-2930: Fix code scanning issue --- nxdrive/client/remote_client.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nxdrive/client/remote_client.py b/nxdrive/client/remote_client.py index 8cca7f0424..9764fadb94 100644 --- a/nxdrive/client/remote_client.py +++ b/nxdrive/client/remote_client.py @@ -128,6 +128,7 @@ def __init__( log.info( f"SSL verify: {verify}-> will be changed to {self.verification_needed}" ) + self.token = token super().__init__( From 17ed96770f6cad3a693cd01fc5d7378060f8fcbf Mon Sep 17 00:00:00 2001 From: swetayadav1 Date: Thu, 4 Jul 2024 13:13:38 +0530 Subject: [PATCH 4/5] Removed space --- docs/changes/5.5.0.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/changes/5.5.0.md b/docs/changes/5.5.0.md index 3c8677e0e1..2a58b21e55 100644 --- a/docs/changes/5.5.0.md +++ b/docs/changes/5.5.0.md @@ -24,7 +24,6 @@ Release date: `2024-xx-xx` - [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 - [NXDRIVE-2933](https://jira.nuxeo.com/browse/NXDRIVE-2933): Fix redos in py library when used with subversion From e14d1128eb414548ac860f049ab8696e669d087a Mon Sep 17 00:00:00 2001 From: swetayadav1 Date: Thu, 4 Jul 2024 13:56:04 +0530 Subject: [PATCH 5/5] Formatted logs --- nxdrive/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nxdrive/utils.py b/nxdrive/utils.py index 5a23bad422..393ab482d8 100644 --- a/nxdrive/utils.py +++ b/nxdrive/utils.py @@ -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.debug(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}")