Repository navigation
deps: Bump AngleSharp and HtmlSanitizer - #540
Merged
Merged
Conversation
Bumps AngleSharp from 1.10.5 to 1.11.0 Bumps HtmlSanitizer from 11.0.26 to 11.0.74 --- updated-dependencies: - dependency-name: AngleSharp dependency-version: 1.11.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: HtmlSanitizer dependency-version: 11.0.74 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Contributor
Author
LabelsThe following labels could not be found: Please fix the above issues or remove invalid values from |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Updated AngleSharp from 1.10.5 to 1.11.0.
Release notes
Sourced from AngleSharp's releases.
1.11.0
Released on Tuesday, November 24 2026.
What's Changed
:nth-child(),:nth-last-child(),:only-child, the sibling combinators (+,~) and[attr~=value](up to 70% less time)previousElementSibling,nextElementSibling), which usually no longer scans the parent's childrenMutationObserveris activechildren, which is only gathered again once the child list changedimgelements to request nothing by themselvesvalueof aninputortextareanot moving the cursor to its endclick()dispatching itsclickevent later instead of before it returnsclick()on a checkbox or radio button not checking it (and not firinginputandchange)stopPropagation()in a capturing listener of an element still running its bubbling listenersform.elementsof a form not in the document being emptytext/css(e.g.text/html) being applied in standards modetext/plain) never completing, i.e. noloadeventsetEndof a new range moving its start along, andsetStartBefore(and the like) not collapsing a range they reversetoString()andcloneContents()include text outside the rangeRange.toString()taking the whole text of adjacent text nodes for each of themcloneContents()andextractContents()of a range in the document itself throwingsplitTextalso moved the start where the end belonged)NodeIteratorreturning the wrong node after its filter removed the node it looked atcreateElementNSaccepting qualified names with an empty prefix or local name (e.g.:div)nth-childselector not accepting some valid combinations (#1420) @bardropTextSource.ReadMemory()returning pooled memory that could change after further reads, encoding changes, or disposal; direct underlying-source reads still borrow memory (#1418)formwithmethod="dialog"navigating instead of closing its dialog (with the value of the submitter asreturnValue)showModal()of an open or a disconnected dialog not throwing anInvalidStateErrortemplaterunning while it is parsedinnerHTMLof atemplatenot serializing its contentshowPopover()of a shown popover throwing instead of doing nothingattachShadow()of a shadow host throwing anInvalidStateErrorinstead of aNotSupportedErrorshadowRootgiving scripts a closed shadow root (C# still gets it viaShadowRoot)badInput) once it had an invalid valuedate,month,week,time,datetime-local,number,rangeandcolorlabelsof form controls,meterandprogressalways being emptylabel.controlnot finding the control a label withoutforcontains, and finding a hidden inputformEnctypeof inputs and buttons being exposed asformEncTypeto scriptstoDataURL()of a canvas giving just the base64 of the image instead of adata:URLtypeof amenunot beingtoolbarby defaultfocus()moving the focus (and firingfocusandblur) only in a later tasktemplatebelonging to its document instead of an inert one (template.content.ownerDocument)clickevent a script dispatched not running the activation behaviorsubmitevent of a form submission not being trustednomodulerunning even though module scripts are supporteddatetime-localvalue without seconds being sanitized to an empty stringloadevent of a document not waiting for what started loading after the document was parsed but before it finished loading... (truncated)
Commits viewable in compare view.
Updated HtmlSanitizer from 11.0.26 to 11.0.74.
Release notes
Sourced from HtmlSanitizer's releases.
11.0.74
Security hardening
Style declarations that the CSS parser does not read back are no longer kept
SanitizeStylewrote AngleSharp.Css's normalized text into thestyleattribute before checking anything, and then checked only the declarations it read back from that text. A declaration that did not read back stayed in the attribute without being checked at all:AllowedCssProperties,DisallowCssPropertyValueand the URL checks were never applied to it.The sanitizer now fails closed in both places this could happen. If nothing reads back, the attribute is removed. If the declarations that read back do not account for the whole attribute text, the block is rewritten from those declarations even when none of them had to be changed, so the unchecked remainder goes with it.
The default configuration is not affected: AngleSharp.Css reads back everything it serializes, over a sweep of 56 properties by 71 values of which 910 pairs parsed. Reaching the gap takes a CSS parser that is stricter than that serializer, which a custom
IDeclarationFactoryor aHtmlParserFactorywith a non-default CSS configuration can introduce — a parser refusing values with a backslash, for instance, acceptsfont-family: 'a"b'as written but refuses the"a\"b"it serializes to. Upgrade if you configure either of those.One side note for custom formatters: a
StyleFormatterwhose output does not serialize identically after being parsed again now has its declaration blocks rewritten with the default formatting.Performance
Tag and comment removal is applied one parent at a time
Removing disallowed tags and comments node by node is quadratic on wide input, because AngleSharp locates a child inside its parent by scanning the child list. Removal decisions are now collected first and each affected parent's child list is rebuilt in one pass. On 320k siblings,
SanitizeDomgoes from 88.9 s to 0.6 s for comments and from 229.7 s to 0.5 s for unwrapping withKeepChildNodes. Parents with 32 children or fewer take exactly the path they took before, so ordinary documents are unaffected.Two parts of this are still outstanding, both of them unchanged in this release:
Sanitizeremains quadratic on wide input for a reason outside this code: AngleSharp'sNode.ToHtmlscans forNextSiblingper childless node, which costs 57 s on 2.5 MB of clean, fully allowed markup with nothing removed at all. This needs fixing upstream.RemovingTagandRemovingCommentare raised before anything is removedBoth events are still raised for every node in document order and can still cancel. The one change a handler can observe is that it now runs before any node has been removed, rather than between removals. A handler that inspected the surrounding document while removals were in progress sees the untouched document instead.
Dependencies
Credits
vincentparrett for reporting both the unchecked style declarations and the quadratic removal.
Commits viewable in compare view.
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 rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill 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 versionwill 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 dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)