feat(add-ons): validate CDN fetch locations#18516
Merged
nijel merged 2 commits intoWeblateOrg:mainfrom Mar 18, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds stricter validation for Weblate CDN add-on “Extract strings from HTML files” inputs (both local paths and remote URLs), aligning remote URL handling with ALLOWED_ASSET_DOMAINS and preventing unsafe repository file access.
Changes:
- Introduce
validate_asset_url()and cover it with unit tests. - Validate/guard CDN add-on extraction sources in both the configuration form and the parsing task (remote domain allowlist + local filename validation).
- Document the new restriction and add a changelog entry.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
weblate/utils/validators.py |
Adds validate_asset_url() enforcing ALLOWED_ASSET_DOMAINS for http(s) URLs. |
weblate/utils/tests/test_validators.py |
Adds unit test coverage for the new asset URL validator. |
weblate/addons/tasks.py |
Validates remote URLs and local paths before reading/downloading content for extraction. |
weblate/addons/forms.py |
Validates each configured file/URL line on add-on configuration save. |
weblate/addons/tests.py |
Adds integration tests ensuring extraction refuses path traversal and disallowed remote domains. |
docs/devel/html.rst |
Documents that remote URLs are restricted by ALLOWED_ASSET_DOMAINS. |
docs/admin/config.rst |
Notes ALLOWED_ASSET_DOMAINS is used by the CDN add-on remote HTML downloads. |
docs/changes.rst |
Adds a bugfix changelog entry for validating parsed locations. |
Validate both local and remote locations before processing and when configuring the add-on.
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.
Validate both local and remote locations before processing and when configuring the add-on.