Skip to content

Commit 03ac943

Browse files
committed
fix(auth): require recent verification for sensitive actions
Require fresh browser credentials before exposing secrets, downloading backups, or changing access and integration settings. Recheck permissions when resuming supported forms and preserve token-authenticated API workflows. Fixes #23121 Fixes https://hackerone.com/reports/4245612
1 parent 36297b8 commit 03ac943

41 files changed

Lines changed: 1122 additions & 187 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/admin/auth.rst‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,15 +1347,28 @@ a project token; complete a separate second-factor challenge for those actions.
13471347
Viewing the personal API key and changing credentials, access permissions, or
13481348
account status requires credential verification from the last 10 minutes in a
13491349
browser session. This includes managing project members and tokens, teams,
1350-
roles, user accounts, and project and component visibility.
1350+
roles, user accounts, project and component visibility, and moves between
1351+
projects. The check also applies to corresponding operations in Django
1352+
administration and requests authenticated with a browser session in the API.
13511353
Opening a :ref:`translation service installation <machine-translation-setup>`
13521354
or changing its exclusions also requires recent verification.
1355+
1356+
Weblate also verifies your identity before showing SSH private keys, backup
1357+
passphrases, GitHub App credentials, or full settings for webhook, CDN, and
1358+
Fedora Messaging add-ons.
1359+
Changing SSH host trust, managing site backups, registering or removing GitHub
1360+
Apps, disconnecting installations, and installing, configuring, or removing
1361+
those add-ons require verification. Downloading project backups and exporting
1362+
personal data also require verification.
1363+
13531364
Weblate prompts for a second factor when one is configured. Otherwise, enter your current password,
13541365
verify through a configured Django authentication backend, or sign in again through
13551366
an already connected provider. Weblate holds supported form submissions for
13561367
up to ten minutes and completes them automatically after successful
13571368
verification. This includes uploads on the leaked-password report page.
1358-
Password-entry forms and other file uploads may require another submission.
1369+
Some actions require another submission after verification, including Django
1370+
administration forms and personal data exports. If verification expires
1371+
during GitHub App registration, start the registration again.
13591372

13601373
Account deletion still requires confirmation through a link sent to your
13611374
e-mail address. API token requests continue to use token authentication.

‎docs/api.rst‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ the ``Authorization`` header with the ``Token`` or ``Bearer`` scheme.
3131
Unsupported schemes, such as ``Basic``, return :http:statuscode:`401`, even
3232
for public endpoints or when you are signed in using a browser session.
3333

34+
Requests authenticated by a browser session need :ref:`recent identity
35+
verification <sensitive-action-verification>` for sensitive operations.
36+
Verify your identity in Weblate before retrying a request denied for this
37+
reason. Add-on lists omit private webhook, CDN, and Fedora Messaging
38+
configuration fields until the browser session has been verified.
39+
3440
.. http:any:: /
3541
3642
Generic request behaviour for the API, the headers, status codes and

‎docs/changes.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Weblate 2026.12
3333

3434
* Show supported features in the :ref:`translation service lists <machine-translation-setup>`.
3535
* Resume supported browser form submissions after :ref:`verifying your identity <sensitive-action-verification>`.
36+
* Require :ref:`recent identity verification <sensitive-action-verification>` to view SSH private keys and Borg passphrases, download project backups, manage GitHub App credentials, and change protected integration or access settings.
3637

3738
* Switched :ref:`comment Markdown rendering <user-comments>` to markdown-it-py. Raw HTML tags appear as text, and links and images with disallowed destinations show only their labels.
3839
* :ref:`HTML files <html>` extract more human-readable attributes, including ARIA labels and custom attributes marked with ``data-translate-attribute``.

‎docs/security/threat-model.rst‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,8 +875,13 @@ Security properties Weblate provides
875875
token team membership, changes to authentication credentials, access permissions, project
876876
and component visibility, account status, and bulk user-contribution
877877
cleanup require recent credential verification for browser sessions.
878-
Reading full translation service configurations and changing installations
879-
or exclusions also require recent verification for browser sessions.
878+
This includes changes through Django administration and
879+
session-authenticated API requests. Reading protected integration
880+
configuration or infrastructure credentials, downloading backup archives,
881+
exporting personal data, changing SSH host trust, and configuring
882+
protected integrations also require recent verification. Continued GitHub
883+
App registration requires a current grant and the original signed
884+
registration state.
880885
Accounts with 2FA use a second factor; other accounts confirm their password or an existing
881886
sign-in provider. Weblate can hold an authorized browser form submission
882887
in encrypted server-side storage while verification is pending. The

‎weblate/accounts/tests/test_confidential_collaboration.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,14 @@ def test_trusted_disclosure_routes_are_scoped(self) -> None:
356356
]
357357
for viewer in (self.translators[0], self.administrator):
358358
self.client.force_login(viewer)
359+
if viewer == self.administrator:
360+
response = self.client.post(
361+
reverse("first-factor-verify"),
362+
{"target": "sensitive", "password": "testpassword"},
363+
)
364+
self.assertRedirects(
365+
response, reverse("profile"), fetch_redirect_response=False
366+
)
359367
for report in workspace_reports:
360368
allowed = (
361369
viewer == self.administrator and report.workspace_id == workspace.pk

‎weblate/accounts/tests/test_views.py‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
NotificationScope,
5757
)
5858
from weblate.accounts.tests.visibility import VisibilityPermissions
59+
from weblate.accounts.utils import SESSION_SENSITIVE_FACTOR_GRANT
5960
from weblate.accounts.views import (
6061
auth_token_error_message,
6162
log_handled_auth_failure,
@@ -1812,7 +1813,15 @@ def test_userdata(self) -> None:
18121813
frequency=frequency,
18131814
component=self.component,
18141815
)
1815-
response = self.client.post(reverse("userdata"))
1816+
url = reverse("userdata")
1817+
session = self.client.session
1818+
session.pop(SESSION_SENSITIVE_FACTOR_GRANT)
1819+
session.save()
1820+
response = self.client.post(url)
1821+
self.assertTrue(response["Location"].startswith(reverse("first-factor-verify")))
1822+
self.assertNotIn("Content-Disposition", response.headers)
1823+
self.client.post(response["Location"], {"password": "testpassword"})
1824+
response = self.client.post(url)
18161825
self.assertContains(response, "basic")
18171826

18181827
# Add more languages

‎weblate/accounts/views.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,7 +1869,11 @@ def submit_reset_api_key(request: AuthenticatedHttpRequest, _submission: Submiss
18691869
@require_POST
18701870
@login_required
18711871
@session_ratelimit_post("userdata")
1872+
@never_cache
18721873
def userdata(request: AuthenticatedHttpRequest):
1874+
if not has_recent_sensitive_verification(request):
1875+
messages.info(request, gettext("Request the export again after verification."))
1876+
return sensitive_verification_redirect(request, reverse("profile") + "#account")
18731877
response = JsonResponse(request.user.profile.dump_data())
18741878
response["Content-Disposition"] = content_disposition_header(
18751879
as_attachment=True, filename="weblate.json"

‎weblate/addons/base.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ class BaseAddon[StoredConfigurationT, ConfigurationT](DocVersionsMixin):
171171
events: ClassVar[set[AddonEvent]] = set()
172172
settings_form: type[BaseAddonForm[StoredConfigurationT, Self]] | None = None
173173
execution_form: type[Form] | None = None
174+
verify_configuration = False
174175
name = ""
175176
api_name: str | None = None
176177

‎weblate/addons/cdn.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151

5252

5353
class CDNBaseAddon(BaseAddon):
54+
verify_configuration = True
5455
user_name = "cdn"
5556
user_verbose = "CDN add-on"
5657
icon = "cloud-upload.svg"

‎weblate/addons/fedora_messaging.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ class FedoraMessagingPublishError(RuntimeError):
306306

307307

308308
class FedoraMessagingAddon(ChangeBaseAddon):
309+
verify_configuration = True
309310
icon = "webhook.svg"
310311
settings_form = FedoraMessagingAddonForm
311312
name = "weblate.fedora_messaging.publish"

0 commit comments

Comments
 (0)