outlines_cache
outlines_cache
¶
Harden vLLM's Outlines caches against diskcache poisoning (CVE-2025-69872).
diskcache (pulled in transitively by outlines and used by vLLM's optional on-disk outlines cache) deserializes cached values with pickle/cloudpickle and is therefore RCE-vulnerable if another principal can write into the cache directory. Neither library exposes a way to swap the serializer, so NSS mitigates at the boundary:
- Keep vLLM's opt-in diskcache off (its default is an in-memory LRUCache). Hard-set rather than defaulted, so a user environment can't silently turn on a pickle-deserializing code path.
- Pin
OUTLINES_CACHE_DIRto a per-user path and chmod it to 0700, since outlines always uses diskcache for its FSM/index cache.
Kept free of vLLM imports so callers that only prepare a vLLM subprocess environment can apply the same protection.
Functions:
| Name | Description |
|---|---|
secure_outlines_cache_dir |
Pin |
harden_outlines_cache |
Turn off vLLM's on-disk Outlines cache and secure |
secure_outlines_cache_dir(environ=None)
¶
Pin OUTLINES_CACHE_DIR to a per-user path and tighten permissions.
Respects an explicit OUTLINES_CACHE_DIR set by the operator (so CI and
multi-tenant deployments can choose their own private location), but always
creates the directory with 0700 permissions to prevent co-tenants from
poisoning the diskcache (CVE-2025-69872).
When unset, picks a per-user path under $XDG_CACHE_HOME or
$HOME/.cache and falls back to a UID-scoped subdir of the system temp
dir for distroless/rootless containers where $HOME is /.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
environ
|
MutableMapping[str, str] | None
|
Environment to read and update; defaults to |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The cache directory. |
Source code in src/nemo_safe_synthesizer/outlines_cache.py
harden_outlines_cache(environ=None)
¶
Turn off vLLM's on-disk Outlines cache and secure OUTLINES_CACHE_DIR.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
environ
|
MutableMapping[str, str] | None
|
Environment to update; defaults to |
None
|