The critical insight here isn't the specific payloads — SVG foreignObject, MathML annotation-xml, preserved CSS @import — but the fundamental assumption these vulnerabilities expose: that HTML sanitization is a property of content rather than a property of content within a specific parse context. The library sanitizes a string, then that string gets serialized (written to innerHTML, passed through templates, stored and retrieved), and when the browser parses it again, the sanitization context is gone. Every innerHTML assignment, template interpolation, or state hydration is a reparse event that can invalidate the library's security decisions. The pipeline fixes for cache mutation and DOM parent/child cycles reveal the implementation was built on assumptions that don't hold under real-world DOM manipulation — the sanitizer assumed a controlled content lifecycle that production code systematically violates.
Beyond the technical failure, the API design itself is the vulnerability. Framing sanitize=True as the 'safe path' and documenting foreignObject support as a feature of custom policies communicates that security is a configuration option, not an irreducible default. Developers under deadline pressure will reach for 'advanced configurations' because the library explicitly endorses them. This mental model — security as a dial you can turn up or down — is more dangerous than any single CVE because it propagates through tutorials, Stack Overflow answers, and inherited codebases. A developer who copied a custom policy configuration in 2023 is still running that configuration today, possibly unaware the CVE exists. The patch exists; the remediation does not propagate automatically.
For defenders: verify whether your codebase uses custom sanitization policies, particularly anything that preserves SVG namespaces, MathML, or CSS @import rules. If it does, treat that configuration as a known vulnerability until reviewed. Even if you use the default sanitize=True, be aware that the sanitization guarantee applies only to the moment of sanitization — any subsequent reparse (innerHTML assignment, template rendering, state restoration) can invalidate it. Consider whether your use case actually requires the flexibility that created these vulnerabilities, or whether stricter constraints would reduce your exposure surface.