Skip to content

Conversation

@venkateshpabbati
Copy link
Owner

Potential fix for https://github.com/venkateshpabbati/adk-python/security/code-scanning/2

General approach:
To address the risk of clear-text storage of sensitive information, the code should never write a sensitive credential such as a Google API key directly to disk in plaintext. The best fix is to avoid writing the API key to the .env file at all. Instead, the code should either:

  • Require the user (or their environment) to set the GOOGLE_API_KEY environment variable themselves,
  • Or, if writing the API key is absolutely necessary, encrypt/obfuscate it before storing, and add secure instructions for decryption (which is complex and uncommon in CLI tools).

Specific best fix:
Remove the line writing the GOOGLE_API_KEY value to the .env file in _generate_files(). Instead, inform the user that they need to set the GOOGLE_API_KEY environment variable manually, and add a clear message reminding them not to check secrets into version control. This ensures no sensitive data is inadvertently written to disk.

File/region to change:

  • In src/google/adk/cli/cli_create.py, lines 193–194, do not append the GOOGLE_API_KEY line to the lines list.
  • Optionally, display a click.secho info message to the user indicating that they need to set GOOGLE_API_KEY themselves.
  • No need for additional imports or dependencies.

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

…nsitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@venkateshpabbati venkateshpabbati marked this pull request as ready for review September 4, 2025 19:21
@venkateshpabbati venkateshpabbati merged commit 82d89e4 into main Sep 4, 2025
3 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.

2 participants