pub struct ObjectId(/* private fields */);Expand description
A kopia object id as it appears in manifests. Validated so a repository entry can never smuggle a flag onto the session argv.
kopia’s id space is wider than plain hex: content ids (k…/x…), indirect
ids (Ix…), and section ids (S<start>,<length>,<base>) all appear in
real manifests, and entry names carry through into ids that hold -, _
or .. The gate is therefore a deny-list, not an allow-list: the only
threat is argv flag injection (the session never goes through a shell —
SessionCmd::argv is exec’d directly), so a legitimate-but-unforeseen id
form must not be rejected.
Implementations§
Source§impl ObjectId
impl ObjectId
Sourcepub fn parse(s: &str) -> Result<Self, InvalidObjectId>
pub fn parse(s: &str) -> Result<Self, InvalidObjectId>
Parse an object id read out of a repository manifest, rejecting only
what could subvert the session’s argv or its logs: an empty string, a
leading - (kopia would read the id as a flag), a / (a path, never an
id), whitespace (argv word-splitting in anything that re-renders the
command), and control/non-ASCII bytes (terminal escapes in error text).
Everything else — commas, dashes, dots, underscores — is a shape kopia
itself emits and passes through.