Security and Network Access#
A Vega or Vega-Lite specification can refer to remote data, local files, images, fonts, and plugin code. When processing specifications from other users or systems, limit the resources they can access and the work they can perform.
VlConvert controls three resource types separately:
Resource |
Control |
|---|---|
Data and images referenced by a specification or SVG |
|
Google Fonts |
Explicit font requests and |
Plugin modules and their imports |
|
Allowing one type does not allow the others.
Restrict Data and Images#
By default, allowed_base_urls permits any HTTP or HTTPS URL and no local files for both data and images, and base_url resolves relative data and image URLs against the Vega datasets CDN. It’s recommended to tighten both before processing untrusted input.
An empty allowed_base_urls list blocks every HTTP or HTTPS URL and filesystem path. Inline values and data: URLs remain allowed. To permit one service, list its URL prefix. These settings apply to any conversion:
This example uses chart.vl.json from Quick Start:
$ vl-convert \
> --base-url disabled \
> --allowed-base-urls https://data.example.com/public/ \
> --max-v8-heap-size-mb 512 \
> --max-v8-execution-time-secs 10 \
> vl2png --input chart.vl.json --output chart.png
--allowed-base-urls none blocks every HTTP or HTTPS data and image URL and every filesystem path. Inline data: URLs remain allowed.
Allowlist entries can be URL prefixes, schemes such as https:, wildcard hosts, absolute filesystem directories, or *. Use the narrowest prefix that works, and never use * for untrusted specifications. See Loading Data and Images for the full pattern syntax and how URLs are resolved.
Restrict Fonts and Plugins#
Automatic Google Fonts makes network requests based on font names in a specification. Keep auto_google_fonts off unless you need it. If you enable it, set a variant threshold. See Fonts and Google Fonts.
Plugins run JavaScript and can import code from allowed domains. Prefer reviewed local startup plugins, and keep per-request plugins disabled for untrusted callers. See Vega Plugins and Plugin Loading and Security.
Limit Resource Use#
A specification can consume CPU time or JavaScript memory without loading any external resource. Set max_v8_execution_time_secs and max_v8_heap_size_mb for untrusted workloads. These limits cover only the JavaScript portion of a conversion, so adding process-level memory and time limits for a public service is also recommended. See Memory and Execution Limits.