Secret upload apphosting#10017
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the migration workflow by automating the secure transfer of the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds functionality to upload a "GEMINI_API_KEY" from a ".env" file as a secret for App Hosting during a migration process. However, a security audit identified two significant vulnerabilities. First, a high-severity information leak in the uploadSecrets function causes the entire ".env" file to be uploaded to Google Secret Manager instead of just the intended API key. Second, a medium-severity path traversal vulnerability was found in the downloadGitHubDir function, which could allow arbitrary file writes if the source GitHub repository is compromised. The uploadSecrets implementation also presents an opportunity to improve code structure by reducing nesting, adhering to the repository's style guide. Both security vulnerabilities and the structural issue should be addressed.
| await apphostingSecretsSetAction( | ||
| "GEMINI_API_KEY", | ||
| projectId, | ||
| undefined, | ||
| undefined, | ||
| envPath, | ||
| true, | ||
| ); |
There was a problem hiding this comment.
The uploadSecrets function incorrectly passes the path to the entire .env file (envPath) as the dataFile argument to apphostingSecretsSetAction. This results in the entire content of the .env file, which may contain multiple environment variables and other sensitive information, being stored as the value for the GEMINI_API_KEY secret. This is a high-severity information leak, as the secret value should only be the API key. Furthermore, the current implementation checks for file existence and then reads it in a nested block, which increases nesting and can be simplified to adhere to the repository's style guide.
References
- The repository's style guide recommends reducing nesting for improved code clarity and maintainability. (link)
falahat
left a comment
There was a problem hiding this comment.
LGTM, but feedback is the name uploadSecrets might be too general since it really just handles a specific secret (Gemini API keys) but overall approved
Secret upload apphosting (#10017)
Apphosting secret upload, this is a follow-on from #10010