diff options
| author | Michael Williamson <mike@zwobble.org> | 2025-08-02 16:35:24 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2025-08-02 16:35:24 +0100 |
| commit | 4989f13567602bb7b32321d7c6588b4dcefefb58 (patch) | |
| tree | 021edf9f25c63f2fa535ff10feaad7e861b76427 | |
| parent | 79ba0e4fc7f937bd2ebee27b0401187ca40f4bec (diff) | |
Add notes on security
| -rw-r--r-- | README.md | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -66,6 +66,10 @@ Install-Package Mammoth ### Library +**Mammoth performs no sanitisation of the source document, +and should therefore be used extremely carefully with untrusted user input.** +See the [Security](#security) section for more information. + #### Basic conversion To convert an existing .docx file to HTML, @@ -299,6 +303,24 @@ var converter = new DocumentConverter() where `StreamToBase64` is a function that reads a stream and encodes it as a Base64 string. +### Security + +Mammoth performs no sanitisation of the source document, +and should therefore be used extremely carefully with untrusted user input. +For instance: + +* Source documents can contain links with `javascript:` targets. + If, for instance, you allow users to upload source documents, + automatically convert the document into HTML, + and embed the HTML into your website without sanitisation, + this may create links that can execute arbitrary JavaScript when clicked. + +* Source documents may reference files outside of the source document. + If, for instance, you allow users to upload source documents to a server, + automatically convert the document into HTML on the server, + and embed the HTML into your website, + this may allow arbitrary files on the server to be read and exfiltrated. + ## Writing style maps A style map is made up of a number of style mappings separated by new lines. |
