Skip to content

Bump HtmlSanitizer from 8.0.718 to 11.0.26 - #30

Open
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/nuget/src/Vulnerabilities/HtmlSanitizer-11.0.26
Open

dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/nuget/src/Vulnerabilities/HtmlSanitizer-11.0.26

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Nov 10, 2026

Copy link
Copy Markdown
Contributor

Updated HtmlSanitizer from 8.0.718 to 11.0.26.

Release notes

Sourced from HtmlSanitizer's releases.

11.0.26

Fix strong-name signing

11.0.16

Breaking changes

New IHtmlSanitizer.NamedPropertyTags member

Classes that implement IHtmlSanitizer directly, such as wrappers and decorators, must add the new NamedPropertyTags member. Mocks created with Moq, NSubstitute, and similar libraries are unaffected.

Security hardening

name is removed from certain elements

The name attribute is now removed from embed, form, iframe, img, and object elements by default.

Browsers expose the names of these elements as properties of document and window. For example, <img name="getElementById"> could replace document.getElementById on the page displaying the sanitized output and break its scripts. This is known as DOM clobbering.

The name attribute is still retained on other elements, including <a name> anchors, <map name> image maps, and form fields.

You can configure the affected elements through the new NamedPropertyTags set on HtmlSanitizer, HtmlSanitizerOptions, and HtmlSanitizerDefaults. To restore the previous behavior:

sanitizer.NamedPropertyTags.Clear();

You can also cancel individual removals in the RemovingAttribute event. If you allow iframe elements and use their names as link targets, remove iframe from the set.

contenteditable is no longer allowed by default

An editable region gives an attacker a paste target on the host page. In Firefox, pasted <style> elements are retained, allowing CSS that the sanitizer would otherwise strip to affect the whole page.

To allow the attribute again:

sanitizer.AllowedAttributes.Add("contenteditable");

Dependencies

  • AngleSharp: 1.9.0 → 1.9.1
  • AngleSharp.Css: 1.3.1 → 1.3.2

Credits for finding the name and contenteditable issues

Gareth Heyes (PortSwigger Research)

See also:
https://portswigger.net/research/css-the-bomb-inside-your-inbox
https://portswigger.net/research/smashing-the-token-limit

10.0.1120

  • Rename AllowedCssClasses to AllowedClasses; HtmlSanitizerOptions defaults
  • HtmlSanitizerOptions collections now start pre-populated from
    HtmlSanitizerDefaults, matching the parameterless HtmlSanitizer() constructor. See #​570
  • Renamed AllowedCssClasses to AllowedClasses for consistency with
    HtmlSanitizer.AllowedClasses.
  • Replaced CreateDefault() with Empty(), which now returns the blank-slate
    instance instead.

10.0.1037-beta

First beta of a major version. Please test against your usage before GA — see Breaking changes below, especially if you have a custom IHtmlSanitizer implementation or construct HtmlSanitizerOptions yourself.

Breaking changes

  • IHtmlSanitizer gained new members. Anything implementing the interface directly (not just consuming HtmlSanitizer) needs updating: StyleFormatter, EncodeComment, EncodeLiteralTextElementContent, UriListAttributes, AllowCssCustomProperties, the FilterCssRule event, both SanitizeFragment overloads, and SanitizeDocument(Stream, ...).
  • HtmlSanitizerOptions collections are now pre-populated by default. new HtmlSanitizerOptions() now seeds every collection from HtmlSanitizerDefaults — the same defaults new HtmlSanitizer() uses — instead of starting empty (#​570). If you build HtmlSanitizerOptions yourself, audit it: code that relied on the old emptiness to build a minimal allowlist (e.g. setting only AllowedTags and expecting everything else to stay locked down) now gets the full default attribute/scheme/URI-attribute set for anything it doesn't explicitly reassign. Use the new HtmlSanitizerOptions.Empty() for the old blank-slate behavior.
  • HtmlSanitizerOptions.AllowedCssClasses renamed to AllowedClasses, matching HtmlSanitizer.AllowedClasses / IHtmlSanitizer.AllowedClasses. It's also now case-insensitive by default like every other collection on the class (it wasn't before — a latent bug).
  • SanitizeDom(string) no longer preserves attributes on the synthetic <html>/<head>/<body> wrapper elements it creates. Fixes an attribute-injection bypass (e.g. <body onload=alert(1)>) for callers that serialize more of the returned document than dom.Body.ChildNodes.
  • AssemblyVersion bumped to 10.0.0.0. Update any binding redirects pinned to 9.0.0.0.

New

  • SanitizeFragment(html, context, ...) — sanitize a fragment as if inserted into a given element/tag context (e.g. tr, ul) instead of always parsing under <body>, so context-dependent markup like a lone <th> survives.
  • SanitizeDocument(Stream, ...) overload.
  • UriListAttributes — screens attributes holding a list of URLs (srcset, ping) entry-by-entry, rather than as one URL.
  • AllowCssCustomProperties — opt in to allowing CSS custom properties (--*).
  • StyleFormatter, EncodeComment, EncodeLiteralTextElementContent — now configurable on the sanitizer/interface.
  • FilterCssRule event, raised per CSS rule during sanitization.
  • HtmlSanitizerOptions.Empty() for building an allowlist from scratch.

Security / stricter sanitization

Output for some previously-passing input is now more restrictive:

  • cite and longdesc are now screened as URL attributes.
  • @​font-face and @​import at-rule declarations are now sanitized.
  • srcdoc content is now recursively sanitized, and URI-list attributes (srcset, ping) are screened per-entry.
  • <style type=""> content is now sanitized (previously an empty type could skip CSS filtering).
  • Fixed CSS var-in-shorthand handling and a resolved-URI check.
  • Fixed multiple enumeration of URLs (#​625) and #​629.
  • Foreign-namespace contexts (SVG/MathML) are now rejected by SanitizeFragment rather than silently mis-parsed under HTML rules.

Dependencies

  • AngleSharp 1.7.1 → 1.7.2, AngleSharp.Css 1.0.1 → 1.0.2.

9.2.1039

Fix attribute bypass in SanitizeDom(string) wrapper elements

9.2.995

  • AngleSharp dependency updated from 1.7.0 to 1.7.1 (4515e1f)
  • Sanitization enhancements for URI attributes
    • Added cite and longdesc attributes to URL sanitization (e47862e)
    • Enhanced sanitization of srcdoc content and attributes holding URI lists (edb2633)
  • CSS/style handling improvements
    • Added sanitization of CSS declarations in style elements with type="" attribute (0592f1e)
    • Fixed sanitization of CSS @​font-face and @​import at-rules (1d33413)
  • Bug fixes
    • Fixed resolved URI check validation (7f379ef)
    • Fixed CSS variable-in-shorthand sanitization (b8e9844)
    • Fixed issue #​629 (e0deb7b)
    • Multiple SonarCloud code quality issues resolved (ec1e786, 2d95200)
  • Test improvements
    • Refactored test suite for style element sanitization (0592f1e)
    • Improved performance of ThreadTest (0ab33ba)
  • Documentation
    • Added XML code usage examples for HtmlSanitizerOptions properties (#​632)

9.1.982

Fix multiple enumeration of URLs (fixes #​625)

9.1.981

Update NuGet packages

9.1.974

Add FilterCssRule event (fixes #​622)

9.1.973

Update to AngleSharp 1.6.0 and AngleSharp.Css 1.0.0

9.0.892

Sanitize contents of template tag

9.0.889

Update NuGet packages

9.0.886

Target net47 (fixes #​580)

9.0.884

#​574

9.0.881

#​572
#​573

9.0.876

#​565

9.0.873

Add FilterUrl to IHtmlSanitizer (fixes #​565)

8.1.870

#​556

8.0.865

#​542

8.0.843

Add package README file

8.0.838

Create customizable comment encoding method (fixes #​525)

8.0.811

Merge pull request #​516 from jerriep/allow-overriding-literal-text-element-encoding

8.0.795

See #​494

8.0.746

Fix #​483

8.0.744

Fix #​483

8.0.723

Fix for GHSA-43cp-6p3q-2pc4

Commits viewable in compare view.

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

---
updated-dependencies:
- dependency-name: HtmlSanitizer
  dependency-version: 11.0.26
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added .NET Pull requests that update .net code dependencies Pull requests that update a dependency file labels Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file .NET Pull requests that update .net code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants