Skip to content

Potential fix for code scanning alert no. 14: Clear-text logging of sensitive information #5

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

Merged
merged 1 commit into from
Apr 9, 2025

Conversation

venkateshpabbati
Copy link
Owner

Potential fix for https://github.com/venkateshpabbati/LightRAG/security/code-scanning/14

To fix the problem, we need to ensure that all sensitive information is properly sanitized before being logged. This involves using the sanitize_sensitive_info function consistently and correctly to mask sensitive data. Specifically, we need to ensure that the params dictionary and any other potentially sensitive information are sanitized before being included in log messages.

  1. Ensure that the sanitize_sensitive_info function is used to sanitize the params dictionary and any other sensitive data before logging.
  2. Update the logging statements to use the sanitized data.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…ensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@@ -79,7 +79,8 @@
except Exception as e:
sanitized_params = sanitize_sensitive_info(params)
sanitized_params = sanitize_sensitive_info(params)
logger.error(f"Tidb database,\nsql:{sql},\nparams:{sanitized_params},\nerror:{sanitize_sensitive_info({'error': str(e)})}")
sanitized_error = sanitize_sensitive_info({'error': str(e)})
logger.error(f"Tidb database,\nsql:{sql},\nparams:{sanitized_params},\nerror:{sanitized_error}")

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (password)
as clear text.
@venkateshpabbati venkateshpabbati marked this pull request as ready for review April 9, 2025 16:52
@venkateshpabbati venkateshpabbati merged commit cd0d03e into main Apr 9, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant