Skip to content

Potential fix for code scanning alert no. 12: Clear-text storage of sensitive information#910

Closed
inimaz wants to merge 2 commits into
masterfrom
alert-autofix-12
Closed

Potential fix for code scanning alert no. 12: Clear-text storage of sensitive information#910
inimaz wants to merge 2 commits into
masterfrom
alert-autofix-12

Conversation

@inimaz

@inimaz inimaz commented Jul 15, 2025

Copy link
Copy Markdown
Collaborator

Potential fix for https://github.com/mlco2/codecarbon/security/code-scanning/12

To address the issue, sensitive data such as settings.fief_admin_password should be encrypted before being written to files. The cryptography library can be used to encrypt the sensitive data. A symmetric encryption key can be generated and stored securely, and the sensitive data can be encrypted using this key before being written to the .env files. The decryption process should only occur when the data is needed.

Steps to fix:

  1. Import the cryptography library and set up a symmetric encryption mechanism.
  2. Generate a secure encryption key and store it securely (e.g., in a secure key management system or environment variable).
  3. Encrypt sensitive data (e.g., settings.fief_admin_password) before writing it to the .env files.
  4. Update the replace function to handle encrypted values appropriately.

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

inimaz and others added 2 commits July 15, 2025 16:01
…ensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@inimaz inimaz marked this pull request as ready for review July 15, 2025 14:06
@prmths128

Copy link
Copy Markdown
Contributor

Not sure that's the way to go. Seems like a way to complicate the setup without adding real security.
If you use a cloud deployment you should use a secret manager to manage them instead of writing to .env files.
If you use a local setup with .env file you will have sensitive information there, there's no way around that.

@inimaz

inimaz commented Jul 24, 2025

Copy link
Copy Markdown
Collaborator Author

I agree, I think it gets flagged as vulnerability just because later in the code one can print it for instance. But closing this as not needed for now, thanks!

@inimaz inimaz closed this Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants