Conversation
Summary of ChangesHello @YueerMoe, 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! 此拉取请求将 Highlights
Changelog
Ignored Files
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 merges the dev branch into preview, primarily aiming to decouple the metadata version from the application version, allowing for user-configurable versions. However, a critical Path Traversal vulnerability has been identified in the metadata update logic. The update_metadata command in src-tauri/src/app_cmd.rs is part of a flow that allows arbitrary file writes via a malicious metadata manifest, as file paths provided in a remote manifest are trusted without sanitization, potentially leading to overwriting sensitive files. Furthermore, the update_metadata command currently hardcodes the metadata version to latest, overriding any user-configured version set in the frontend. It is highly recommended to implement strict path validation in src-tauri/src/services/metadata.rs and to modify the update_metadata command to correctly utilize the user-provided version.
| &client, | ||
| base_url, | ||
| Some(app_version), | ||
| None, |
There was a problem hiding this comment.
This section of the update_metadata command is part of a flow that is vulnerable to a critical Path Traversal vulnerability. The base_url (which can be configured by the user) is passed to metadata::update_metadata, which fetches a manifest.json. The path field from this manifest is used to construct local file paths using metadata_dir.join(path) without proper sanitization. This allows an attacker to provide paths containing .. or absolute paths, leading to arbitrary file writes and potential Remote Code Execution (RCE).
Additionally, the current implementation hardcodes the metadata version to None (which resolves to latest), overriding any user-configured version set in the frontend. This means if a user sets a specific metadata version in the frontend, it will be ignored.
To remediate the Path Traversal, strict path validation must be implemented in src-tauri/src/services/metadata.rs to ensure the resulting path remains within the intended directory. For the versioning issue, the update_metadata command should be modified to accept a version parameter from the frontend and pass it to the services::metadata::update_metadata function. This will also require corresponding frontend changes in src/api/tauriCommands.ts and src/stores/app.ts.
将 dev 分支的变更合并到 preview(pre 环境)。