-
Notifications
You must be signed in to change notification settings - Fork 2
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
[fix][service-external] #28
base: develop
Are you sure you want to change the base?
Conversation
- Add TRIVY_DEBUG environment variable for optional debug output - Introduce JAVA_DB_REPOSITORY environment variable for Java vulnerability database - Implement f-string formatting for improved readability and performance - Add cache directory support for Trivy scans - Increase number of scanning threads from 2 to 4 - Improve error handling and logging throughout the script - Update Trivy command construction to include new options - Refactor some functions for better clarity and efficiency
@@ -59,12 +63,15 @@ | |||
|
|||
|
|||
def read_secret(namespace, secret): | |||
log.debug("read secret: {}/{}".format(namespace, secret)) | |||
log.debug(f"read secret: {namespace}/{secret}") |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (secret)
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we should avoid logging sensitive information such as secrets. Instead of logging the actual secret, we can log a generic message indicating that a secret is being read without revealing its content. This way, we maintain the logging functionality for debugging purposes without exposing sensitive data.
- Replace the log message on line 76 with a generic message that does not include the actual secret.
- Ensure that the logging level and format remain unchanged.
-
Copy modified line R76
@@ -75,3 +75,3 @@ | ||
def read_secret(namespace, secret): | ||
log.debug(f"read secret: {namespace}/{secret}") | ||
log.debug(f"Reading secret in namespace: {namespace}") | ||
v1 = client.CoreV1Api() |
log.debug("Image: {} password len: {}".format(image, len(item[image]['docker_password']))) | ||
log.debug("Image {} password content: {}".format(image, item[image]['docker_password'])) | ||
log.debug(f"Image: {image} password len: {len(item[image]['docker_password'])}") | ||
log.debug(f"Image {image} password content: {item[image]['docker_password']}") |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (password)
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to ensure that sensitive information such as passwords is not logged in clear text. Instead of logging the actual password content, we can log a placeholder or a masked version of the password. This way, we maintain the ability to debug without exposing sensitive information.
The best way to fix this issue without changing existing functionality is to replace the line that logs the password content with a line that logs a masked version of the password. We can mask the password by replacing all characters with asterisks except for the first and last characters.
-
Copy modified lines R240-R241
@@ -239,3 +239,4 @@ | ||
log.debug(f"Image: {image} password len: {len(item[image]['docker_password'])}") | ||
log.debug(f"Image {image} password content: {item[image]['docker_password']}") | ||
masked_password = item[image]['docker_password'][0]['password'][0] + '*' * (len(item[image]['docker_password'][0]['password']) - 2) + item[image]['docker_password'][0]['password'][-1] | ||
log.debug(f"Image {image} password content: {masked_password}") | ||
|
if image.split('/')[0] in item[image]['docker_password'][0]['registry_url']: | ||
log.info("Auth on registry {}".format(item[image]['docker_password'][0]['registry_url'])) | ||
log.info(f"Auth on registry {item[image]['docker_password'][0]['registry_url']}") |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (password)
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we should avoid logging any part of the docker_password
dictionary, including the registry_url
. Instead, we can log a generic message indicating that authentication is being performed without revealing any specific details. This change will ensure that no sensitive information is exposed in the logs.
- Replace the log statement on line 245 with a generic message.
- Ensure that no sensitive information is logged.
-
Copy modified line R245
@@ -244,3 +244,3 @@ | ||
if image.split('/')[0] in item[image]['docker_password'][0]['registry_url']: | ||
log.info(f"Auth on registry {item[image]['docker_password'][0]['registry_url']}") | ||
log.info("Performing authentication on registry") | ||
system_environment["TRIVY_USERNAME"] = item[image]['docker_password'][0]['username'] |
- Add TRIVY_DEBUG environment variable for optional debug output - Introduce JAVA_DB_REPOSITORY environment variable for Java vulnerability database - Implement f-string formatting for improved readability and performance - Add cache directory support for Trivy scans - Increase number of scanning threads from 2 to 4 - Improve error handling and logging throughout the script - Update Trivy command construction to include new options - Refactor some functions for better clarity and efficiency
… and add timeout option
Update Dockerfile and improve scanner configuration - Upgrade base Python image to 3.13-slim - Update Trivy version to 0.58.0 - Adjust Dockerfile syntax for consistency (e.g., "AS" in uppercase) - Update registry path in Makefile - Add push target to Makefile - Fix TRIVY_SCAN_TIMEOUT usage in scanner.py - Add logging of scanner configuration on startup - Minor syntax and formatting improvements ```
Update Dockerfile and improve scanner configuration - Upgrade base Python image to 3.13-slim - Update Trivy version to 0.58.0 - Adjust Dockerfile syntax for consistency (e.g., "AS" in uppercase) - Update registry path in Makefile - Add push target to Makefile - Fix TRIVY_SCAN_TIMEOUT usage in scanner.py - Add logging of scanner configuration on startup - Minor syntax and formatting improvements ```
No description provided.