Expand description
Binary-hash pinning for stdio addons (P3 — supply-chain hardening).
A stdio addon spawns a local executable. Pinning that binary’s SHA-256 in
the manifest ([mcp] sha256 = "…") closes the gap between what was audited
and what actually runs: if the file on PATH is swapped after install, the
hash no longer matches and the gateway refuses to spawn it.
SHA-256 (not the engine’s internal BLAKE3) is deliberate — an author pins the
value an ordinary sha256sum my-mcp / shasum -a 256 my-mcp prints, so the
pin is reproducible without lean-ctx.
Functions§
- resolve_
on_ path - Resolve a stdio
commandto a concrete file path. An absolute/relative path (anything containing a separator) is used as-is; a bare name is looked up onPATH, honouringPATHEXT-free Unix semantics (first executable match). - sha256_
file - Stream-hash a file and return its lowercase hex SHA-256. Streaming (8 KiB chunks) keeps memory flat regardless of binary size.
- verify_
binary - Verify that
commandresolves to a binary whose SHA-256 equalsexpected_sha256. An emptyexpected_sha256means “no pin” →Ok. The comparison is case-insensitive over hex; any mismatch, unresolved binary, or read error is a hard failure (fail-closed — a pin you cannot check is a pin that failed).