fix(security): skip symlinks in GitExtractor - #14427
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughGitExtractor now skips symbolic links during statistics, full content extraction, and text extraction. Tests create a repository with an external symlink and verify that its path and target content are excluded. ChangesGit symlink handling
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 9✅ Passed checks (9 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Test Coverage AdvisorNo source changes detected without accompanying tests. Thanks for keeping coverage up! 🎉
|
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/backend/tests/unit/components/git/test_gitextractor_ssrf.py`:
- Around line 80-99: Update the GitExtractor tests around
test_gitextractor_files_content_skips_symlinks,
test_gitextractor_text_content_skips_symlinks, and
test_gitextractor_statistics_skips_symlinks to use
ComponentTestBaseWithoutClient and the required component_class, default_kwargs,
and file_names_mapping fixtures. Instantiate and exercise GitExtractorComponent
through the harness while preserving the existing symlink-skipping assertions.
- Around line 95-99: Update test_gitextractor_statistics_skips_symlinks to also
assert that result[0].data["total_size_bytes"] reflects only the non-symlink
file, confirming symlink targets are excluded from size statistics.
In `@src/bundles/lfx-bundles/src/lfx_bundles/git/gitextractor.py`:
- Around line 91-97: Update the directory-counting logic in the os.walk loop to
exclude symlinked entries from dirs before incrementing directories, matching
the existing file_path.is_symlink() filtering for files. Preserve os.walk’s
non-following behavior and continue counting only non-symlink directories.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 39c0e8e0-7d3f-4b95-aa45-c70a83c7569d
📒 Files selected for processing (2)
src/backend/tests/unit/components/git/test_gitextractor_ssrf.pysrc/bundles/lfx-bundles/src/lfx_bundles/git/gitextractor.py
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-1.11.3 #14427 +/- ##
==================================================
+ Coverage 61.40% 61.63% +0.22%
==================================================
Files 2398 2398
Lines 238302 238302
Branches 35840 35840
==================================================
+ Hits 146336 146880 +544
+ Misses 90158 89614 -544
Partials 1808 1808
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Summary
stator readValidation
9 passed—src/backend/tests/unit/components/git/test_gitextractor_ssrf.pyInternal tracking: LE-2138 / PVR0836215
Summary by CodeRabbit