Commit Graph

46992 Commits

Author SHA1 Message Date
Anders Kaseorg
88b6f1fe14 run-codespell: Update codespell exclude list.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 4fb97576e9)
2022-11-14 17:11:39 -05:00
Anders Kaseorg
c61799aef9 test_message_flags: Fix “accessibility” spelling.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 019c9527c1)
2022-11-14 17:11:39 -05:00
Anders Kaseorg
596057dd0a populate_db: Spell “stickiness” correctly.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit f27a709a5e)
2022-11-14 17:11:39 -05:00
Mateusz Mandera
897476d4fb middleware: Log 5xx json_errors in JsonErrorHandler.
django.request logs responses with 5xx response codes (our configuration
of the logger prevents it from logging 4xx as well which it normally
does too). However, it does it without the traceback which results in
quite unhelpful log message that look like
"Bad Gateway:/api/v1/users/me/apns_device_token" - particularly
confusing when sent via email to server admins.

The solution here is to do the logging ourselves, using Django's
log_response() (which is meant for this purpose), and including the
traceback. Django tracks (via response._has_been_logged attribute) that
the response has already been logged, and knows to not duplicate that
action. See log_response() in django's codebase for these details.

Fixes #19596.
2022-10-17 17:45:44 -04:00
Mateusz Mandera
cdd01b9f8e send_analytics_to_remote_server: Log connection errors with traceback.
It seems helpful for this to get logged with the traceback rather than
just the general
"<exception name>  while trying to connect to push notification bouncer."
2022-10-17 17:45:44 -04:00
Anders Kaseorg
55c0a15f1c middleware: Pass unhandled API exceptions through to the test suite.
This results in more useful stack traces in failing tests.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-10-17 17:45:44 -04:00
Alex Vandiver
4139427c41 js: Only trigger reload-on-focus once.
We have observed infrequent storms of accesses (tens of thousands of
requests to minute) to `/` after an event queue expires.  The current
best theory is that the act of reloading the page itself triggers a
focus event, which itself triggers a reload before the prior one had
had time to do anything but send the network request.

Since the `focus` event here is merely as a backstop in case the
synchronous reloading and deferred reloading fail, we need only run it
once.

(cherry picked from commit e7ff4afc36)
2022-10-17 17:45:14 -04:00
Alex Vandiver
09319a1be0 js: Prevent scheduling a non-immediate reload while one is happening.
Prevent a non-immediate reload from being scheduled while an immediate
reload is already in progress.  This is highly unlikely in practice,
but is a reasonable safeguard.

(cherry picked from commit f8c9d60d33)
2022-10-17 17:45:14 -04:00
Alex Vandiver
ee88d4b4fa js: Ensure that reload.initiate cannot fall through.
A `reload.initiate({immediate: true, ...})` *should* not return, as it
should trigger a `window.location.reload` and stop execution.

In the event that it continues execution and returns (for instance,
due to being in the background and reloads being suppressed for
power-saving -- see #6821), there is no need to fall through and
potentially schedule a 90-second-later retry.

(cherry picked from commit ffadf82f8c)
2022-10-17 17:45:14 -04:00
Varun Sharma
385a408be5 ci: Limit GitHub token permissions for workflows.
This limits the ability for an Action to do mischief with this token.

Fixes #22786.

Signed-off-by: Varun Sharma <varunsh@stepsecurity.io>
2022-08-30 10:06:44 -07:00
Tim Abbott
e469cf4bc9 release: Don't remove OUTPUT_DIR on exit.
This ends up deleting your local copy of the release tarball, which
can be annoying if you need to upload it manually to the GitHub
releases page.
2022-08-25 12:51:41 -07:00
Tim Abbott
5823cc79f1 release: Fix pushing new release tags. 2022-08-25 12:51:41 -07:00
Tim Abbott
97efbf8590 version: Update version after 5.6 release. 2022-08-24 16:34:43 -07:00
Tim Abbott
d6533973b6 Release Zulip Server 5.6. 5.6 2022-08-24 13:10:05 -07:00
Anders Kaseorg
b12a5be4a0 CVE-2022-36048: Rewrite only specific local links to relative.
Due to mismatches between the URL parsers in Python and browsers, it
was possible to hoodwink rewrite_local_links_to_relative into
generating links that browsers would interpret as absolute.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-08-24 13:07:42 -07:00
Anders Kaseorg
09fb71f95a requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 74f7b6e4fd)
2022-08-23 15:25:01 -07:00
Anders Kaseorg
64cbd4e7c7 retention: Inline move_rows query arguments.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit b4b8691239)
2022-08-23 15:25:01 -07:00
Anders Kaseorg
969fafcacf analytics: Add Composable type annotations.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 73374996a5)
2022-08-23 15:25:01 -07:00
Anders Kaseorg
170d805d9f upload: Replace boto3.Session with boto3.session.Session.
boto3-stubs seems to have dropped the former for some reason.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 2508b579a6)
2022-08-23 15:25:01 -07:00
Anders Kaseorg
540060d389 settings: Add two_factor.plugins.phonenumber to INSTALLED_APPS.
I missed this in commit feff1d0411
(#22383) for upgrading to django-two-factor-auth 1.14.0.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 2439914a50)
2022-08-22 22:41:49 -07:00
Anders Kaseorg
90c45bd230 requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit feff1d0411)
2022-08-22 22:41:49 -07:00
Anders Kaseorg
1ae9922a86 test_tornado: Avoid deprecated AsyncHTTPTestCase.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 6c79b8f2f1)
2022-08-22 22:41:49 -07:00
Anders Kaseorg
4a618ed973 db: Use cursor_factory psycopg2 option.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit b4cf9ad777)
2022-08-22 22:41:49 -07:00
Anders Kaseorg
0dbc3917ef mypy: Add types-zxcvbn.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 76f4123f42)
2022-08-22 22:41:49 -07:00
Tim Abbott
6c8f5ca459 release: Fix OUTDIR typo.
This was missed in 58962f0b7b.
2022-08-22 22:40:20 -07:00
Anders Kaseorg
e0442e5683 commit-message-lint: Take release branches into account.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-08-22 22:24:27 -07:00
Anders Kaseorg
6f08dbe11b decorator: Check Tornado secret with constant-time comparison.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-08-22 22:23:24 -07:00
Anders Kaseorg
84064e82c7 zilencer: Check remote server API keys with constant-time comparison.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-08-22 22:22:19 -07:00
Tim Abbott
6f4d38bed7 i18n: Update translation data from Transifex. 2022-08-22 22:20:43 -07:00
Tim Abbott
73ebc6a3b0 docs: Document changing subdomains on multiple organizations page. 2022-08-17 11:37:02 -07:00
Tim Abbott
87e8913703 docs: Remove documentation for ROOT_DOMAIN_LANDING_PAGE.
This is not a feature intended to be used outside zulip.com, since it
just sets your server to have the zulip.com landing pages. I think
it's only been turned on by people who were confused by this text.
2022-08-17 11:37:01 -07:00
Tim Abbott
cb57c5e2e4 docs: Clean up documentation for multiple hostnames.
The previous documentation did not spell out what to enter in the
realm creation form.
2022-08-17 11:37:00 -07:00
Matt Keller
aeea9e3366 version: Update version after 5.5 release. 2022-07-21 21:17:01 -04:00
Matt Keller
e74582838f Release Zulip Server 5.5. 5.5 2022-07-21 20:29:38 -04:00
Matt Keller
69a7690a89 tools: Add executable bit to release tool. 2022-07-21 20:29:38 -04:00
Anders Kaseorg
c9f6830ba6 CVE-2022-31168: Fix authorization check for changing bot roles.
Due to an incorrect authorization check in Zulip Server 5.4 and
earlier, a member of an organization could craft an API call that
grants organization administrator privileges to one of their bots.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-07-21 20:09:02 -04:00
Alex Vandiver
93d2c77225 restore-backup: Provide flags to leave settings.py and zulip.conf as-is. 2022-07-21 11:45:41 -07:00
Alex Vandiver
5cd22c2c80 restore-backup: Only extract /etc/zulip once.
This is already handled in the earlier block; there is no need to
extract it twice.
2022-07-21 11:45:41 -07:00
Alex Vandiver
808838597a restore-backup: Switch to run() to check exit codes. 2022-07-21 11:45:41 -07:00
Alex Vandiver
639d42c59f restore-backup: Ensure it is run as root. 2022-07-21 11:45:41 -07:00
Alex Vandiver
0aa3b9136f release: Use the right variable to build predictable tarball path.
`tools/build-release-tarball` respects `OUTPUT_DIR`, not `OUTDIR`.
2022-07-21 11:42:18 -07:00
Tim Abbott
64f6e7f612 i18n: Update translation data from Transifex. 2022-07-14 16:26:44 -07:00
Alex Vandiver
a6779e99e5 version: Update version after 5.4 release. 2022-07-12 06:21:47 +00:00
Alex Vandiver
5e78618309 Release Zulip Server 5.4. 5.4 2022-07-12 05:34:08 +00:00
Mateusz Mandera
305c13faeb test_import_export: Test exclusion of private uploads from realm export. 2022-07-12 04:36:16 +00:00
Anders Kaseorg
c6a5903280 CVE-2022-31134: Exclude private attachments from realm exports.
Zulip Server 2.1.0 and above have a UI tool, accessible only to server
owners and server administrators, which provides a way to download a
“public data” export. While this export tool is only accessible to
administrators, in many configurations server administrators are not
expected to have access to private messages and private
streams. However, the “public data” export which administrators could
generate contained the attachment contents for all attachments, even
those from private messages and streams.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-07-12 04:36:14 +00:00
Anders Kaseorg
82adae451e email_notifications: Give absolute path to html2text.
Our uWSGI configuration doesn’t correctly activate our virtualenv.  We
should investigate that, but until we do, we need to invoke html2text
by an absolute path.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 7c992422f0)
2022-07-07 17:08:22 -07:00
Anders Kaseorg
3f0919cc65 markdown: Parse included blocks in a new parser state.
This fixes inclusion of a multi-paragraph file into a list item.

Followup to commit dc33a0ae67 (#22315).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 869fe60689)
2022-07-07 13:31:32 -07:00
Anders Kaseorg
e61ffc5bd7 integrations: Satisfy Python-Markdown’s archaic 4-space requirement.
Followup to commit dc33a0ae67 (#22315).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit a2e1d61172)
2022-07-07 13:31:32 -07:00
Anders Kaseorg
a303c27a16 tornado: Send request_started signal in Django thread.
Django’s ASGIHandler does this too and it seems like a good idea.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit a7e10ee47e)
2022-07-07 13:31:32 -07:00