This vulnerability isn't a coding error — it's an architectural hazard created by a transformation pipeline where one stage's sanitized output feeds into another stage's transformation without a re-sanitization contract. The quote character rewriting happened to already-sanitized HTML output, not raw Markdown or an unsanitized intermediate state. The sanitization worked. The quote rewriter worked. But the composition of working parts created a failure mode that neither component was designed to prevent.
The vulnerability lives in the handoff between stages, not in any single stage's logic. The quote rewriter had no reason to suspect its input was already sanitized HTML — it was doing string manipulation, likely a UX fix for curly quotes in code blocks. The sanitizer had no mechanism to declare its output "this has been sanitized and must not be transformed without re-sanitization." Neither developer made an error given their local context. The system as designed created the condition where this interaction was possible.
The CSP bypass via same-origin JavaScript gadgets adds another layer. This wasn't just DOM text injection — it was weaponizing the application's own rich interaction surface. CSP exists precisely to prevent this, yet the gadget pattern shows CSP is a mitigation, not a solution, when your application has enough interactive surface for gadgets to exist. GitHub's interactive surface is enormous by design, which means gadgetable components are a structural guarantee, not a possibility.
The propagation vector (payload spreads where the victim has write access) means the blast radius isn't bounded by where attacker and victim intersect — it's bounded by the victim's permissions.
For remediation: the question isn't just "patch the quote rewriter." It's whether GitHub's pipeline architecture now has an explicit invariant that sanitized output cannot be transformed and re-rendered without re-sanitization, and whether that invariant is enforced by tooling, not just developer discipline. The real architectural question is what prevents this class of composition vulnerabilities across any rendering system with multiple transformation stages.
Two concrete things to check in your own systems: first, audit every transformation stage for the implicit assumption "my input is already safe" — those assumptions are where composition hazards form. Second, treat gadget hunting as a first-class security concern with dedicated tooling, not just code review, because gadgets exploit the gap between what sanitizer authors think about (parsing) and what component authors think about (local context).