refactor(internal/sidekick/parser): migrate sidekick parsers to use ModelConfig#3941
refactor(internal/sidekick/parser): migrate sidekick parsers to use ModelConfig#3941jameslynnwu merged 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the sidekick parsers by introducing a new ModelConfig struct to decouple them from the broader sidekickconfig.Config, enhancing separation of concerns and explicitness of dependencies. While the refactoring is well-executed and clean, several security concerns were identified: file paths from configurations are used in file operations across multiple parsers without sufficient validation, which could lead to Path Traversal vulnerabilities if untrusted repositories or configurations are processed. As per repository guidelines (Rule: Sanitize inputs for code generation templates), it is strongly recommended to implement robust path validation and sanitization for all specification and configuration sources. Additionally, following repository Go style guidelines (Rule: All exported types and fields in Go should have doc comments), documentation should be added to the new ModelConfig to clarify its usage for future developers.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3941 +/- ##
=======================================
Coverage 83.35% 83.35%
=======================================
Files 69 69
Lines 6188 6188
=======================================
Hits 5158 5158
Misses 671 671
Partials 359 359 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
… ModelConfig This commit updates parser.CreateModel and internal/sidekick/parser configs to use a structured ModelConfig instead of a sidekickconfig.Config. This allows generator specific code to separate from the common logic.
3dc2afd to
c8088e0
Compare
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: James Wu <jameslynnwu@users.noreply.github.com>
This commit updates parser.CreateModel to use ModelConfig instead of sidekickconfig.Config.
Part of #3662