Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: evaluated page title content #3684

Merged
merged 4 commits into from
Nov 18, 2022
Merged

fix: evaluated page title content #3684

merged 4 commits into from
Nov 18, 2022

Conversation

SychO9
Copy link
Member

@SychO9 SychO9 commented Nov 18, 2022

Changes proposed in this pull request:
Properly escapes HTML entities when setting page titles. Otherwise, any decoded title content is evaluated as HTML code.

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
@SychO9 SychO9 requested a review from a team as a code owner November 18, 2022 13:06
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Copy link
Member

@clarkwinkelmann clarkwinkelmann left a comment

Choose a reason for hiding this comment

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

As mentioned on Discord I don't really like the use of innerHTML since its behavior on <title> isn't precisely described in the official web spec, but I'm hopeful we will be able to drop it in a future release once #3685 is fixed.

I have not tested this specific PR but I played around with the same changes on my dev-main install and the changes proposed work well in my local tests.

SychO9 and others added 2 commits November 18, 2022 18:17
Co-authored-by: David Wheatley <hi@davwheat.dev>
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
@SychO9 SychO9 merged commit 690de9c into main Nov 18, 2022
@SychO9 SychO9 deleted the sm/fix-title-evaluation branch November 18, 2022 21:09
SychO9 added a commit that referenced this pull request Nov 18, 2022
* fix: evaluated page title content
* chore: add comment
* chore: use DOMParser instead
* fix: use `innerHTML` for the actual value

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Co-authored-by: David Wheatley <hi@davwheat.dev>
SychO9 added a commit that referenced this pull request Nov 18, 2022
* fix: evaluated page title content
* chore: add comment
* chore: use DOMParser instead
* fix: use `innerHTML` for the actual value

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Co-authored-by: David Wheatley <hi@davwheat.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants