Add opt-in DTD processing behind Limits(allowDoctype:), off by default. When on, DoctypeScanner reads the <!DOCTYPE> internal subset and honors internal <!ENTITY name "value"> general entities, which EntityDecoder expands recursively in text and attribute values. Safety is mandatory and reimplemented from the Expat amplification-accounting model (no upstream code copied): - only entity-expanded characters count against a shared budget (Limits.maxEntityExpansion); overflow raises amplificationLimitExceeded, which defeats billion-laughs. - a visiting set detects recursive entities (recursiveEntity). - undeclared references raise undefinedEntity. - external entities are never stored or loaded, so XXE stays closed. The default still rejects <!DOCTYPE>. 8 DTD tests (incl. billion-laughs and the external-entity refusal); 49 total. |
||
|---|---|---|
| .. | ||
| ByteDecoder.swift | ||
| DoctypeScanner.swift | ||
| EntityDecoder.swift | ||
| Event.swift | ||
| EventReader.swift | ||
| InputEncoding.swift | ||
| Limits.swift | ||
| Mark.swift | ||
| NamespaceContext.swift | ||
| ParseError.swift | ||
| Parser.swift | ||
| Reader.swift | ||
| StreamingDecoder.swift | ||