Flush labelled derivatives when a disclosure changes

Problem/motivation

A derivative URL does not change when the disclosure of its file changes. A file that becomes a deep fake keeps serving an unlabelled derivative from disk, browsers and CDNs. A file that stops being one keeps its label.

Proposed resolution

  • On save of an entity with a disclosure field, compare the resolved disclosure of the original entity with the new one: icon, variant and label requirement. If it changed, call ImageDerivativeUtilities::pathFlush() for every image file the entity uses, and invalidate the cache tags of those files.
  • Add a short disclosure token to derivative URLs in preprocess, for example ?aid=g3f2a, so browsers and CDNs fetch the new file.
  • Purge integrations follow from the cache tag invalidation.

Remaining tasks

  • Change detection and flush
  • URL token
  • Kernel test: a grade change removes the old derivative
  • Docs

User interface changes

None.

API changes

None.

Data model changes

None.

Part of #56 (closed).

Edited by Giorgio Alfredo Pagano