mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 02:44:50 -04:00
Ensure that HTML pages served from Synapse include headers to avoid embedding.
This commit is contained in:
parent
0fc5575c5b
commit
ea26e9a98b
10 changed files with 103 additions and 94 deletions
|
@ -35,7 +35,7 @@ from typing_extensions import TypedDict
|
|||
from twisted.web.client import readBody
|
||||
|
||||
from synapse.config import ConfigError
|
||||
from synapse.http.server import finish_request
|
||||
from synapse.http.server import respond_with_html
|
||||
from synapse.http.site import SynapseRequest
|
||||
from synapse.logging.context import make_deferred_yieldable
|
||||
from synapse.push.mailer import load_jinja2_templates
|
||||
|
@ -144,15 +144,10 @@ class OidcHandler:
|
|||
access_denied.
|
||||
error_description: A human-readable description of the error.
|
||||
"""
|
||||
html_bytes = self._error_template.render(
|
||||
html = self._error_template.render(
|
||||
error=error, error_description=error_description
|
||||
).encode("utf-8")
|
||||
|
||||
request.setResponseCode(400)
|
||||
request.setHeader(b"Content-Type", b"text/html; charset=utf-8")
|
||||
request.setHeader(b"Content-Length", b"%i" % len(html_bytes))
|
||||
request.write(html_bytes)
|
||||
finish_request(request)
|
||||
)
|
||||
respond_with_html(request, 400, html)
|
||||
|
||||
def _validate_metadata(self):
|
||||
"""Verifies the provider metadata.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue