possible blog post: Caching TUF metadata

Aperta
#2,605 3 commenti 5 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
25/100
Tipo di issue
Documentazione
Chiarezza
Da chiarire
Stato di attività
Ferma

Direzione di ricerca

Non sono indicati file, test o punti di ingresso del codice. Inizia esaminando la bozza incollata e il processo del repository per i contributi al blog o alla documentazione, quindi chiarisci se questo debba diventare un articolo pubblicato e quale formato o revisione sia richiesta. Il lavoro è completato quando è disponibile un articolo concordato, revisionato e pronto per la pubblicazione, oppure quando è stata presa una decisione documentata di non procedere.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I've spent far too long in the past week looking at CDN logs... I collected some notes from this, and wrote a first draft of a blog post or something. copy-pasting here so I don't lose it

TUF implementation details: Caching and content delivery networks

TUF metadata can be cached at various places during its lifetime, this post aims to describe the useful
methods of caching. The write-up assumes that the "consistent snapshot" feature of TUF is used:
this should be true for all reasonable implementations.

Client metadata cache

A TUF client stores downloaded metadata in an application cache as part of the
TUF Client Workflow. Note that caching metadata is subtly different from caching
artifacts: An artifact cache is a "pure" cache and can be purged at any time without
side-effects (other than possibly having to re-download). Purging the metadata cache
is also possible without service loss but does have minor security implications as
some rollback attack protection is lost.

Client HTTP cache

In addition to the actual metadata, a client could cache the ETag information
included in a timestamp.json response and use the If-None-Match header in
subsequent requests. This is not useful for other metadata or artifacts as they
should never change.

There is a minor information leak if this is done (as the server could now respond
maliciously to only some clients based on the content of the If-None-Match
header). Current client implementations are not known to cache ETag.

Content Delivery Network caching

One could imagine that caching something as simple as TUF metadata in a Content
Delivery Network (CDN) is a trivial feat but it turns out there are several pitfalls.

These are some of the lessons that have been learned while maintaining TUF repositories:

  • Uploading a new repository version to backend storage should be atomic (the metadata
    versions on the storage backend should always be consistent). If this is not technically possible,
    snapshot and all targets metadata should be uploaded before root and timestamp: this
    minimizes the window of potentially inconsistent metadata.
  • "Old" metadata (or artifact) versions should not be removed from backend storage immediately: this can break clients that are in the middle of an update process
  • CDN frontends should avoid serving any stale responses: 404 responses to root requests are part of the normal usage of the API and cannot be allowed to be stale, otherwise the repository state may be inconsistent.
  • CDN frontends may cache versioned positive metadata responses (root, snapshot, targets) with
    long lifetimes.
  • There are two valid alternatives to caching other responses:
    1. CDN frontend may use "negative cache" (caching failure codes) and may cache
      timestamp metadata responses, if it is able to invalidate the cache immediately on
      upload of new repository versions to storage backend.
    2. CDN frontend should not cache timestamp metadata responses or use "negative caching"
      if it is unable to invalidate the cache on upload of new data

At first glance it may seem like the above advice is overly cautious, and that failures
would be rare. In practice especially testing and alerting systems have managed to
consistently find failing combinations of mistakenly cached content.

Lingua principale
Python
Stelle
1.7k
Fork
304
Merge medio
1g 2h
PR unite (30g)
17

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di theupdateframework/python-tuf

Tutte le issue di theupdateframework/python-tuf

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.