From 444dc1b64c015197bf6b5219da9459bc0cf6f787 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 10 Sep 2025 16:40:27 +0100 Subject: Support disabling external file access --- src/main/java/org/zwobble/mammoth/DocumentConverter.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main/java/org/zwobble/mammoth/DocumentConverter.java') diff --git a/src/main/java/org/zwobble/mammoth/DocumentConverter.java b/src/main/java/org/zwobble/mammoth/DocumentConverter.java index 2dea8e8..c7dca20 100644 --- a/src/main/java/org/zwobble/mammoth/DocumentConverter.java +++ b/src/main/java/org/zwobble/mammoth/DocumentConverter.java @@ -60,6 +60,15 @@ public class DocumentConverter { return new DocumentConverter(options.disableEmbeddedStyleMap()); } + /** + * Source documents may reference files outside of the source document. + * Call this to disable access to any such external files during the conversion process. + * This is highly recommended when converting untrusted user input. + */ + public DocumentConverter disableExternalFileAccess() { + return new DocumentConverter(options.disableExternalFileAccess()); + } + /** * By default, images are converted to {@code } elements with the source included inline in the {@code src} attribute. * Call this to change how images are converted. -- cgit v1.2.3