安全模型

MarkItDown 的 I/O 權限等同目前程序——請像對待 open() / requests.get() 一樣謹慎
核心風險:MarkItDown 以目前程序的權限執行 I/O。 它會存取「程序本身能存取」的資源——這和 open()requests.get() 一樣。 在不信任的環境中,輸入必須先驗證與限制。

三條安全守則

1. Sanitize inputs(消毒輸入)

不要把不受信任的輸入直接丟給 MarkItDown。在代管 / 伺服器應用中,任何可能受使用者控制的輸入, 都必須先驗證與限制,例如:

2. 呼叫最窄的 convert_* 函數

convert() 故意很寬鬆:可吃本機檔、遠端 URI、bytes 流。請依用途收窄:

你的需求該用
只讀本機檔案convert_local()
自己控制 URI 抓取(proxy/驗證/快取)自己 requests.get()convert_response()
最大控制權自己 open stream → convert_stream()

3. 信任你的 converter

第三方外掛的 convert() 會以你的權限執行任意程式碼——只安裝信任來源的外掛。 accepts() 也一樣是外部程式碼。

markitdown-mcp 的額外風險面

官方原文

English original — Security Considerations
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.
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.
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 to convert_response(). For maximum control, open a stream to the input you want converted and call convert_stream().