Skip to main content

validate_key

Function validate_key 

Source
pub fn validate_key(key: &str, allowed_prefixes: &[String]) -> Result<()>
Expand description

Validate a request key: reject structurally unsafe keys (empty, absolute, or containing .. traversal segments) and enforce that it falls under one of the allowed_prefixes.

An empty allowed_prefixes list means allow-all (still enforcing structure). Callers that must fail closed are responsible for refusing to configure an empty list.