aeat.adapters.inbound.sanitizer._structtree module¶
StructTree drop for adapters.inbound.sanitizer.
The Tagged-PDF structure tree (Root.StructTreeRoot) carries
accessibility text via /ActualText, /Alt, and /E
entries. Scrubbing the body Tj operands does not automatically
catch these — the structure tree is a parallel surface. The
AstraZeneca contract redaction failure was rooted in this gap.
The sanitiser drops the entire StructTreeRoot rather than walking
it. Drop > scrub: a missed key is a leak; lost accessibility
metadata in a regression-test fixture is harmless. The
SanitizationWarning structtree_dropped_lossy records
the trade-off so callers know the fixture is no longer
screen-reader-equivalent to the source.
- drop_struct_tree(pdf)[source]¶
Removes
Root.StructTreeRootif present.- Parameters:
pdf (
Pdf) – An open PDF whose StructTree should be wiped.- Return type:
- Returns:
A 2-tuple of (counter, warnings). The counter is a
ScrubbedSurfacethat is zero when the tree was absent and one when it was dropped. Warnings carrySanitizationWarningstructtree_dropped_lossywhen the tree was present so callers see the lossy step in the audit log.