Skip to main content

validate_name

Function validate_name 

Source
pub fn validate_name(coll: &str) -> Result<()>
Expand description

Is this a name a collection can durably HAVE?

Two separate concerns land here.

The first is that a collection name becomes a directory name on disk (indexes/{coll}/{shard}/{id}), so a name containing a path separator or a .. component does not address a collection at all — it addresses somewhere else on the filesystem. That has to be refused at the entry point rather than sanitised, because a silently rewritten name is a different collection than the one the caller asked for, and they would never be told.

The second is that a state root commits to these names. A name that cannot round-trip identically through every storage path is not an identity.