IF Commons GitHub

links

Written to: 2 requirements: 2 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-native-pinned-install FR-007, 0002-native-pinned-install FR-008

The links of an archive, checked and resolved as pure functions (commons 0002-native-pinned-install FR-007, FR-008): a symbolic link is kept only where its target is a relative path that stays inside the folder the archive is unpacked into, names something the archive holds (a file, a folder, or another link whose own target is such, with no loop), and passes through no link folder; a hard link is kept as a copy of the file it names, which the archive holds before it; and no file, folder or link is written below a link. Nothing here reads a file or makes a link: the result says which links to make, and a system that cannot make links is given copies.

Every refusal names the path of the link and one reason from a closed list, and refuses the whole archive: a tool with one link that cannot be trusted is not installed at all, as a path that leaves the folder refuses it. The paths are the archive's own (isSafePath has held each), so a target is resolved against the folder of the link as text, with .. taking one part away and never reaching above the root of the folder.

import { resolveLinks } from "./links.ts";
// a Node release: bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js stays inside, so it is a link to make

Source: commons/archon-dialect-native-pinned/src/links.ts

2 of 4 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

LinkProblemtype
type LinkProblem =
  | "absolute"
  | "escapes"
  | "dangling"
  | "loops"
  | "through-link"
  | "collides"
  | "written-through"
  | "hardlink-target"
  | "directory-on-windows";

Why a link is refused.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

LinkRefusaltypeno test imports it
type LinkRefusal = { readonly kind: "link"; readonly path: string; readonly why: LinkProblem };

A link refused, with its path and why.

SymbolicLinktypeno test imports it
type SymbolicLink = { readonly path: string; readonly target: string };

A symbolic link to make: its path and its target, as the archive names it.

Unpackedtype
type Unpacked = { readonly files: Files; readonly executable: ReadonlySet<string>; readonly links: readonly SymbolicLink[] };

What an archive unpacks to: its files, the paths of those the archive marks as executable (any execute bit of their mode), and the symbolic links to make once they are written.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.