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

Commit d70f909

Browse files
committed
Merge commit '920dd1083' into anoa/dinsic_release_1_21_x
* commit '920dd1083': 1.20.1 Mark the shadow_banned column as boolean in synapse_port_db. (#8386) Hotfix: disable autoescape by default when rendering Jinja2 templates (#8394)
2 parents 3729b15 + 920dd10 commit d70f909

File tree

7 files changed

+32
-3
lines changed

7 files changed

+32
-3
lines changed

.buildkite/test_db.db

444 KB
Binary file not shown.

CHANGES.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Synapse 1.20.1 (2020-09-24)
2+
===========================
3+
4+
Bugfixes
5+
--------
6+
7+
- Fix a bug introduced in v1.20.0 which caused the `synapse_port_db` script to fail. ([\#8386](https://github.com/matrix-org/synapse/issues/8386))
8+
- Fix URLs being accidentally escaped in Jinja2 templates. Broke in v1.20.0. ([\#8394](https://github.com/matrix-org/synapse/issues/8394))
9+
10+
111
Synapse 1.20.0 (2020-09-22)
212
===========================
313

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
matrix-synapse-py3 (1.20.1) stable; urgency=medium
2+
3+
* New synapse release 1.20.1.
4+
5+
-- Synapse Packaging team <[email protected]> Thu, 24 Sep 2020 16:25:22 +0100
6+
17
matrix-synapse-py3 (1.20.0) stable; urgency=medium
28

39
[ Synapse Packaging team ]

scripts/synapse_port_db

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ BOOLEAN_COLUMNS = {
9090
"redactions": ["have_censored"],
9191
"room_stats_state": ["is_federatable"],
9292
"local_media_repository": ["safe_from_quarantine"],
93+
"users": ["shadow_banned"],
9394
}
9495

9596

synapse/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
except ImportError:
4949
pass
5050

51-
__version__ = "1.20.0"
51+
__version__ = "1.20.1"
5252

5353
if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)):
5454
# We import here so that we don't have to install a bunch of deps when

synapse/config/_base.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ def read_file(cls, file_path, config_name):
195195
return file_stream.read()
196196

197197
def read_templates(
198-
self, filenames: List[str], custom_template_directory: Optional[str] = None,
198+
self,
199+
filenames: List[str],
200+
custom_template_directory: Optional[str] = None,
201+
autoescape: bool = False,
199202
) -> List[jinja2.Template]:
200203
"""Load a list of template files from disk using the given variables.
201204
@@ -211,6 +214,9 @@ def read_templates(
211214
custom_template_directory: A directory to try to look for the templates
212215
before using the default Synapse template directory instead.
213216
217+
autoescape: Whether to autoescape variables before inserting them into the
218+
template.
219+
214220
Raises:
215221
ConfigError: if the file's path is incorrect or otherwise cannot be read.
216222
@@ -234,7 +240,7 @@ def read_templates(
234240
search_directories.insert(0, custom_template_directory)
235241

236242
loader = jinja2.FileSystemLoader(search_directories)
237-
env = jinja2.Environment(loader=loader, autoescape=True)
243+
env = jinja2.Environment(loader=loader, autoescape=autoescape)
238244

239245
# Update the environment with our custom filters
240246
env.filters.update(

synapse/config/saml2_config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ def read_config(self, config, **kwargs):
169169
saml2_config.get("saml_session_lifetime", "15m")
170170
)
171171

172+
# We enable autoescape here as the message may potentially come from a
173+
# remote resource
174+
self.saml2_error_html_template = self.read_templates(
175+
["saml_error.html"], saml2_config.get("template_dir"), autoescape=True
176+
)[0]
177+
172178
def _default_saml_config_dict(
173179
self, required_attributes: set, optional_attributes: set
174180
):

0 commit comments

Comments
 (0)