pdf_safety
azure_bootstrap.pdf_safety
¶
PDF action stripping for untrusted pass-through.
When an app merges customer-uploaded PDFs into an output that will be
redistributed, the catalog-level OpenAction, AcroForm-field actions, page
actions, and annotation actions are an exfiltration / phishing risk if the
viewer renders them. This module strips them in-place before
writer.append(reader).
Best-effort: any exception inside the scrub is caught and the original reader passes through. Reason: a malformed PDF that crashes the scrubber must not block report generation — the ingress gates already classified it as a valid PDF.
Functions:
| Name | Description |
|---|---|
sanitize_pdf_for_passthrough |
Strip executable / network-bearing entries from a PdfReader. |
sanitize_pdf_for_passthrough
¶
Strip executable / network-bearing entries from a PdfReader.
Mutates the reader in place AND returns it for ergonomic chaining. Best-effort: never raises; on any exception during scrub, returns the original reader unchanged and skips the counter bump.