Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge tag 'v0.99.3.2'
Browse files Browse the repository at this point in the history
Synapse 0.99.3.2 (2019-05-03)
=============================

Internal Changes
----------------

- Ensure that we have `urllib3` <1.25, to resolve incompatibility with `requests`. ([\#5135](#5135))
  • Loading branch information
richvdh committed May 3, 2019
2 parents 3d26eae + fa21455 commit 9b86d3d
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 19 deletions.
20 changes: 20 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
Synapse 0.99.3.2 (2019-05-03)
=============================

Internal Changes
----------------

- Ensure that we have `urllib3` <1.25, to resolve incompatibility with `requests`. ([\#5135](https://github.com/matrix-org/synapse/issues/5135))


Synapse 0.99.3.1 (2019-05-03)
=============================

Security update
---------------

This release includes two security fixes:

- Switch to using a cryptographically-secure random number generator for token strings, ensuring they cannot be predicted by an attacker. Thanks to @opnsec for identifying and responsibly disclosing this issue! ([\#5133](https://github.com/matrix-org/synapse/issues/5133))
- Blacklist 0.0.0.0 and :: by default for URL previews. Thanks to @opnsec for identifying and responsibly disclosing this issue too! ([\#5134](https://github.com/matrix-org/synapse/issues/5134))

Synapse 0.99.3 (2019-04-01)
===========================

Expand Down
12 changes: 12 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
matrix-synapse-py3 (0.99.3.2) stable; urgency=medium

* New synapse release 0.99.3.2.

-- Synapse Packaging team <packages@matrix.org> Fri, 03 May 2019 18:56:20 +0100

matrix-synapse-py3 (0.99.3.1) stable; urgency=medium

* New synapse release 0.99.3.1.

-- Synapse Packaging team <packages@matrix.org> Fri, 03 May 2019 16:02:43 +0100

matrix-synapse-py3 (0.99.3) stable; urgency=medium

[ Richard van der Hoff ]
Expand Down
3 changes: 2 additions & 1 deletion docker/Dockerfile-dhvirtualenv
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ RUN apt-get update -qq -o Acquire::Languages=none \
python3-pip \
python3-setuptools \
python3-venv \
sqlite3
sqlite3 \
libpq-dev

COPY --from=builder /dh-virtualenv_1.1-1_all.deb /

Expand Down
17 changes: 12 additions & 5 deletions docs/sample_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,12 @@ uploads_path: "DATADIR/uploads"
# height: 600
# method: scale

# Is the preview URL API enabled? If enabled, you *must* specify
# an explicit url_preview_ip_range_blacklist of IPs that the spider is
# denied from accessing.
# Is the preview URL API enabled?
#
#url_preview_enabled: false
# 'false' by default: uncomment the following to enable it (and specify a
# url_preview_ip_range_blacklist blacklist).
#
#url_preview_enabled: true

# List of IP address CIDR ranges that the URL preview spider is denied
# from accessing. There are no defaults: you must explicitly
Expand All @@ -520,6 +521,12 @@ uploads_path: "DATADIR/uploads"
# synapse to issue arbitrary GET requests to your internal services,
# causing serious security issues.
#
# (0.0.0.0 and :: are always blacklisted, whether or not they are explicitly
# listed here, since they correspond to unroutable addresses.)
#
# This must be specified if url_preview_enabled is set. It is recommended that
# you uncomment the following list as a starting point.
#
#url_preview_ip_range_blacklist:
# - '127.0.0.0/8'
# - '10.0.0.0/8'
Expand All @@ -530,7 +537,7 @@ uploads_path: "DATADIR/uploads"
# - '::1/128'
# - 'fe80::/64'
# - 'fc00::/7'
#

# List of IP address CIDR ranges that the URL preview spider is allowed
# to access even if they are specified in url_preview_ip_range_blacklist.
# This is useful for specifying exceptions to wide-ranging blacklisted
Expand Down
1 change: 1 addition & 0 deletions scripts-dev/build_debian_packages
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ DISTS = (
"ubuntu:xenial",
"ubuntu:bionic",
"ubuntu:cosmic",
"ubuntu:disco",
)

DESC = '''\
Expand Down
2 changes: 1 addition & 1 deletion synapse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
except ImportError:
pass

__version__ = "0.99.3"
__version__ = "0.99.3.2"
31 changes: 21 additions & 10 deletions synapse/config/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,21 @@ def read_config(self, config):
except ImportError:
raise ConfigError(MISSING_NETADDR)

if "url_preview_ip_range_blacklist" in config:
self.url_preview_ip_range_blacklist = IPSet(
config["url_preview_ip_range_blacklist"]
)
else:
if "url_preview_ip_range_blacklist" not in config:
raise ConfigError(
"For security, you must specify an explicit target IP address "
"blacklist in url_preview_ip_range_blacklist for url previewing "
"to work"
)

self.url_preview_ip_range_blacklist = IPSet(
config["url_preview_ip_range_blacklist"]
)

# we always blacklist '0.0.0.0' and '::', which are supposed to be
# unroutable addresses.
self.url_preview_ip_range_blacklist.update(['0.0.0.0', '::'])

self.url_preview_ip_range_whitelist = IPSet(
config.get("url_preview_ip_range_whitelist", ())
)
Expand Down Expand Up @@ -260,11 +264,12 @@ def default_config(self, data_dir_path, **kwargs):
#thumbnail_sizes:
%(formatted_thumbnail_sizes)s
# Is the preview URL API enabled? If enabled, you *must* specify
# an explicit url_preview_ip_range_blacklist of IPs that the spider is
# denied from accessing.
# Is the preview URL API enabled?
#
# 'false' by default: uncomment the following to enable it (and specify a
# url_preview_ip_range_blacklist blacklist).
#
#url_preview_enabled: false
#url_preview_enabled: true
# List of IP address CIDR ranges that the URL preview spider is denied
# from accessing. There are no defaults: you must explicitly
Expand All @@ -274,6 +279,12 @@ def default_config(self, data_dir_path, **kwargs):
# synapse to issue arbitrary GET requests to your internal services,
# causing serious security issues.
#
# (0.0.0.0 and :: are always blacklisted, whether or not they are explicitly
# listed here, since they correspond to unroutable addresses.)
#
# This must be specified if url_preview_enabled is set. It is recommended that
# you uncomment the following list as a starting point.
#
#url_preview_ip_range_blacklist:
# - '127.0.0.0/8'
# - '10.0.0.0/8'
Expand All @@ -284,7 +295,7 @@ def default_config(self, data_dir_path, **kwargs):
# - '::1/128'
# - 'fe80::/64'
# - 'fc00::/7'
#
# List of IP address CIDR ranges that the URL preview spider is allowed
# to access even if they are specified in url_preview_ip_range_blacklist.
# This is useful for specifying exceptions to wide-ranging blacklisted
Expand Down
8 changes: 8 additions & 0 deletions synapse/python_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@
"attrs>=17.4.0",

"netaddr>=0.7.18",

# requests is a transitive dep of treq, and urlib3 is a transitive dep
# of requests, as well as of sentry-sdk.
#
# As of requests 2.21, requests does not yet support urllib3 1.25.
# (If we do not pin it here, pip will give us the latest urllib3
# due to the dep via sentry-sdk.)
"urllib3<1.25",
]

CONDITIONAL_REQUIREMENTS = {
Expand Down
9 changes: 7 additions & 2 deletions synapse/util/stringutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@
string.digits + string.ascii_letters + ".,;:^&*-_+=#~@"
)

# random_string and random_string_with_symbols are used for a range of things,
# some cryptographically important, some less so. We use SystemRandom to make sure
# we get cryptographically-secure randoms.
rand = random.SystemRandom()


def random_string(length):
return ''.join(random.choice(string.ascii_letters) for _ in range(length))
return ''.join(rand.choice(string.ascii_letters) for _ in range(length))


def random_string_with_symbols(length):
return ''.join(
random.choice(_string_with_symbols) for _ in range(length)
rand.choice(_string_with_symbols) for _ in range(length)
)


Expand Down

0 comments on commit 9b86d3d

Please sign in to comment.