Skip to content

Warn (and optionally fail) on a stale trust root with --offline - #1872

Open
mangrisano wants to merge 1 commit into
sigstore:mainfrom
mangrisano:offline-trust-root-staleness
Open

Warn (and optionally fail) on a stale trust root with --offline#1872
mangrisano wants to merge 1 commit into
sigstore:mainfrom
mangrisano:offline-trust-root-staleness

Conversation

@mangrisano

@mangrisano mangrisano commented Aug 13, 2026

Copy link
Copy Markdown

Closes #1175.

Summary

--offline disables TUF trust root refresh, so a user can end up verifying against a very stale trust root without realizing it (missing key rotations or revocations). This adds a staleness check in offline mode.

Behavior

When verifying with --offline, TrustUpdater inspects the cached TUF timestamp.json metadata and compares its expires against the current time:

  • expired for longer than the warn threshold (default 24h) → logs a warning;
  • expired for longer than the error threshold (default 7d) → raises TUFError, aborting verification.

If there is no cached timestamp.json (e.g. a fresh install running only off the embedded trust root, never refreshed), the check is skipped (debug log only).

Why "past expiry"?

The TUF timestamp role's expires is the only signed temporal anchor available offline (there is no signed "issued at"), and it's exactly TUF's mechanism for bounding freshness. So staleness is measured as now - timestamp.expires: the thresholds mean "expired for longer than X", i.e. a grace period on top of the repository's own declared expiry.

Configuration

Both thresholds are configurable, and either can be disabled with off (or 0):

  • CLI: --offline-staleness-warn / --offline-staleness-error (durations like
    24h, 7d, 2w)
  • env: SIGSTORE_OFFLINE_STALENESS_WARN / SIGSTORE_OFFLINE_STALENESS_ERROR

They thread through ClientTrustConfig.from_tuf/production/staging down to TrustUpdater, so library users get the same defaults (and can customize via ClientTrustConfig).

Notes / open questions

Tests

Added unit tests in test/unit/internal/test_trust.py: warn, hard error, fresh (no warning), missing timestamp (quiet), and error-level disabled.

Adds staleness checks in offline mode based on the cached TUF timestamp metadata expiry, configurable via --offline-staleness-warn / --offline-staleness-error (and the SIGSTORE_OFFLINE_STALENESS_* environment variables).

Closes sigstore#1175

Signed-off-by: Michele Angrisano <michele.angrisano@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--offline should warn when the trust root is unreasonably old

1 participant