chore(deps-dev): bump nokogiri from 1.19.4 to 1.19.5
DE
2d ago+4+4+0123456789-4-4-0123456789
Bumps nokogiri from 1.19.4 to 1.19.5.
Release notes
Sourced from nokogiri's releases.
v1.19.5 / 2026-11-01
Security
- [CRuby] (Low) Fixed a possible use-after-free when an attribute value is replaced via
Node#[]=orNode#lang=while Ruby objects still reference the attribute's children. See GHSA-3w22-6jfg-527w for more information.- [CRuby] (Low) The HTML5 serializer now escapes text inside
noscriptunless the document was parsed withparse_noscript_content_as_text: true, preventing a mutation XSS in applications that allownoscriptin sanitized HTML. A fragment now parsesnoscriptcontent the same way as its document, and raisesArgumentErrorif given a conflictingparse_noscript_content_as_text:value. Comments and raw-text elements insidenoscriptare still serialized unchanged, as the HTML standard requires, so applications that sanitize HTML and allownoscriptshould parse withparse_noscript_content_as_text: trueor removenoscriptelements. See GHSA-4p39-36wj-23h4 for more information.- [JRuby] (Low)
NONETnow blocks external DTDs and entities whose systemId uses a short-form IPv4 host such as127.1, or is an absolute path in a document parsed from a network URL. Previously Nokogiri fetched them over the network during a parse withDTDLOADorNOENT, potentially enabling SSRF. See GHSA-v995-44v6-5fqm for more information.Improved
- [CRuby] The HTML5 parser now has linear performance when parsing many attributes. Previously performance was quadratic due to two hotspots, one in detecting duplicate attributes and one in constructing the libxml2 data structures. (#3393)
@flavorjones- [CRuby] Improved XPath argument marshalling performance by using
ALLOCV_Ninstead ofrb_gc_register_address. (#3648)@jhawthornFixed
Node#namespace=now declares the namespace on the node when no declaration of its prefix is in scope there. Previously, on CRuby, a node given a namespace and then moved under an element that binds the same prefix, or the default namespace, to a different URI was serialized in that other namespace. On JRuby, the namespace was missing fromNode#namespace_definitions. (#3459, #3462)@flavorjonesXML::Readeris no longer affected by changes made to its source String after the reader is created. Previously, such a change could make the reader parse the changed String on JRuby, or changed or freed memory on CRuby with libxml2 < 2.11. (#3694)@flavorjonesNode#namespace = falsenow raisesTypeError. Previously it crashed the process on CRuby and raisedClassCastExceptionon JRuby. (#3719)@flavorjonesXML::XPathContext.newandXML::XPathContext#node=raiseTypeErrorwhen the argument is not aNode. Previously, on CRuby, most such arguments crashed the process. (#3720)@flavorjones- CSS
an+bselectors with a zero or negative step now follow the Selectors spec::nth-child(0n+3)matches only the third element (previously nothing),0n-1matches nothing instead of raisingZeroDivisionError, and-n+0/-2nmatch nothing instead of every (or every other) element.@afurm- CSS
#id,.classand attribute selectors whose value contains a quote character, such as#it\'sor[a=\'b\'], now match that value. Previously they raisedNokogiri::XML::XPath::SyntaxErroror generated an XPath query with a different meaning. An#idselector containing an escaped newline no longer drops the text after it. (#3724, #3727)@flavorjones- CSS
:contains()arguments, custom pseudo-class string arguments, and element names containing a CSS escape, such asp:contains('it\'s')ora\-b, now match. Previously they raisedNokogiri::XML::XPath::SyntaxError. An element name that is not an XML name after unescaping, such asa\!b, raisesNokogiri::CSS::SyntaxError, except as an unprefixed name in an HTML5 document, where it matches by local name. In ids, classes, attribute values, element names and string arguments, an escape for U+0000, a surrogate, or a code point above U+10FFFF now decodes to U+FFFD, and a vertical tab after a hexadecimal escape is no longer dropped, as CSS Syntax Level 3 requires. (#3728, #3729)@flavorjones- CSS attribute names containing a CSS escape, such as
[a\-b], now match. Previously they raisedNokogiri::XML::XPath::SyntaxError. An unprefixed attribute name that cannot be written as an XPath name test after unescaping, such as[\@click]or[\:class], matches an attribute with that exact name in no namespace. The HTML parsers create such attributes. A prefixed one, such as[x|a\!b], raisesNokogiri::CSS::SyntaxError. (#3732, #3735)@flavorjones- [CRuby] The HTML5 serializer escapes
<and>in attribute values as<and>, following whatwg/html#6362. Previously they were written literally. (#3529, #3741)@flavorjones- [CRuby] Reparenting removes a node's declaration of a prefix that the new parent binds to the same URI. (#3462)
@flavorjones- [CRuby] Builder now correctly builds namespaced nodes that define their own namespace when that ns prefix collides with one defined by the parent (or another ancestor). (#3458, #3461)
@flavorjones- [CRuby]
Reader.outer_xmland.inner_xmlproperly capture syntax errors. (#3558)@flavorjones- [CRuby]
XML::SAX::PushParserandHTML4::SAX::PushParserkeep parsing correctly after GC compaction relocates their SAX parser. (#3665)@zanker- [CRuby]
XML::Readerkeeps reading correctly when GC compaction runs. Previously, compaction could move the IO or String the reader was created from, and the reader then crashed or parsed the wrong bytes. (#3666, #3668)@zanker- [CRuby]
XSLT::Stylesheet#transformcalls custom XSLT extension functions correctly when GC compaction runs. Previously, after compaction moved a stylesheet that uses an extension module, a later transform raised an exception or crashed. (#3667)@jeremy- [CRuby]
XSLT::Stylesheet#transformpasses the correct params when GC compaction runs while it converts a param with#to_str. Previously, compaction could move the bytes of earlier short params, and the transform raisedRuntimeErroror silently left a param empty. (#3670)@flavorjones- [CRuby]
XML::SAX::ParserContext.ioandHTML4::SAX::ParserContext.iokeep parsing correctly after GC compaction relocates the IO. (#3669)@zanker- [CRuby]
Document#canonicalizepasses the correct inclusive namespace prefixes when it converts a prefix with#to_str, and when GC compaction runs during canonicalization. Previously, libxml2 could read freed or moved memory, and the output lost namespaces or Ruby crashed. Raising on a prefix with a null byte also no longer leaks memory. (#3714, #3750)@Priyank-gouda678@flavorjones- [CRuby]
XSLT::Stylesheet#transformcalls custom XSLT extension functions correctly when GC compaction runs during the transform. Previously, compaction could move an extension handler instance, and a later call to one of its functions raised an exception or crashed. (#3748)@flavorjones- [CRuby]
XSLT::Stylesheet#transformcalls custom XSLT extension functions correctly after an extension function runs another transform with the same stylesheet, or while another thread does. Previously, the inner or concurrent transform released extension handler instances that the other transform still used, and GC could free them. (#3748)@flavorjones- [CRuby]
XML::Reader.from_memoryaccepts an object that responds toto_str. Previously, it could raiseNokogiri::XML::SyntaxError. (#3694)@flavorjones- [CRuby]
XPathContext#evaluateno longer leaks memory when a custom XPath function handler raises an exception. (#3715, #1610)@flavorjones- [CRuby] When a custom XPath function handler raises an exception,
XPathContext#evaluatenow resets libxml2's error handlers and unregisters the custom function lookup. Previously, libxml2 could keep references to garbage-collected Ruby objects. (#3715)@flavorjones- [CRuby MacOS] Fixed an issue handling SIGINT during HTML5 parsing. (#3528, #3535)
@stevecheckoway- [CRuby] gumbo:
gumbo_parse_with_optionsno longer crashes whenstop_on_first_erroris set and the parse ends on an unknown end tag in a fragment context. This is a C API path; it is not reachable from Ruby, because Nokogiri never setsstop_on_first_error. (#3672)@jeremy- [JRuby] Fixed multiple issues with
Node#namespace_definitionsso that it now behaves identically to CRuby. (#2543, #3460)@flavorjones- [CRuby] HTML5 fragment parsing raises
TypeErrorwhen the context node or one of its ancestors is an element whosenamereturns something other than aString. Previously this could crash the process. (#3740)@flavorjones- [CRuby] HTML5 parsing no longer leaks memory when a comment follows
</body>and a<frameset>start tag follows the comment. (#3744)@flavorjones- [CRuby] An XSLT extension function that raises an exception no longer leaks memory or leaves behind a stale libxml2 error handler, which could write into a freed Ruby object. (#3718, #3721)
@Priyank-gouda678@flavorjones- [CRuby] When an IO's
readraises an exception that is not aStandardError, such asInterruptorTimeout::ExitException, parsing withXML::Document,HTML4::DocumentorXML::Readerno longer leaks memory or leaves behind a stale libxml2 error handler. (#3718, #3721)@Priyank-gouda678@flavorjones- [CRuby] Nokogiri compiles on 64-bit Windows with Ruby 4.1, which stores String and Array lengths in the new
rb_len_ttype. Previously compilation failed with an incompatible pointer type error inxml_node_set.c. (#3711)@larskanis- [CRuby]
Node#line=now raisesNoMethodErroronDocument,DTD,Attr,ElementDecl,AttributeDeclandEntityDecl, as#linealready does on all of them exceptAttr. Previously it wrote past the end of the node's memory or overwrote an unrelated field, which could crash the process. (#3737, #3738)@Priyank-gouda678@flavorjones- [JRuby]
Document#create_elementandNode.newno longer set the namespace to the document's default namespace. The namespace must be set explicitly withnamespace=or by parenting the node. (#3457, #3463)@flavorjones
... (truncated)
Changelog
Sourced from nokogiri's changelog.
v1.19.5 / 2026-11-01
Security
- [CRuby] (Low) Fixed a possible use-after-free when an attribute value is replaced via
Node#[]=orNode#lang=while Ruby objects still reference the attribute's children. See GHSA-3w22-6jfg-527w for more information.- [CRuby] (Low) The HTML5 serializer now escapes text inside
noscriptunless the document was parsed withparse_noscript_content_as_text: true, preventing a mutation XSS in applications that allownoscriptin sanitized HTML. A fragment now parsesnoscriptcontent the same way as its document, and raisesArgumentErrorif given a conflictingparse_noscript_content_as_text:value. Comments and raw-text elements insidenoscriptare still serialized unchanged, as the HTML standard requires, so applications that sanitize HTML and allownoscriptshould parse withparse_noscript_content_as_text: trueor removenoscriptelements. See GHSA-4p39-36wj-23h4 for more information.- [JRuby] (Low)
NONETnow blocks external DTDs and entities whose systemId uses a short-form IPv4 host such as127.1, or is an absolute path in a document parsed from a network URL. Previously Nokogiri fetched them over the network during a parse withDTDLOADorNOENT, potentially enabling SSRF. See GHSA-v995-44v6-5fqm for more information.Improved
- [CRuby] The HTML5 parser now has linear performance when parsing many attributes. Previously performance was quadratic due to two hotspots, one in detecting duplicate attributes and one in constructing the libxml2 data structures. (#3393)
@flavorjones- [CRuby] Improved XPath argument marshalling performance by using
ALLOCV_Ninstead ofrb_gc_register_address. (#3648)@jhawthornFixed
Node#namespace=now declares the namespace on the node when no declaration of its prefix is in scope there. Previously, on CRuby, a node given a namespace and then moved under an element that binds the same prefix, or the default namespace, to a different URI was serialized in that other namespace. On JRuby, the namespace was missing fromNode#namespace_definitions. (#3459, #3462)@flavorjonesXML::Readeris no longer affected by changes made to its source String after the reader is created. Previously, such a change could make the reader parse the changed String on JRuby, or changed or freed memory on CRuby with libxml2 < 2.11. (#3694)@flavorjonesNode#namespace = falsenow raisesTypeError. Previously it crashed the process on CRuby and raisedClassCastExceptionon JRuby. (#3719)@flavorjonesXML::XPathContext.newandXML::XPathContext#node=raiseTypeErrorwhen the argument is not aNode. Previously, on CRuby, most such arguments crashed the process. (#3720)@flavorjones- CSS
an+bselectors with a zero or negative step now follow the Selectors spec::nth-child(0n+3)matches only the third element (previously nothing),0n-1matches nothing instead of raisingZeroDivisionError, and-n+0/-2nmatch nothing instead of every (or every other) element.@afurm- CSS
#id,.classand attribute selectors whose value contains a quote character, such as#it\'sor[a=\'b\'], now match that value. Previously they raisedNokogiri::XML::XPath::SyntaxErroror generated an XPath query with a different meaning. An#idselector containing an escaped newline no longer drops the text after it. (#3724, #3727)@flavorjones- CSS
:contains()arguments, custom pseudo-class string arguments, and element names containing a CSS escape, such asp:contains('it\'s')ora\-b, now match. Previously they raisedNokogiri::XML::XPath::SyntaxError. An element name that is not an XML name after unescaping, such asa\!b, raisesNokogiri::CSS::SyntaxError, except as an unprefixed name in an HTML5 document, where it matches by local name. In ids, classes, attribute values, element names and string arguments, an escape for U+0000, a surrogate, or a code point above U+10FFFF now decodes to U+FFFD, and a vertical tab after a hexadecimal escape is no longer dropped, as CSS Syntax Level 3 requires. (#3728, #3729)@flavorjones- CSS attribute names containing a CSS escape, such as
[a\-b], now match. Previously they raisedNokogiri::XML::XPath::SyntaxError. An unprefixed attribute name that cannot be written as an XPath name test after unescaping, such as[\@click]or[\:class], matches an attribute with that exact name in no namespace. The HTML parsers create such attributes. A prefixed one, such as[x|a\!b], raisesNokogiri::CSS::SyntaxError. (#3732, #3735)@flavorjones- [CRuby] The HTML5 serializer escapes
<and>in attribute values as<and>, following whatwg/html#6362. Previously they were written literally. (#3529, #3741)@flavorjones- [CRuby] Reparenting removes a node's declaration of a prefix that the new parent binds to the same URI. (#3462)
@flavorjones- [CRuby] Builder now correctly builds namespaced nodes that define their own namespace when that ns prefix collides with one defined by the parent (or another ancestor). (#3458, #3461)
@flavorjones- [CRuby]
Reader.outer_xmland.inner_xmlproperly capture syntax errors. (#3558)@flavorjones- [CRuby]
XML::SAX::PushParserandHTML4::SAX::PushParserkeep parsing correctly after GC compaction relocates their SAX parser. (#3665)@zanker- [CRuby]
XML::Readerkeeps reading correctly when GC compaction runs. Previously, compaction could move the IO or String the reader was created from, and the reader then crashed or parsed the wrong bytes. (#3666, #3668)@zanker- [CRuby]
XSLT::Stylesheet#transformcalls custom XSLT extension functions correctly when GC compaction runs. Previously, after compaction moved a stylesheet that uses an extension module, a later transform raised an exception or crashed. (#3667)@jeremy- [CRuby]
XSLT::Stylesheet#transformpasses the correct params when GC compaction runs while it converts a param with#to_str. Previously, compaction could move the bytes of earlier short params, and the transform raisedRuntimeErroror silently left a param empty. (#3670)@flavorjones- [CRuby]
XML::SAX::ParserContext.ioandHTML4::SAX::ParserContext.iokeep parsing correctly after GC compaction relocates the IO. (#3669)@zanker- [CRuby]
Document#canonicalizepasses the correct inclusive namespace prefixes when it converts a prefix with#to_str, and when GC compaction runs during canonicalization. Previously, libxml2 could read freed or moved memory, and the output lost namespaces or Ruby crashed. Raising on a prefix with a null byte also no longer leaks memory. (#3714, #3750)@Priyank-gouda678@flavorjones- [CRuby]
XSLT::Stylesheet#transformcalls custom XSLT extension functions correctly when GC compaction runs during the transform. Previously, compaction could move an extension handler instance, and a later call to one of its functions raised an exception or crashed. (#3748)@flavorjones- [CRuby]
XSLT::Stylesheet#transformcalls custom XSLT extension functions correctly after an extension function runs another transform with the same stylesheet, or while another thread does. Previously, the inner or concurrent transform released extension handler instances that the other transform still used, and GC could free them. (#3748)@flavorjones- [CRuby]
XML::Reader.from_memoryaccepts an object that responds toto_str. Previously, it could raiseNokogiri::XML::SyntaxError. (#3694)@flavorjones- [CRuby]
XPathContext#evaluateno longer leaks memory when a custom XPath function handler raises an exception. (#3715, #1610)@flavorjones- [CRuby] When a custom XPath function handler raises an exception,
XPathContext#evaluatenow resets libxml2's error handlers and unregisters the custom function lookup. Previously, libxml2 could keep references to garbage-collected Ruby objects. (#3715)@flavorjones- [CRuby MacOS] Fixed an issue handling SIGINT during HTML5 parsing. (#3528, #3535)
@stevecheckoway- [CRuby] gumbo:
gumbo_parse_with_optionsno longer crashes whenstop_on_first_erroris set and the parse ends on an unknown end tag in a fragment context. This is a C API path; it is not reachable from Ruby, because Nokogiri never setsstop_on_first_error. (#3672)@jeremy- [JRuby] Fixed multiple issues with
Node#namespace_definitionsso that it now behaves identically to CRuby. (#2543, #3460)@flavorjones- [CRuby] HTML5 fragment parsing raises
TypeErrorwhen the context node or one of its ancestors is an element whosenamereturns something other than aString. Previously this could crash the process. (#3740)@flavorjones- [CRuby] HTML5 parsing no longer leaks memory when a comment follows
</body>and a<frameset>start tag follows the comment. (#3744)@flavorjones- [CRuby] An XSLT extension function that raises an exception no longer leaks memory or leaves behind a stale libxml2 error handler, which could write into a freed Ruby object. (#3718, #3721)
@Priyank-gouda678@flavorjones- [CRuby] When an IO's
readraises an exception that is not aStandardError, such asInterruptorTimeout::ExitException, parsing withXML::Document,HTML4::DocumentorXML::Readerno longer leaks memory or leaves behind a stale libxml2 error handler. (#3718, #3721)@Priyank-gouda678@flavorjones- [CRuby] Nokogiri compiles on 64-bit Windows with Ruby 4.1, which stores String and Array lengths in the new
rb_len_ttype. Previously compilation failed with an incompatible pointer type error inxml_node_set.c. (#3711)@larskanis- [CRuby]
Node#line=now raisesNoMethodErroronDocument,DTD,Attr,ElementDecl,AttributeDeclandEntityDecl, as#linealready does on all of them exceptAttr. Previously it wrote past the end of the node's memory or overwrote an unrelated field, which could crash the process. (#3737, #3738)@Priyank-gouda678@flavorjones- [JRuby]
Document#create_elementandNode.newno longer set the namespace to the document's default namespace. The namespace must be set explicitly withnamespace=or by parenting the node. (#3457, #3463)@flavorjones
... (truncated)
Commits
724ef47version bump to v1.19.560e801bMerge pull request #3752 from sparklemotion/card-931-v1-19-5-backportce1a138ci: bump ruby/setup-ruby to v1.335.03254e40test: skip compaction tests before Ruby 3.3 to fix OOM in Ruby 3.2 CI jobs (#...729d578style(rubocop): Lint/Void in entity reference teste62615fdoc: add the v1.19.5 Security CHANGELOG entries97f41b6fix: JRubyNONETbypass in external entity resolutionc6c0bfffix(html5): escapenoscripttext when scripting is disabledfeaed3cfix(CRuby): avoid UAF when replacing an attribute value3ea6023doc: fix up CHANGELOG after cherry-picking #3393, #3460, #3535 and #3648- Additional 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)
You can disable automated security fix PRs for this repo from the Security Alerts page.
Summary by cubic
Bumps nokogiri from 1.19.4 to 1.19.5 in Gemfile.lock. This patch release includes fixes for three low-severity security advisories and several bug fixes for CRuby and JRuby.