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

Strip overlong OpenGraph data from url preview#6331

Merged
richvdh merged 3 commits intodevelopfrom
rav/url_preview_limit_title
Nov 5, 2019
Merged

Strip overlong OpenGraph data from url preview#6331
richvdh merged 3 commits intodevelopfrom
rav/url_preview_limit_title

Conversation

@richvdh
Copy link
Copy Markdown
Member

@richvdh richvdh commented Nov 5, 2019

... to stop people causing DoSes with malicious web pages

... to stop people causing DoSes with malicious web pages
@richvdh richvdh requested a review from a team November 5, 2019 15:51
Copy link
Copy Markdown
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice if we truncated long titles, but this works for now

b"<title>" + b"x" * 2000 + b"</title>"
b'<meta property="og:description" content="hi" />'
b"</head></html>"
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(You can use multiline b"""....""" byte quotes fwiw)

Comment thread tests/rest/media/v1/test_url_preview.py
Comment thread synapse/rest/media/v1/preview_url_resource.py Outdated
Comment thread synapse/rest/media/v1/preview_url_resource.py
@richvdh richvdh merged commit 02f9990 into develop Nov 5, 2019
@richvdh richvdh deleted the rav/url_preview_limit_title branch November 8, 2019 11:36
babolivier pushed a commit that referenced this pull request Sep 1, 2021
* commit '02f99906f':
  Apply suggestions from code review
  Strip overlong OpenGraph data from url preview
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants