Skip to main content

Module links

Module links 

Source
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:

  1. a target is relative — never absolute, never a drive letter, never a backslash;
  2. resolved against the link’s own directory it stays inside the payload, so .. is allowed exactly as far as it cannot escape;
  3. a link resolves to a regular file, never to a directory;
  4. no entry may have a link as a path prefix, so nothing is ever written through a link;
  5. 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§

PayloadEntry
One entry as the link rules see it.

Enums§

EntryKind
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.