Repository navigation
Refresh Sigstore's trust root from its TUF repository - #1336
Open
tolgaergin wants to merge 5 commits into
Open
tolgaergin wants to merge 5 commits into
tolgaergin wants to merge 5 commits into
Conversation
Every LPM binary held the Sigstore trust root it was built with and nothing else. When Sigstore rotates a Fulcio CA, Rekor log or CT log key, a copy built earlier would refuse every signature that needs the new key: standalone self-update would refuse every later release, and install-time npm provenance checks would reject new packages as an attack. LPM now carries Sigstore's TUF root and refreshes the trust root the way Sigstore's own clients do: it follows the root rotations Sigstore signed, checks timestamp, snapshot and targets signatures, versions and expiry, and accepts only a trust root whose hash the targets role signed. A minimal TUF 1.x client does this for the four top-level roles, with ECDSA P-256/P-384 and Ed25519 keys and the canonical JSON securesystemslib signs. - Self-update fetches Sigstore's current trust root before verifying a release, so keys Sigstore retired stop counting. Provenance, relay key and publish checks fetch it when a bundle needs a key, log or CA the held trust root lacks, at most once an hour. - A failed fetch keeps the held trust root, never older than the one built in, and the error says the fetch failed. - The verified metadata is cached under ~/.lpm/cache/metadata and checked again against the built-in TUF root whenever it is read. - LPM_SIGSTORE_TUF_URL_OVERRIDE points at a mirror (https or loopback) or turns fetching off with "off". - `lpm internal-verify-release` still verifies with the trust root the release binary holds, without fetching. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e, and never roll the cache back - A key listed under two IDs or encodings counted twice toward a threshold; keys now count by their decoded bytes. - A fetched trust root in which a role has no usable key because of entries this version can't read replaced a working one; it is now refused. A role whose readable keys Sigstore retired still stands. - Two processes whose fetches finished out of order could write the older metadata last. The cache is now written under a lock and only when nothing newer is cached, and a process keeps its last verified metadata as the rollback baseline when it can't write the cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s, and share fetches between processes - Keys, roles, files and targets the client can't read are left out of TUF metadata instead of refusing the whole document. An unreadable key never counts toward a threshold. Version 0 is refused. - Only targets.json is held to its stored version, so a delegated role Sigstore drops no longer blocks refreshes. Key rotations are tracked at every root step. - Stored roots no newer than the built-in TUF root are skipped, so a binary with a newer built-in root keeps a cache an older one wrote. - A fetched or cached trust root in which a role has no usable key because its entries are missing or unreadable is refused, and the held one stays in use. A role Sigstore retired still stands. - The cache records when it was fetched; within the hour other processes reuse it instead of fetching. A failed fetch is retried after a minute. - `lpm internal-verify-release` verifies with the built-in trust root only, never a cached one. - The repository URL's scheme is parsed, not prefix-matched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… before Sigstore outgrows the client - Stored roots older than the built-in TUF root stay in the cache, so an older and a newer LPM on one machine can both follow it. - The shared store in unit tests reads no cache, so they verify with the built-in trust root on every machine. - The live check fails when Sigstore publishes a TUF root newer than the built-in one, and when the root or targets role is down to its threshold of keys LPM can verify. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tolgaergin
marked this pull request as ready for review
November 25, 2026 13:28
…ckouts A CRLF checkout rewrote them, so their lengths and hashes no longer matched what Sigstore signed and five TUF tests failed on Windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every LPM binary held the Sigstore trust root it was built with, and nothing else. When Sigstore rotates a Fulcio certificate authority, a Rekor log key or a CT log key, every copy built before the rotation would refuse every signature that needs the new key:
lpm self-updatewould refuse every later release. That's the same lockout class Install and self-update on Macs without developer tools or Apple's services #1329 fixed for macOS. The error told users to "update lpm to refresh", which is the step that fails.Nothing is broken today: the built-in trust root still matches Sigstore's live one, which is TUF targets version 14.
Fix
LPM now does what Sigstore's own clients do. It ships Sigstore's TUF root (version 16) and refreshes the trust root from
https://tuf-repo-cdn.sigstore.dev.TUF client (
sigstore_verify/tuf): a minimal TUF 1.x client for the four top-level roles and the one target LPM needs,trusted_root.json.Trust store (
sigstore_verify/trust_store):--provenance-filechecks fetch it only when a bundle needs a certificate authority, Rekor log or CT log that the held trust root lacks, or when a role has no active key. They fetch at most once an hour and share one fetch between concurrent checks.TrustRootNotRefreshed).~/.lpm/cache/metadata/sigstore-trust.jsonand checked again against the built-in TUF root every time it is read. A forged or changed cache is ignored, and so is a cache older than the built-in trust root.LPM_SIGSTORE_TUF_URL_OVERRIDEpoints at a mirror (HTTPS or loopback only), or turns fetching off withoff. Workflow tests setoff, so they never reach the network. The shared store in unit tests is offline.Error classes: a missing key, log or certificate authority is now
VerifyError::MissingTrustMaterial. A role with no active key is stillTrustRootExpired. These two are the only ones that trigger a fetch.Release gate:
lpm internal-verify-releasestill verifies with the trust root the release binary holds, without fetching. A release that passes it therefore verifies even on a machine that can't reach Sigstore.Review round (Fable 5.2, Opus 5.5, Astra 6.2, Sol 6.2, Gemini 4 Neon)
The reviewers found no way for a mirror, the network or the cache to make LPM accept, or roll back to, a trust root that Sigstore's targets role didn't sign. Fixed, each test-first and mutation-checked:
targets.jsonis held to its stored version, so a delegated role Sigstore drops can't block refreshes. Key rotations are tracked at every root step.internal-verify-releasenow verifies with the built-in trust root only.Declined:
maincan. That's for the maintainer to decide.Full local gate on the final top: 20,112 of 20,112.
Not in this PR
LPM's verifier reads only Rekor v1 entries. Sigstore's Rekor v2 uses checkpoints and RFC 3161 timestamps instead of signed entry timestamps. Today neither Sigstore's default signing configuration nor GitHub's attestation action writes v2 entries. If npm switches, provenance verification needs v2 support. The stacked PR's gate stops an LPM release that older updaters can't verify. Rekor v2 support is proposed as a follow-up.
Tests
sigstores_live_repository_serves_the_built_in_trust_rootrefreshes from Sigstore's live repository. The stacked PR runs it daily, and it passes today.MissingTrustMaterial.🤖 Generated with Claude Code