Security Considerations
Security considerations for MarkItDown: sanitizing untrusted input and choosing the narrowest conversion API for your use case.
MarkItDown performs I/O with the privileges of the current process. Like open() or
requests.get(), it will access resources that the process itself can access.
Sanitize your inputs
Do not pass untrusted input directly to MarkItDown.
If any part of the input may be controlled by an untrusted user or system, such as in hosted or server-side applications, it must be validated and restricted before calling MarkItDown. Depending on your environment, this may include restricting file paths, limiting URI schemes and network destinations, and blocking access to private, loopback, link-local, or metadata-service addresses.
Call only the conversion method you need
Prefer the narrowest conversion API that fits your use case. MarkItDown's convert() method is
intentionally permissive and can handle local files, remote URIs, and byte streams.
- If your application only needs to read local files, call
convert_local()instead. - If you need more control over URI fetching, call
requests.get()yourself and pass the response object toconvert_response(). - For maximum control, open a stream to the input you want converted and call
convert_stream().