Remove experiment flag on studio migrate. #10071
Conversation
…e command name based on the API review.
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 promotes 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 aims to make the studio:export feature generally available by removing the studioexport experiment flag. However, the command and its underlying migration logic contain critical security vulnerabilities, including a Zip Slip vulnerability and multiple path traversal flaws, which could lead to arbitrary file writes and remote code execution. These issues must be addressed before the command is made public. Additionally, consider renaming the command from studio:export to studio:migrate for better clarity and consistency, aligning with the PR's stated intention.
| client.studio.export = loadCommand("studio-export"); | ||
| } | ||
| client.studio = {}; | ||
| client.studio.export = loadCommand("studio-export"); |
There was a problem hiding this comment.
The studio:export command, which is being promoted, contains a critical Zip Slip vulnerability in its extraction logic. The isChildDir function in src/unzip.ts is flawed, allowing an attacker to write files to arbitrary directories by providing a malicious zip file, potentially leading to arbitrary file write and remote code execution. This critical security flaw must be addressed. Additionally, consider renaming the command to studio:migrate for better clarity and consistency, as its purpose is migration and aligns with the PR's TODO.
| client.studio.export = loadCommand("studio-export"); | |
| client.studio = {}; | |
| client.studio.migrate = loadCommand("studio-migrate"); |
| client.studio.export = loadCommand("studio-export"); | ||
| } | ||
| client.studio = {}; | ||
| client.studio.export = loadCommand("studio-export"); |
There was a problem hiding this comment.
The studio:export command is vulnerable to path traversal during the construction of the extraction directory. In src/commands/studio-export.ts, the extraction path is built using path.parse(rootPath).name. If a malicious zip file is named ...zip, path.parse().name returns .., which causes the extraction path to point to the parent directory of the zip file's location. Combined with the flawed isChildDir check in src/unzip.ts, this allows an attacker to extract files into unintended sensitive locations, including the root directory.
| client.studio.export = loadCommand("studio-export"); | ||
| } | ||
| client.studio = {}; | ||
| client.studio.export = loadCommand("studio-export"); |
There was a problem hiding this comment.
The studio:export command extracts a projectId from an untrusted metadata.json file within the provided zip and uses it in API calls (e.g., apphosting.listBackends) without validation. A malicious project ID containing path traversal characters could be used to manipulate API request paths, potentially leading to unauthorized access to other Google Cloud resources (SSRF/API Path Traversal).
There was a problem hiding this comment.
metadata.json is trusted, so this is overkill. However, we can/should add a quick check that the projectId matches a valid pattern (ie no /s)
| client.studio.export = loadCommand("studio-export"); | ||
| } | ||
| client.studio = {}; | ||
| client.studio.export = loadCommand("studio-export"); |
There was a problem hiding this comment.
metadata.json is trusted, so this is overkill. However, we can/should add a quick check that the projectId matches a valid pattern (ie no /s)
* Remove experiment flag on studio migrate.
Remove experiment flag on studio migrate.