Feat: Implement robust path validation and structured skip reporting#26
Feat: Implement robust path validation and structured skip reporting#26thiyaguk09 wants to merge 6 commits intomainfrom
Conversation
BREAKING CHANGE: downloadManyFiles now returns a DownloadManyFilesResult object instead of an array of DownloadResponse. - Implements strict blocking for absolute paths (Unix and Windows styles). - Prevents path traversal via dot-segments (../) using path.relative validation. - Blocks illegal characters and poisoned paths (e.g., Windows volume colons). - Updates internal logic to resolve paths against a safe base directory (CWD or prefix).
Summary of ChangesHello @thiyaguk09, 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 significantly enhances the security 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. 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
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces robust path validation and structured skip reporting to the downloadManyFiles function in the TransferManager. It enhances security by preventing path traversal vulnerabilities and illegal character usage, while also providing more informative feedback on skipped files. The changes include modifications to the samples/downloadManyFilesWithTransferManager.js, src/file.ts, src/transfer-manager.ts, and test/transfer-manager.ts files. The most significant changes are in src/transfer-manager.ts, where path validation logic is implemented to prevent path traversal attacks.
There was a problem hiding this comment.
Code Review
This pull request introduces robust path validation and a structured reporting mechanism for skipped files in the downloadManyFiles function. The changes include blocking absolute paths, preventing path traversal via dot-segments, and filtering out illegal characters like Windows volume colons. This is a breaking change, as downloadManyFiles now returns a DownloadManyFilesResult object. The new interfaces and updated sample code reflect this change, and comprehensive tests have been added to ensure the security and correctness of the path validation logic.
BREAKING CHANGE: downloadManyFiles now returns a DownloadManyFilesResult object instead of an array of DownloadResponse. - Implements strict blocking for absolute paths (Unix and Windows styles) and dot-segment traversal. - Adds DownloadManyFilesResult interface with SkipReason enums for programmatic handling of skipped files. - Ensures input-to-output parity where every file is accounted for in either 'responses' or 'skippedFiles'. - Robustly handles 'unknown' catch variables by narrowing to Error instances. - Optimizes directory creation logic within the parallel download loop.
|
/gemini review |
9c056b7 to
1536b31
Compare
…aversal Fix/download directory path traversal
BREAKING CHANGE: downloadManyFiles now returns a DownloadManyFilesResult object
instead of an array of DownloadResponse.
Description
Impact
Testing
Additional Information
Checklist
Fixes #issue_number_goes_here 🦕