Expand description
Mirror of the rule deciding which symbolic links a box payload may carry.
A conda prefix is dense with links: the shared-library soname convention alone stores every large
library two or three times, and bin carries interpreter aliases. Preserving them costs nothing
to store and everything to get wrong, because a link is the classic way an archive writes outside
the directory it was extracted into.
So the rule is deliberately narrow and purely lexical, which is what makes it provable:
- a target is relative — never absolute, never a drive letter, never a backslash;
- resolved against the link’s own directory it stays inside the payload, so
..is allowed exactly as far as it cannot escape; - a link resolves to a regular file, never to a directory;
- no entry may have a link as a path prefix, so nothing is ever written through a link;
- chains terminate, within a small bound, without a cycle.
Nothing here consults the filesystem, which is what lets the builder and every consumer apply one rule rather than three approximations of it. A consumer applies it to the archive as received: a box assembled by hand gets no benefit of the doubt.
Structs§
- Payload
Entry - One entry as the link rules see it.
Enums§
- Entry
Kind - What an entry in a payload or archive is.
Constants§
- MAX_
PAYLOAD_ LINK_ DEPTH - How many links a single resolution may traverse before it is treated as hostile.
Functions§
- find_
entry_ through_ link - Rejects an entry set in which anything could be written through a link.
- find_
unresolvable_ link - Follows every link in an entry set until it reaches a regular file.
- is_
relative_ link_ target - Whether a raw link target is shaped like one a payload may carry, before resolving it.
- resolve_
payload_ link_ target - Resolves a link target against the link’s own location, staying inside the payload.
- target_
carries_ links - Whether a target platform can extract a payload containing links.