CVE-2026-33170: Ruby String Subclass State Loss

Missing state propagation when creating new string subclass instances. When wrapping the result of `super` in a new instance via `self.class.new(...)` in a `String` subclass, security-critical variables (like `@html_safe` in `SafeBuffer`) are lost because `initialize` resets them to defaults. This can cause explicit unsafe flags to be dropped during string o

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0Rubyβ
greprules fetch cve-2026-33170-ruby-string-subclass-state-loss --engine opengrep

Description

Missing state propagation when creating new string subclass instances. When wrapping the result of `super` in a new instance via `self.class.new(...)` in a `String` subclass, security-critical variables (like `@html_safe` in `SafeBuffer`) are lost because `initialize` resets them to defaults. This can cause explicit unsafe flags to be dropped during string o