-
Notifications
You must be signed in to change notification settings - Fork 0
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
CI #64
CI #64
Conversation
logger.exception("Error occurred during Twilio call for phone number %s: %s", phone_number, str(e)) | ||
logger.exception( | ||
"Error occurred during Twilio call for phone number %s: %s", | ||
phone_number, |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (private)
This expression logs
sensitive data (private)
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 2 months ago
To fix the problem, we should avoid logging the phone number directly. Instead, we can log a masked version of the phone number or omit it entirely from the log message. This way, we still get useful logging information without exposing sensitive data.
The best way to fix this without changing existing functionality is to mask the phone number before logging it. We can replace the middle digits of the phone number with asterisks or another character to ensure that the sensitive part of the data is not exposed.
We need to modify the logging statement on lines 16-18 to mask the phone number. Additionally, we need to add a helper function to perform the masking.
-
Copy modified lines R9-R11 -
Copy modified line R18 -
Copy modified line R21
@@ -8,2 +8,5 @@ | ||
|
||
def mask_phone_number(phone_number): | ||
return phone_number[:2] + "****" + phone_number[-2:] | ||
|
||
def lookup_telecom_provider(phone_number): | ||
@@ -14,5 +17,6 @@ | ||
except Exception as e: | ||
masked_phone_number = mask_phone_number(phone_number) | ||
logger.exception( | ||
"Error occurred during Twilio call for phone number %s: %s", | ||
phone_number, | ||
masked_phone_number, | ||
str(e), |
No description provided.