Review main Merged

95683[TASK] Download extensions from TER as ZIP archives

Benni Mack CR +2 V +2 Hard +318 −12 updated 09/09/26, 05:43

Commit message

Installing from TER fetched the .t3x file: a serialized PHP array of
every file's contents, verified with an MD5 hash taken from the
extension index, from which the extension directory and its
ext_emconf.php were rebuilt locally.

TER stores the ZIP archive the author uploaded next to it and now
publishes its SHA-256 hash in the extension index as <artifactsha256>.
When that hash is present, the archive is downloaded, verified against
it and extracted instead.

Why the archive is the better artifact:

* It is what the author uploaded. The t3x is a re-encoding of it, and
  the rebuild is lossy in the one place that now matters: since
  #109783 composer.json decides whether an extension is loadable in
  classic mode, while ext_emconf.php is no longer evaluated at all.
  Installing the author's own files removes a whole class of
  "extension was downloaded but does not show up".
* The upload form of the Extension Manager accepts zip files only,
  since #92590. The TER download was the last consumer of the t3x
  format in the product, so both install paths now behave the same and
  one unpacking routine is left to reason about.
* Unpacking a t3x means calling unserialize() on a payload fetched
  over the network. allowed_classes is false, so this is not an object
  injection hole, but extracting a zip through ZipService, which
  rejects traversal sequences, is a far narrower surface than
  deserializing remote input at all.
* The entire t3x is held in memory at once: the compressed stream, the
  uncompressed serialized string, and the resulting array carrying
  every file's contents. ZipArchive::extractTo() works entry by entry.

Why SHA-256 is the better hash:

* It covers the artifact that is actually installed. TER computes it
  over the zip at upload time, whereas the MD5 describes a second file
  derived from the same upload.
* MD5 has been collision-broken for years. That alone does not let a
  network attacker swap the artifact - that needs a second preimage,
  which MD5 still resists - but it rules MD5 out as something to build
  on, and there is no reason to keep it when TER records a SHA-256.
* Neither hash is a supply chain signature while index and artifact
  come from the same origin over TLS. The check earns its keep once
  the index is cached or mirrored and the artifact is not, which is
  precisely what a custom remoteBase allows.

Unpacking an archive now reloads the package information and flushes
the opcode cache, which so far only the t3x routine did. Without it an
update of an already installed extension keeps the previous metadata in
the PackageManager and the previous bytecode in the opcode cache, so
with opcache.validate_timestamps=0 - the rule in production - the
update has no visible effect.

The t3x file remains the fallback. Remotes that publish no artifact
hash, and versions uploaded before TER started recording one, are
downloaded and verified exactly as before, so nothing has to be
re-uploaded and no remote is forced to follow.

A verification hash of a known algorithm is now prefixed with its
name, e.g. "sha256:<hash>", which is how a remote tells apart the
artifact a hash belongs to. Prefixing keeps
ExtensionDownloaderRemoteInterface source compatible - adding a
parameter to it would be fatal for third party implementations - and
an unprefixed value keeps meaning "MD5 of the t3x file".

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 14

Review log 1218

  1. Benni Mack uploaded patch set 1 09/07/26, 16:38

  2. Benni Mack rebased onto patch set 2 09/07/26, 16:38

  3. core-ci voted on patch set 1 V +1 09/07/26, 16:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108017

  4. core-ci voted on patch set 2 V +1 09/07/26, 16:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108018

  5. Benni Mack rebased onto patch set 3 V +1 09/07/26, 19:51

  6. core-ci voted on patch set 3 V +1 09/07/26, 20:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108033

  7. Benni Mack rebased onto patch set 4 V +1 09/08/26, 08:45

  8. core-ci voted on patch set 4 V +1 09/08/26, 08:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108065

  9. Benni Mack commented on patch set 5 V +1 09/08/26, 13:55

    Published edit on patch set 4.
  10. Benni Mack marked it ready for review 09/08/26, 13:55

  11. core-ci voted on patch set 5 V +1 09/08/26, 14:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108095

  12. Simon Schaufelberger voted on patch set 5 CR +1 V +1 09/08/26, 15:20

  13. Benni Mack uploaded patch set 6 CR +1 V +1 09/08/26, 18:30

  14. core-ci voted on patch set 6 V +1 09/08/26, 18:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108111

  15. Simon Schaufelberger voted on patch set 6 CR +1 V +1 09/08/26, 19:41

  16. Georg Ringer voted on patch set 6 CR +1 V +1 09/08/26, 21:09

  17. Benni Mack voted on patch set 6 CR +2 V +2 09/09/26, 05:43

  18. Benni Mack merged patch set 7 09/09/26, 05:43