Skip to main content

load_cache_from

Function load_cache_from 

Source
pub fn load_cache_from(
    path: &Path,
) -> Result<McpDescriptorCache, DescriptorCacheError>
Expand description

Load and sanitize a descriptor cache from an explicit path. Boundary rules: exactly ONE handle is opened (O_NOFOLLOW|O_NONBLOCK on Unix, so a symlink or FIFO at the path is refused without following/blocking) and ALL checks run against that opened handle’s metadata — no metadata-then-reopen TOCTOU. The opened file must be regular and within CACHE_MAX_BYTES; the read itself is capped via Read::take and a post-read length check rejects concurrent growth past the bound. The content must be valid JSON of the supported version. Individual hostile descriptor entries (invalid name, non-object schema, oversized schema, duplicates) are dropped deterministically; descriptions are bounded. Never spawns, never touches the network.