Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Strip overlong OpenGraph data from url preview #6331

Merged
merged 3 commits into from Nov 5, 2019

Conversation

richvdh
Copy link
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
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
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)

tests/rest/media/v1/test_url_preview.py Show resolved Hide resolved
richvdh and others added 2 commits November 5, 2019 16:46
Co-Authored-By: Brendan Abolivier <babolivier@matrix.org>
Co-Authored-By: Erik Johnston <erik@matrix.org>
@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.

None yet

3 participants