PureXML/Sources
Mihaela Mihaljevic 01a35cc6e6 feat(parser): optional DTD with internal entities and billion-laughs defense
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.
2026-06-08 01:17:09 +02:00
..
Emitting refactor(emitter): make the serializer iterative and fix mixed content 2026-06-08 00:31:05 +02:00
Model feat(parser): resolve XML namespaces at the start-element boundary 2026-06-08 01:03:29 +02:00
Parsing feat(parser): optional DTD with internal entities and billion-laughs defense 2026-06-08 01:17:09 +02:00
Stream chore: scaffold PureXML pure-Swift XML package 2026-06-07 23:20:20 +02:00
Validation chore: scaffold PureXML pure-Swift XML package 2026-06-07 23:20:20 +02:00
API.swift feat(parser): streaming byte decode (incremental UTF-8/UTF-16) 2026-06-08 01:07:24 +02:00
PureXML.swift chore: scaffold PureXML pure-Swift XML package 2026-06-07 23:20:20 +02:00