other
Warning
- Location
- mermaid_converter.py:93
- Finding
- Mermaid Source Is Disclosed to Kroki During Default Conversion<![CDATA[ ## Vulnerability Details **File Location**: `mermaid_converter.py:93-105` and `mermaid_converter.py:255-258` **Vulnerability Type**: Unintended data disclosure to a third-party conversion service **Risk Level**: Medium ### Vulnerable Code ```python # Compress and encode Mermaid code compressed = zlib.compress(mermaid_code.encode('utf-8'), 9) encoded = base64.urlsafe_b64encode(compressed).decode('utf-8') # Build URL url = f"https://kroki.io/mermaid/{output_format}/{encoded}" # Request response = requests.get(url, timeout=30) ``` The automatic method selection invokes Kroki before attempting local conversion: ```python # Try Kroki first print("Trying Kroki online conversion...") if self.convert_with_kroki(mermaid_code, output_path, output_format): return output_path ``` ### Technical Analysis The entire Mermaid source is compressed and Base64-encoded into a URL sent to `kroki.io`. Compression and Base64 encoding do not provide confidentiality; the original source can be recovered by anyone with access to the URL. This network disclosure occurs during the default conversion path, including when the user does not specify `--upload`. Consequently, a user requesting what appears to be image conversion may unknowingly transmit diagram content to a third party. Placing the encoded source in a GET URL also increases exposure because URLs may be retained in proxy, gateway, browser, CDN, or server access logs. The online conversion feature is relevant to the declared functionality, but automatically preferring it exceeds the minimum network privilege needed when a local converter is available. ### Attack Path 1. A user places confidential architecture, internal hostnames, workflow details, customer names, or other sensitive information in a Mermaid diagram. 2. The user invokes ordinary PNG, SVG, or JPG conversion without explicitly selecting Kroki or requesting an upload. 3. The default method-selection logic invokes `convert_with_kroki`. 4. The c ...[truncated 603 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Make local `mermaid-cli` conversion the default when it is available. 2. Require explicit user consent for online conversion, such as `--method kroki` or `--allow-network-conversion`. 3. Display a clear warning that the complete Mermaid source will be sent to a third party before making the request. 4. Use Kroki's POST interface, if supported, rather than embedding source data in a GET URL. 5. Provide a strict offline mode that prevents all network requests. 6. Document the third-party service's data handling and advise users not to submit confidential diagrams. ]]>
