Expand description
Pinned third-party .modl module artifacts (Phase 15) — the registry
seam (ModuleSpec, spec_for) and the on-disk cache (cache_root,
module_cache_dir, cached_entry) that fetch verifies into.
Security boundary (read this before touching fetch.rs): the
sha256 check this module performs proves ONE thing — that the bytes on
disk are byte-for-byte what the release feed currently serves for a
given digest. It does NOT prove the module is validly signed by its
author, and it is not a substitute for one. Ignition’s own module-scan
owns the signature check, at gateway load time, entirely outside
ign’s control. An attacker who can both upload a malicious .modl
AND control what digest the feed reports for it defeats this check by
construction — that supply-chain trust boundary is accepted, not
mitigated, here (see the phase’s threat register, T-15-07).
Modules§
- fetch
- Release resolution, streamed download, and atomic cache-verify for
third-party
.modlmodule artifacts (Phase 15, RMOD-02/03).
Structs§
- Cached
Artifact - A verified artifact already sitting in the cache.
- Module
Spec - One third-party module’s release-feed coordinates: where its releases
live (
repo) and how a version string becomes a release tag / asset filename (tag_template/asset_template, both substituting the literal token{version}).
Constants§
- GIT_
MODULE - The
ignition-git-modulerelease feed (live-verified shape in 15-RESEARCH.md: tagv{version}, assetGit-{version}-signed.modl). - MODULES
- The module registry — one entry today. Phase 16’s second module registers through this seam; nothing else grows here in Phase 15.
Functions§
- cache_
root - The module artifact cache root:
IGNITION_CLI_CACHEenv override first, else the platform cache dir (directories::ProjectDirs:: from("", "", "ignition-cli").cache_dir()) — mirrorscrate::config::config_path’sIGNITION_CLI_CONFIGshape exactly, including itsexpecton a missing home directory. The env override is what lets tests point at atempfile::TempDirinstead of the developer’s real cache. - cached_
entry - Look up a cached, verified artifact for
module_id/version— keyed by VERSION ALONE (D-08): a hit never needs the feed, which is what makes SC-3 (no network on a repeat fetch) and SC-4 (offline-with-cache succeeds) possible. Accepts only filenames that strip to EXACTLY<version>-+ 64 lowercase hex +.modl— no regex, juststrip_prefix/strip_suffixplus a length + hex-digit check, which also disambiguates a prerelease version whose own string contains a hyphen (e.g.2.3.4-rc1never satisfies the fixed-length digest check when only2.3.4was requested). - module_
cache_ dir - The per-module cache directory:
<root>/modules/<module_id>. - spec_
for - Look up a registered module by
ModuleSpec::id. - validate_
module_ id - Validate a module id string the same way (T-15-03): 1–32 characters
from
[a-z0-9-]. Exit 2invalid_input. - validate_
version - Validate a module version string BEFORE it becomes a filesystem path
segment or URL component (ASVS V5, T-15-03): 1–64 characters from
[A-Za-z0-9._+-], with no..window anywhere (path-traversal refusal — this also catches a lone..). Exit 2invalid_input— a caller-supplied bad value is the usage class, so no new slug is warranted (the frozen taxonomy’s existing precedent).