Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ Weblate 2026.12
* Fixed a regular expression denial of service in :ref:`Azure Repos webhooks <code-hosting-azure-repos-notifications>`.
* Required repository access to set a path for a :ref:`repository-linked screenshot <screenshots>`.
* Kept backend errors out of :ref:`task status results <api-tasks>` when cached task metadata is removed during a request.
* Redacted repository credentials in Libre hosting checklists and component alerts.
* Prevented disclosure of private user fields in :ref:`REST API <api>` forms and of inaccessible workspace UUIDs in project create and update requests.
* Restricted automatic Markdown mention formatting to profiles the viewer can access. See :ref:`privacy-configuration`.

Expand Down
5 changes: 4 additions & 1 deletion weblate/billing/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
Translation,
)
from weblate.trans.removal import get_current_removal_batch
from weblate.trans.util import cleanup_repo_url
from weblate.utils.change_origin import capture_change_origin, get_acting_user
from weblate.utils.decorators import disable_for_loaddata
from weblate.utils.html import format_html_join_comma, list_to_tuples
Expand Down Expand Up @@ -1272,7 +1273,9 @@
license_name = format_html(
'<a href="{0}">{1}</a>', component.license_url, license_name
)
repo_url = component.repo
# The checklist is visible to people who cannot view repository
# credentials, including unrelated users of public projects.
repo_url = cleanup_repo_url(component.repo)
if repo_url.startswith("https://"):
repo_url = format_html('<a href="{0}">{0}</a>', repo_url)
yield LibreCheck(
Expand Down Expand Up @@ -1410,7 +1413,7 @@

@cached_property
def filename_valid(self) -> bool:
return self.full_filename and os.path.exists(self.full_filename)

Check failure on line 1416 in weblate/billing/models.py

View workflow job for this annotation

GitHub Actions / mypy

Incompatible return value type (got "Literal[''] | bool | None", expected "bool")

def clean(self) -> None:
if self.end is None or self.start is None:
Expand Down Expand Up @@ -1610,7 +1613,7 @@
instance.billing_workspace_changed = previous_workspace_id != workspace_id
if previous_workspace_id == workspace_id:
previous_workspace_id = None
instance.billing_previous_workspace_id = previous_workspace_id

Check failure on line 1616 in weblate/billing/models.py

View workflow job for this annotation

GitHub Actions / mypy

Incompatible types in assignment (expression has type "Any | Deferred", variable has type "UUID | None")


def get_project_billings(
Expand Down
42 changes: 42 additions & 0 deletions weblate/billing/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@
self.assertTrue(self.billing.valid_libre)

verbose = MissingTranslationInstructions.verbose
MissingTranslationInstructions.verbose = "<strong>Escaped alert</strong>"

Check failure on line 1177 in weblate/billing/tests.py

View workflow job for this annotation

GitHub Actions / mypy

Incompatible types in assignment (expression has type "str", variable has type "_StrPromise")
self.client.login(username=self.user.username, password="testpassword")
try:
response = self.client.get(self.billing.get_absolute_url())
Expand Down Expand Up @@ -1215,6 +1215,48 @@
self.assertNotIn("Your billing plan has exceeded its limits.", content)
self.assertNotIn(f"{component.get_absolute_url()}?alerts=1#alerts", content)

@override_settings(OFFER_HOSTING=True)
def test_libre_checklist_redacts_repository_credentials(self) -> None:
self.plan.price = 0
self.plan.save(update_fields=["price"])
project = self.add_project()
project.web = "https://example.org/"
project.access_control = Project.ACCESS_PUBLIC
self.enterContext(acting_user_context(self.user))
project.save(update_fields=["web", "access_control"])
token = "test-repository-token"
component = self.add_component(
project,
"000000",
repo=f"https://owner:{token}@example.org/repo.git",
)
component.add_alert("NoLibreConditions")
self.refresh_from_db()

check = next(
item
for item in self.billing.libre_component_checklist_without_alerts
if item.component.pk == component.pk
)
safe_link = (
'<a href="https://example.org/repo.git">https://example.org/repo.git</a>'
)
self.assertIn(safe_link, str(check.repository_url))
self.assertNotIn(token, str(check))

outsider = create_another_user()
alert = render_to_string(
"trans/alert/nolibreconditions.html",
{"component": component, "user": outsider},
)
self.assertIn(safe_link, alert)
self.assertNotIn(token, alert)

self.client.force_login(outsider)
response = self.client.get(component.get_absolute_url())
self.assertEqual(response.status_code, 200)
self.assertNotContains(response, token)

@override_settings(OFFER_HOSTING=True)
def test_billing_overview_compacts_component_checklist(self) -> None:
self.plan.price = 0
Expand Down Expand Up @@ -1702,7 +1744,7 @@

def test_workspace_can_not_be_changed(self) -> None:
workspace = self.billing.workspace
self.billing.workspace = None

Check failure on line 1747 in weblate/billing/tests.py

View workflow job for this annotation

GitHub Actions / mypy

Incompatible types in assignment (expression has type "None", variable has type "Workspace | Combinable")
with self.assertRaises(ValidationError):
self.billing.save()
self.refresh_from_db()
Expand Down Expand Up @@ -3159,10 +3201,10 @@
self.assertEqual(self.billing.plan, plan)
self.assertEqual(self.billing.state, Billing.STATE_TRIAL)
self.assertIsNone(self.billing.removal)
self.assertGreaterEqual(

Check failure on line 3204 in weblate/billing/tests.py

View workflow job for this annotation

GitHub Actions / mypy

Cannot infer value of type parameter "_T" of "assertGreaterEqual" of "TestCase"
self.billing.expiry, before + timedelta(days=TRIAL_DAYS)
)
self.assertLessEqual(

Check failure on line 3207 in weblate/billing/tests.py

View workflow job for this annotation

GitHub Actions / mypy

Cannot infer value of type parameter "_T" of "assertLessEqual" of "TestCase"
self.billing.expiry,
timezone.now() + timedelta(days=TRIAL_DAYS),
)
Expand Down
Loading