Skip to content

Ensure <li>s are wrapped in a <ol> or <ul> after sanitizing HTML #13544

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

diox
Copy link
Member

@diox diox commented Apr 18, 2025

Fixes mozilla/addons#14989

Context

This matters when displaying the versions page, where each version is in a <li> already, and developers can have release notes containing <li> of their own. This can be seen:

(Look at the output carefully, the HTML from the footer is duplicated, the "clone" appearing either in the sidebar or on top of the existing footer)

Testing

You have to manually craft HTML with <li> and no parent <ul> and get it passed to our sanitize functions to test this. That is harder to achieve now that we have markdown, so best to modify the entry in the database, or pick one that was already broken, or test with https://localhost:3000/en-US/firefox/addon/ratopuse-weasp-vulturkal/versions/ with the patch applied and unapplied to see the difference. Or look at the unit tests.

This matters when displaying the versions page, where each version
is in a <li> already, and developers can have release notes
containing <li> of their own.
Copy link

codecov bot commented Apr 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.29%. Comparing base (8173acd) to head (dc0c709).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #13544   +/-   ##
=======================================
  Coverage   98.28%   98.29%           
=======================================
  Files         267      268    +1     
  Lines       10630    10644   +14     
  Branches     3247     3255    +8     
=======================================
+ Hits        10448    10462   +14     
  Misses        169      169           
  Partials       13       13           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@diox diox requested review from a team and eviljeff and removed request for a team April 18, 2025 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant