Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Security Guide

Security Considerations for Public Hosted Instances

When hosting kroki-rs in the public domain, it is critical to implement standard infrastructure security practices. While kroki-rs uses secure temporary file handling, adaptive timeouts, and zombie process mitigation, it is ultimately executing external binaries that parse untrusted user input.

1. Do Not Expose Directly

Never expose the raw kroki-rs binary directly to the public internet. Always place it behind a reputable reverse proxy such as Nginx, Caddy, or Cloudflare.

2. Network Isolation

Diagram generation tools rarely need outbound internet access (except for the built-in dynamic font downloader, which only fetches explicitly configured URLs).

3. Resource Limits

Even with the internal adaptive timeout mechanisms natively protecting the Rust execution context, you must enforce strict hardware limits for the underlying machine.

4. Timeout Configurations

You can strictly control execution time by modifying the kroki.toml configuration file. By default, the adaptive timeout will kill hung processes within ~10 seconds. You can clamp this down:

[default]
# Enforce a global hard limit across all providers
timeout_ms = 4000

5. Security Updates

Monitor the upstream repositories for the individual CLI tools (e.g., Mermaid CLI, D2, Graphviz) used by kroki-rs and ensure their binaries are kept up to date.