Conversation
Summary of ChangesHello @xushiwei, 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 introduces a comprehensive 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
Ignored Files
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
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2610 +/- ##
==========================================
- Coverage 94.04% 94.02% -0.02%
==========================================
Files 33 32 -1
Lines 9905 9891 -14
==========================================
- Hits 9315 9300 -15
- Misses 421 422 +1
Partials 169 169 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code Review SummaryThis PR introduces the DQL (DOM Query Language) library - a comprehensive set of packages for querying HTML, XML, JSON, YAML documents and Go AST/reflect structures. The architecture is well-designed with consistent iterator-based APIs. Key concerns requiring attention:
The overall code structure is clean and follows Go idioms well. The iterator pattern using |
There was a problem hiding this comment.
Code Review
This pull request introduces the new dql library, providing modules for querying various data formats and handling streams. However, a security audit identified several high and medium severity Server-Side Request Forgery (SSRF) and Path Traversal vulnerabilities. The core resource-opening logic in dql/stream lacks validation, and several site-specific fetchers are vulnerable to SSRF bypass via path traversal sequences. Beyond security, there are also areas for improvement concerning error handling (many functions use panic), type safety (reflection bypasses Go's type safety), and consistency (e.g., naming conventions and todo items). Addressing these points, especially implementing strict input validation and sanitization for file paths and URLs, will significantly improve the robustness, maintainability, and security of the dql library.
| func getCacheDir() string { | ||
| root, err := os.UserCacheDir() | ||
| if err != nil { | ||
| panic(err) |
There was a problem hiding this comment.
| f, err := os.Create(cacheFile) | ||
| if err != nil { | ||
| return | ||
| } | ||
| defer f.Close() | ||
| _, err = io.Copy(f, resp.Body) | ||
| return | ||
| } | ||
|
|
||
| func ReadCache(cacheFile string, fi fs.FileInfo) (ret io.ReadCloser, err error) { | ||
| return os.Open(cacheFile) | ||
| } | ||
|
|
||
| // ------------------------------------------------------------------------------------- | ||
|
|
There was a problem hiding this comment.
Security: Cache implementation concerns:
- No TTL/expiration - cached content is served indefinitely
- No cache eviction - unbounded disk growth
- Race condition - concurrent requests for same URL may corrupt cache
- The TODO comment acknowledges missing checksum validation
Consider adding file locking and TTL-based expiration.
| ) | ||
|
|
||
| var ( | ||
| // DefaultUserAgent is the default UserAgent and is used by HTTPSource. |
There was a problem hiding this comment.
Performance/Safety: The HTTP client has no timeout configured. http.DefaultClient may hang indefinitely on slow/unresponsive servers. Consider setting a reasonable timeout:
Client = &http.Client{
Timeout: 30 * time.Second,
}
No description provided.