fix(component): tighten symlinks validation#18683
Open
nijel wants to merge 1 commit intoWeblateOrg:mainfrom
Open
fix(component): tighten symlinks validation#18683nijel wants to merge 1 commit intoWeblateOrg:mainfrom
nijel wants to merge 1 commit intoWeblateOrg:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Tightens repository symlink validation across download/export paths and Gettext-related add-ons to prevent including or modifying files that resolve outside the repository tree.
Changes:
- Use validated component-managed filenames (template/new_base/intermediate) when building download ZIP contents; skip invalid symlink targets.
- Apply symlink validation to discovery/alerts logic that checks auxiliary component files.
- Add regression tests covering symlinked targets in downloads, discovery/alerts checks, new-language creation, API ZIP downloads, and Gettext add-ons.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| weblate/trans/views/files.py | Uses validated component filename getters when collecting files for ZIP downloads; skips invalid symlink targets. |
| weblate/trans/models/component.py | Adds get_validated_component_filename() helper; validates symlinks when creating new language files. |
| weblate/trans/models/alert.py | Validates component auxiliary files before checking existence for alerts. |
| weblate/trans/discovery.py | Validates auxiliary file paths during discovery skip-reason checks. |
| weblate/addons/gettext.py | Adds symlink validation around LINGUAS/configure-related file operations. |
| weblate/addons/tests.py | Adds tests ensuring Gettext add-ons reject symlinked files and don’t modify outside-repo targets. |
| weblate/trans/tests/test_files.py | Adds test asserting downloads exclude symlinked template files. |
| weblate/api/tests.py | Adds test asserting API ZIP downloads exclude symlinked template (test name currently mismatched). |
| weblate/trans/tests/test_newlang.py | Adds test rejecting symlinked destination directory during new language creation. |
| weblate/trans/tests/test_discovery.py | Adds test treating symlinked auxiliary discovery base file as “does not exist.” |
| weblate/trans/tests/test_alert.py | Adds test treating symlinked auxiliary base file as missing for alerts. |
| docs/changes.rst | Documents the symlink validation behavior change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use the symlink validation in download paths and gettext add-ons.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use the symlink validation in download paths and gettext add-ons.