@@ -1931,4 +1931,60 @@ describe('sanitizeHtml', function() {
19311931 ) , '!<xmp></xmp><svg/onload=prompt`xs`></xmp>!'
19321932 ) ;
19331933 } ) ;
1934+
1935+ describe ( 'CVE-2026-44990 regression and raw-text edge cases' , function ( ) {
1936+ it ( 'should escape raw-text inner content when xmp tag is disallowed and discarded under custom nonTextTags' , function ( ) {
1937+ assert . strictEqual (
1938+ sanitizeHtml ( '<xmp><script>alert(1)</script></xmp>' , {
1939+ nonTextTags : [ 'script' , 'style' ]
1940+ } ) ,
1941+ '<script>alert(1)</script>'
1942+ ) ;
1943+ } ) ;
1944+
1945+ it ( 'should escape raw-text inner content when script tag is disallowed and discarded under empty nonTextTags' , function ( ) {
1946+ assert . strictEqual (
1947+ sanitizeHtml ( '<script><svg onload=alert(1)></script>' , {
1948+ nonTextTags : [ ]
1949+ } ) ,
1950+ '<svg onload=alert(1)>'
1951+ ) ;
1952+ } ) ;
1953+
1954+ it ( 'should escape raw-text inner content when textarea tag is disallowed and discarded' , function ( ) {
1955+ assert . strictEqual (
1956+ sanitizeHtml ( '<textarea><script>alert(1)</script></textarea>' , {
1957+ nonTextTags : [ ]
1958+ } ) ,
1959+ '<script>alert(1)</script>'
1960+ ) ;
1961+ } ) ;
1962+
1963+ it ( 'should escape raw-text inner content when style tag is disallowed and discarded' , function ( ) {
1964+ assert . strictEqual (
1965+ sanitizeHtml ( '<style><a onload=alert(1)></style>' , {
1966+ nonTextTags : [ ]
1967+ } ) ,
1968+ '<a onload=alert(1)>'
1969+ ) ;
1970+ } ) ;
1971+
1972+ it ( 'should handle malformed or unclosed raw-text tags correctly' , function ( ) {
1973+ assert . strictEqual (
1974+ sanitizeHtml ( '<xmp><script>alert(1)' , {
1975+ nonTextTags : [ 'script' , 'style' ]
1976+ } ) ,
1977+ '<script>alert(1)'
1978+ ) ;
1979+ } ) ;
1980+
1981+ it ( 'should handle sibling raw-text elements correctly without leaking states' , function ( ) {
1982+ assert . strictEqual (
1983+ sanitizeHtml ( '<noembed><script>alert(1)</script></noembed><noscript><style>body{}</style></noscript>' , {
1984+ nonTextTags : [ ]
1985+ } ) ,
1986+ 'alert(1)body{}'
1987+ ) ;
1988+ } ) ;
1989+ } ) ;
19341990} ) ;
0 commit comments