Web Security · XML external entities
defusedxml
Python XML parser wrappers that reject entity declarations and external references by default. A bare DTD remains allowed unless the caller sets forbid_dtd=True. This blocks common XXE paths while letting the application choose whether any DTD is acceptable.