SafeXML 1.0.1 - The Memory-Safe, GIL-Free, Ultra-Fast Defused XML Parser
What's New in 1.0.1
- 100.00% Enforced Code Coverage: Every statement and branch is rigorously verified across Linux, macOS, and Windows. Strict 100% coverage is enforced directly in CI (
pytest --cov-fail-under=100) and pre-push hooks.
- Modern XML Vulnerability Defenses (Beyond DefusedXML):
- Attribute Flood / Attribute Hash DoS (CWE-400): Enforces
max_attributes (default: 1,000) to defeat quadratic hash table collision and memory blowup attacks.
- Giant Attribute Value Bombs (CWE-400): Enforces
max_attribute_size (default: 10MB) to stop single-attribute memory exhaustion.
- Comment Amplification Bombs: Enforces
max_comment_size (default: 10MB) to block unbounded comment streaming.
- Tag Name Memory Bombs: Enforces
max_name_size (default: 1,024 chars) to prevent symbol table exhaustion.
- Null Byte Injection Defense: Strictly rejects embedded
\0 bytes in identifiers to prevent C-string truncation exploits in downstream databases and auth services.
- Parameter Entity Protection: Full detection and rejection of
<!ENTITY % pe ...> within internal/external DTD subsets.
- High-Performance Benchmarks vs DefusedXML:
- Single-Threaded: SafeXML is 1.63x faster (+62.9% throughput) on standard workloads (67 µs vs 109 µs) and 1.23x faster on large 500KB documents (42 ms vs 52 ms).
- Multi-Threaded Concurrency (GIL-Release): Under
ThreadPoolExecutor simulating API concurrency, SafeXML achieves 1.42x - 1.43x higher throughput because Rust releases the GIL (py.detach(|| ...)), freeing CPU cores to process requests in parallel.
- Compelling Documentation: Complete attack surface comparison matrix comparing SafeXML vs defusedxml vs lxml vs stdlib, highlighting immunity to C
libexpat memory corruption CVEs.
Installation
PyPI: https://pypi.org/project/safexml/1.0.1/