Commit Graph

34022 Commits

Author SHA1 Message Date
Tim Abbott
b21117954d CVE-2020-9445: Remove unused and insecure modal_link feature.
Zulip's modal_link markdown feature has not been used since 2017; it
was a hack used for a 2013-era tutorial feature and was never used
outside that use case.

Unfortunately, it's sloppy implementation was exposed in the markdown
processor for all users, not just the tutorial use case.

More importantly, it was buggy, in that it did not validate the link
using the standard validation approach used by our other code
interacting with links.

The right solution is simply to remove it.
2020-04-01 13:35:31 -07:00
Mateusz Mandera
59f5ca713f auth: Fix error on startup in django-two-factor-auth in Django 2.1+.
https://github.com/Bouke/django-two-factor-auth/issues/297
This setting was added in 1.9 version of the app and can be used
harmleslly in our current Django 1.11-based code and will prevent an
error on Django 2.1+ when we move there.
2020-04-01 13:35:31 -07:00
Tim Abbott
67da8e8431 version: Move minimum desktop version configuration to version.py.
This makes it relatively easy for a system administrator to
temporarily override these values after a desktop app security
release that they want to ensure all of their users take.

We're not putting this in settings, since we don't want to encourage
accidental long-term overrides of these important-to-security values.
2020-04-01 13:23:53 -07:00
Mateusz Mandera
b79fbf9239 requirements: Bump python-social-auth to 3.3.2. 2020-03-26 23:35:56 +00:00
Tom Daff
f1f937e4ea monitoring: Fix check-rabbitmq-consumers.
Missing commas in the definition of all the queues to check meant that it would be looking for queues with concatenated names, rather than the correct ones. Added the commas.
2020-03-25 17:19:55 -07:00
Chris Heald
68628149db integrations: Add AlertManager webhook. 2020-03-25 11:39:05 -07:00
Anders Kaseorg
f247721a2d tests: Fix test_banned_desktop_app_versions for 2.1.x.
ZulipTestCase.login_user was not added until commit
1b16693526 (#14176).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-03-25 00:39:55 -07:00
Tim Abbott
e3d6b4f210 compatibility: Add more strict desktop app blocking.
This allows us to block use of the desktop app with insecure versions
(we simply fail to load the Zulip webapp at all, instead rendering an
error page).

For now we block only versions that are known to be both insecure and
not auto-updating, but we can easily adjust these parameters in the
future.
2020-03-24 20:35:21 -07:00
YashRE42
ea8e6149da templates: Extract navbar_alerts to seperate file.
This is a prep-commit for the new navbar style, seperating
navbar_alerts.html from navbar.html in order to make the structure and
styles of navbar.html  easier to tweak.
These templates have very little to do with each other to begin with
appart from the fact that they are both rendered at the top of the app.
2020-03-24 20:35:17 -07:00
Rohitt Vashishtha
376cd88a83 tests: Treat github.com/zulip links as external.
Tests for these links often result in rate-limiting from GitHub,
leading to the builds failing in Circle CI. We temporarily mark
github.com/zulip links as external to keep the builds passing.
2020-03-19 17:26:53 +01:00
Mateusz Mandera
bfd92260fd requirements: Bump python-social-auth version. 2020-03-19 16:58:57 +01:00
Mateusz Mandera
217431d0c4 auth: Monkey patch a fix for Github deprecation notice spam.
This is a way to monkey-patch a fix for
https://github.com/python-social-auth/social-core/issues/430
Changes from this commit should be reverted once the issue is fixed
upstream.
2020-03-03 15:49:18 -08:00
Mateusz Mandera
30cc6798b3 auth: Fix Github auth with organization/team membership restriction.
We need to request access to read:org scope to be able to check org/team
membership. Without it SOCIAL_AUTH_GITHUB_ORG_NAME and
SOCIAL_AUTH_GITHUB_TEAM_ID settings don't work and simply lead to all
auth attempts failing.
Tested manually.
2020-03-01 15:30:10 +01:00
Tim Abbott
677ad69555 docs: Update draft changelog for 2.1.3. 2020-02-28 17:06:22 -08:00
Mateusz Mandera
95118d860d home: Don't assume user agent header is set for insecure_desktop_app.
The header may not be set - this leads to CI failures on 2.1.x branch,
but in any case is a real bug.
2020-02-28 17:01:26 -08:00
Tim Abbott
b8888c801b panels: Show a banner for users with legacy desktop apps.
Users who are using ZulipDesktop or haven't managed to auto-update to
ZulipElectron should be strongly encouraged to upgrade.

We'll likely want to move to something even stricter that blocks
loading the app at all, but this is a good start.
2020-02-28 05:29:25 -08:00
Vishnu KS
7a9251a3e1 actions: Make do_change_plan_type support changing plan to SELF_HOSTED.
Credits to @xpac1985 for reporting, debugging and proposing fix to the
issue. The proposed fix was modified slightly by @hackerkid to set the
correct value for max_invites and upload_quota_gb. Tests added by
@hackerkid.

Fixes #13974
2020-02-25 16:16:48 -08:00
Pragati Agrawal
64ec413940 settings user groups: Fix organization admin can not create user groups.
The bug was in complex `if` condition, which should mean that users should
be allowed to create a User group only when they are either admin or user
group creation policy is set to everyone.

Fixes: #13909.
2020-02-24 12:16:36 -08:00
Mateusz Mandera
147c3998de tests: Adjust failing test on 2.1.x branch.
The KeyError is getting formatted a bit differently on the 2.1.x branch.
2020-02-24 12:11:59 -08:00
Mateusz Mandera
79fc9c3281 saml: Add SOCIAL_AUTH_SAML_SECURITY_CONFIG to default_settings.
SOCIAL_AUTH_SAML_SECURITY_CONFIG["authnRequestsSigned"] override in
settings.py in a previous commit wouldn't work on servers old enough to
not have the SAML settings in their settings.py - due to
SOCIAL_AUTH_SAML_SECURITY_CONFIG being undefined.
This commit fixes that.
2020-02-21 09:30:36 -08:00
Mateusz Mandera
a33d7f0400 saml: Make the bad idp param KeyError log message more verbose.
Original idea was that KeyError was only going to happen there in case
of user passing bad input params to the endpoint, so logging a generic
message seemed sufficient. But this can also happen in case of
misconfiguration, so it's worth logging more info as it may help in
debugging the configuration.
2020-02-20 14:49:41 -08:00
Mateusz Mandera
2471f6ad83 saml: Use rsa-sha256 as the default signature algorithm.
python3-saml uses the insecure rsa-sha1 as default.
2020-02-20 14:47:51 -08:00
Vishnu KS
19d1ca3a1d management: Make backup command work when DB is not in localhost.
This is useful preparatory work for supporting the backup management
command inside docker-zulip.
2020-02-19 14:22:47 -08:00
Anders Kaseorg
9fcbc3a49b puppet: Fix regeneration of memcached-sasldb2 on password changes.
Puppet doesn’t re-run an exec blocks that’s declared as creating an
existing file, even if it’s notified.  Remove the creates declaration.

Fixes #13730.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-19 14:21:39 -08:00
Anders Kaseorg
1413fda773 restore-backup: Run generate_secrets.py.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-19 14:21:38 -08:00
Tim Abbott
494e596be8 Draft release notes for 2.1.3. 2020-02-19 12:28:27 -08:00
Tim Abbott
4cc25f8e84 i18n: Add missing translation tags to typing notifications.
Thanks to Andrea Soc for the report.
2020-02-19 12:28:27 -08:00
Tim Abbott
19ab295172 email_notifications: Fix missing translation tags on sender. 2020-02-19 12:28:26 -08:00
Tim Abbott
31f02cd926 test_fixtures: Fix buggy reuse of status_dir between databases.
Apparently, the arguments passed to template_database_status were
incorrect for the manual testing development database, in that we
didn't pass a status_dir when calling into that code from provision.

The result was that provisioning before running `test-backend` would
ignore changes to the list of check_files (etc.) made after rebasing,
and vice versa.

The cleanest fix is to compute status_dir from other values passed in;
I'm also going to open a follow-up issue for creating a better overall
interface here.
2020-02-19 12:28:26 -08:00
Tim Abbott
266c7c83e0 test_fixtures: Note populate_db depends on server_initialization.py.
This should ensure that folks rebasing past this commit from an older
database model get their database rebuilt in the way that will
match the test_subs.py query count of 40.
2020-02-19 12:08:55 -08:00
Hemanth V. Alluri
dd198fd06e webhooks/ansibletower: Update for AWX 9.1.1.
Add a simple compatibility function for AWX 9.x.x. Before AWX 9.x.x
a "friendly_name" key was sent by default. Afterwards it was removed
from being a default key but we can still more or less determine if
the triggering event was a job from the REST-style URL.

Note: It is also technically possible to add the key back by defining
a custom notification template in AWX/Tower.

Resolves #13295.
2020-02-19 12:08:55 -08:00
xpac1985
10e8928b0f docs: Add info about zulip-announce RSS feed to install docs.
The mailing list can also be subscribed to via RSS/Atom feeds, I just wanted to make that information easier accessible.
2020-02-19 12:08:55 -08:00
Ray Kraesig
bc81275d3c register: Ensure future client_capabilities fields are optional.
The `notification_settings_null` field of the `client_capabilities`
parameter is, apparently unintentionally, required.

This is mostly harmless. However, if any _future_ fields are made
required, all existing clients using this parameter will break, and it
will be needlessly difficult for new clients to specify new
capabilities in a backwards-compatible way.

Attempt to stave that possibility off with warnings.

(No functional changes.)
2020-02-19 12:08:55 -08:00
Tim Abbott
6c8c3cd3dc settings: Fix copy-from-clipboard behavior for bot tokens.
We do this by cleaning up the API for generate_zuliprc_content,
allowing us to deduplicate the previously incorrect code.
2020-02-19 12:08:55 -08:00
Vishnu KS
1783515794 emails: Use the word email instead of message in do not reply sentence.
Fixes #13693
2020-02-19 12:08:55 -08:00
Vishnu KS
21026d984b emails: Remove unecessary call to message_content_allowed_in_missedmessage_emails. 2020-02-19 12:08:55 -08:00
Vishnu KS
66fe724c8a emails: Show proper message when email content is not shown. 2020-02-19 12:08:55 -08:00
Vishnu KS
282d6edf2e tests: Check whether body include multiple strings in _test_cases. 2020-02-19 12:08:55 -08:00
Mateusz Mandera
785a7ec9e7 email_mirror: Handle encoded attachment filenames. 2020-02-19 12:08:55 -08:00
Mateusz Mandera
c44d9f9b1b email_mirror: Extract handle_header_content function. 2020-02-19 12:08:55 -08:00
Tim Abbott
0d5d3c4912 email_mirror: Rewrite docstrings to focus on current reality.
These docstrings hadn't been properly updated in years, and bad an
awkward mix of a bad version of the user-facing documentation and
details that are no longer true (e.g. references to "Voyager").

(One important detail is that we have real documentation for this
system now).
2020-02-19 12:08:55 -08:00
Mateusz Mandera
ef793590c1 email_mirror: Parse encoded From headers with show_sender=True. 2020-02-19 12:08:55 -08:00
Tim Abbott
3032ba15cf soft_deactivation: Fix incorrect logging function.
Using logging.info() rather than logger.info() meant that our
zulip.soft_deactivation logger configuration (which, in particular,
included not logging to the console) was not active on this log line,
resulting in the `manage.py soft_deactivate_users` cron job sending
emails every time it ran.

Fixes #13750.
2020-02-19 12:08:55 -08:00
Tim Abbott
96a2ddffe7 docs: Add link from LDAP docs to invitation docs.
This addresses confusion we had with some organizations where they
were surprised that with only LDAP enabled, the "invite more users"
feature was available.

Fixes #11685.
2020-02-19 12:08:55 -08:00
Tim Abbott
2794362214 slack import: Fix handling of messages sent by user U00. 2020-02-19 12:08:55 -08:00
Vishnu KS
9b3e1e2c97 emails: Set alt attribute to empty for leading images.
The alt text of the leading images were displayed as preview
content in inbox by email clients like gmail. Since the leading
images were used mostly for decoration this made the preview
content gibberish. It's fine to set the alt attributes to empty
from accessibility point of view since the old alt attributes
did't added any meaningful information.
2020-02-19 12:08:55 -08:00
orientor
ae44fdd7cc settings: Fix buggy emoji format loading spinner.
When a user clicked the current emoji format in "display settings",
we'd show an infinite loading spinner (basically as a side effect of
trying to tell the server to change the emoji format to what it
already was).

Fix this by aborting early if the emoji format is already the option
that the user clicked.

Fixes #13684.
2020-02-19 12:08:55 -08:00
Tim Abbott
b45cce61e7 message_list_view: Fix handling of links to deleted streams.
Previously, links to deleted streams would be incorrectly rendered as
stream's name).

Fixes an issue that was reported where after deleting the "general"
stream, the welcome turtle messages might appear as links to
2020-02-19 12:08:55 -08:00
Tim Abbott
2e923a0eb5 slack import: Improve error messages around invalid tokens.
This updates our error handling of invalid Slack API tokens (and other
networking error handling) to mostly make sense:
* A token that doesn't start with `xoxp-` gives an extended error early.
* An AssertionError for the codebase is correctly declared as such.
* We check for token shape errors before querying the Slack API.

We could still do useful work to raise custom exception classes here.

Thanks to @stavrospat for raising this issue.
2020-02-19 12:08:55 -08:00
Mateusz Mandera
f538f34d95 email_mirror: Use .walk() to search all MIME parts for attachments.
Fixes #13416

We used to search only one level in depth through the MIME structure,
and thus would miss attachments that were nested deeper (which can
happen with some email clients). We can take advantage of message.walk()
to iterate through each MIME part.
2020-02-19 12:08:55 -08:00