Skip to content

feat(add-ons): validate CDN fetch locations#18516

Merged
nijel merged 2 commits intoWeblateOrg:mainfrom
nijel:cdn-validate
Mar 18, 2026
Merged

feat(add-ons): validate CDN fetch locations#18516
nijel merged 2 commits intoWeblateOrg:mainfrom
nijel:cdn-validate

Conversation

@nijel
Copy link
Copy Markdown
Member

@nijel nijel commented Mar 18, 2026

Validate both local and remote locations before processing and when configuring the add-on.

@nijel nijel added this to the 5.17 milestone Mar 18, 2026
@nijel nijel requested a review from Copilot March 18, 2026 09:29
@nijel nijel self-assigned this Mar 18, 2026
@nijel nijel requested a review from AliceVisek as a code owner March 18, 2026 09:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread weblate/addons/tasks.py
Comment thread weblate/addons/forms.py
Comment thread docs/devel/html.rst
Comment thread docs/admin/config.rst
Comment thread docs/changes.rst
@nijel nijel enabled auto-merge (squash) March 18, 2026 10:44
Validate both local and remote locations before processing and when
configuring the add-on.
@nijel nijel merged commit 03849e7 into WeblateOrg:main Mar 18, 2026
48 checks passed
@nijel nijel deleted the cdn-validate branch March 18, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants