voidzero-dev / voidzero-dev/oxc-angular-compiler

security: missing security-context entries for SVG animation, iframe i18n, and namespaced SVG script elements

Aperta
#315 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug rust
Lingua principale
Rust
Stelle
228
Fork
20
Merge medio
1g 15h
PR unite (30g)
36

Descrizione

Summary

Three security-context tables in OXC are missing entries that landed in packages/compiler since v21.2.2. Each gap creates a small XSS or unsanitized-binding surface in templates compiled by OXC.

Sub-gaps

1. iframe|src missing from TRUSTED_TYPES_SINKS

Upstream: packages/compiler/src/schema/trusted_types_sinks.ts:28 (added in 78dea55351).

ngc registers iframe|src so the i18n translation pipeline cannot rewrite the src attribute on iframes — translated strings flowing into iframe sources is an XSS vector. OXC has no trusted_types_sinks.rs equivalent in crates/oxc_angular_compiler/src/schema/.

Required work: create crates/oxc_angular_compiler/src/schema/trusted_types_sinks.rs mirroring upstream's set, wire into the i18n extractor's isTranslatableAttribute check.

2. SVG animation attributes missing from URL security context

Upstream: packages/compiler/src/schema/dom_security_schema.ts:108-113 (added in 08d36599d7).

ngc registers animate|to, animate|from, animate|values, and set|to as SecurityContext.URL, ensuring [attr.to]="..." on an SVG <animate> element runs through URL sanitization. OXC at crates/oxc_angular_compiler/src/schema/dom_security_schema.rs:30-110 registers only animate|attributename (and similar non-value attrs), leaving the value attrs in the default no-binding context — they bypass sanitization.

Required work: add the four entries to the URL group in dom_security_schema.rs.

3. Namespaced SVG script elements not classified as script-like

Upstream: packages/compiler/src/template_parser/template_preparser.ts:17-18,41-43 (added in 90494cd909).

ngc's preparseElement treats both script and :svg:script as script elements (and :svg:style as a style element), stripping their content during template compilation. OXC has no template-preparser equivalent — <svg:script> survives template compilation as a normal element, executing at runtime.

Required work: introduce a template-preparser pass (or extend the existing element classification) under crates/oxc_angular_compiler/src/parser/ that recognizes the SVG-namespaced variants.

Why this matters

Each gap is small, but together they widen OXC's attack surface vs ngc:

  • Sub-gap 1 lets an i18n translation team inject iframe content
  • Sub-gap 2 lets SVG animation attributes accept unsanitized URLs (javascript: etc.)
  • Sub-gap 3 lets SVG script elements execute

All three fixes are data-table or detection-logic additions, no architectural work.

Reference

  • Trusted types: packages/compiler/src/schema/trusted_types_sinks.ts
  • DOM security schema: packages/compiler/src/schema/dom_security_schema.ts
  • Template preparser: packages/compiler/src/template_parser/template_preparser.ts

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Confronta trusted_types_sinks.ts, dom_security_schema.ts e template_preparser.ts di upstream con i corrispondenti file di schema Rust e il parser in crates/oxc_angular_compiler/. Inizia con il controllo esistente degli attributi i18n, la tabella di sicurezza DOM e la classificazione degli elementi. Il lavoro è completato quando iframe|src è escluso dalla traduzione, i quattro attributi di animazione SVG usano la sicurezza degli URL e gli elementi script/style con namespace SVG ricevono la classificazione richiesta.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust, typescript
Ambito
compilers, security
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.