enlace_auth.stores.validation#
Key sanitization for user-supplied store keys.
Blocks the standard path-traversal attack surface: .. segments, backslashes,
null bytes, control characters, absolute paths, and URL-encoded variants. Keys
that survive sanitization are still filesystem-safe and can be composed into a
prefix without risk of escaping the tenant namespace.
Functions
|
Return |
- enlace_auth.stores.validation.sanitize_key(key)[source]#
Return
keyunchanged if safe for use as a store path component.Raises
ValueErrorwith a specific reason if the key is unsafe. The goal is fail-fast: we want the caller to see exactly why a key was rejected, not a silently rewritten value.- Return type: