Potential fix for code scanning alert no. 1: Clear-text storage of sensitive information#7
Draft
venkateshpabbati wants to merge 1 commit intomainfrom
Draft
Potential fix for code scanning alert no. 1: Clear-text storage of sensitive information#7venkateshpabbati wants to merge 1 commit intomainfrom
venkateshpabbati wants to merge 1 commit intomainfrom
Conversation
…nsitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/venkateshpabbati/adk-python/security/code-scanning/1
In general, the safest fix is to avoid storing secrets (API keys, passwords) in clear text on disk. Instead, store a non-sensitive reference (like the name of an environment variable or a configuration hint) and require the user to set the secret in their own environment or secret manager. If storing something is unavoidable, it should be encrypted with a key not checked into source, but for a simple CLI scaffolding tool, the better design is to omit the secret entirely.
For this code, the minimal, non–behavior-breaking approach is:
google_api_keyinto the.envfile.GOOGLE_API_KEYthemselves, or write nothing at all for the key.GOOGLE_GENAI_USE_VERTEXAI,GOOGLE_CLOUD_PROJECT,GOOGLE_CLOUD_LOCATION) as before.Concretely, in
_generate_filesinsrc/google/adk/cli/cli_create.py:lines.append(f"GOOGLE_API_KEY={google_api_key}")with a safe alternative such as a comment placeholder (e.g.,# Set GOOGLE_API_KEY in your environment) and do not persist the actual key value..envfile structure continue to work, but without clear-text storage of the secret.No new methods or complex logic are required; only the block where
linesis populated needs to be modified.Suggested fixes powered by Copilot Autofix. Review carefully before merging.