Issue Task Closed

#103082Replace former extension packages using self.version

Thomas Hohn 02/08/24, 10:56 updated 07/09/24, 15:33

Description

The so called “death star” range for replacements has to be
used with caution [1] as it replaces all versions of the
replaced packages, including old or insecure versions.

That effectively means the replacing package marks itself as matching
in queries for insecure versions, once a security advisory2
is submitted for the replaced packages.

The extension replacements needs to be adapted to use the more precise
self.version qualifier to avoid matching named security advisories as
suggested by:
https://github.com/Roave/SecurityAdvisories/issues/127#issuecomment-1933647035

[1] https://getcomposer.org/doc/04-schema.md#replace
2 https://github.com/advisories/GHSA-cgr9-h9qq-x9fx

Reviews 4

History 615

  1. Gerrit Code Review pushed patch set 1 for main to change 82863 status New Under Review 02/08/24, 11:10

  2. Gerrit Code Review pushed patch set 2 for main to change 82863 02/08/24, 11:18

  3. Gerrit Code Review pushed patch set 3 for main to change 82863 02/08/24, 11:19

  4. Gerrit Code Review pushed patch set 4 for main to change 82863 02/08/24, 11:47

  5. Thomas Hohn changed description 02/08/24, 11:49

  6. Thomas Hohn changed description 02/08/24, 12:09

  7. Gerrit Code Review pushed patch set 5 for main to change 82863 02/08/24, 13:31

  8. Benjamin Franzke changed subject Remove reference to removed packages Replace former extension packages using self.version description 02/08/24, 13:32

  9. Stefan Bürk commented 02/09/24, 09:00

    Investigation for provided change / notes

    Using `self.version` for the replaces is not usable for us. The answer from `Ocramius ` in the linked issue is a generic answer, and valid for a monorepo metapackage + splitt package style, for example what symfony provides. The TYPO3 has not such a approach.

    This change would render the `replaces` use-less from the original attempt. The attempt is, to silently replaces outdated/removed split packages with another image so an update simply works even if the old package is contained in the project/extension composer.json directly.

    For example, having a (simplified)

    {
       "require": {
          "typo3/cms-core": "^10.4",
          "typo3/cms-about": "^10.4"
       }
    }

    and a upgrade will be done using:

    composer require "typo3/cms-core":"^13"

    the death stare would remove the dedicated package due to the replace. With `self.version` it will complain with following errors:

    Loading composer repositories with package information
    Updating dependencies
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - typo3/cms-about v10.4.0 requires typo3/cms-core 10.4.0 -> satisfiable by typo3/cms-core[v10.4.0] from composer repo (https://repo.packagist.org) but typo3/cms-core[13.1.x-dev] from path repo (../../typo3/sysext/*) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.
        - typo3/cms-about v10.4.1 requires typo3/cms-core 10.4.1 -> satisfiable by typo3/cms-core[v10.4.1] from composer repo (https://repo.packagist.org) but typo3/cms-core[13.1.x-dev] from path repo (../../typo3/sysext/*) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.
    .... +xxx similar errors

    Even if following is used:

    composer require "typo3/cms-core":"^13" "typo3/cms-about":"^13"

    the current state would silently replace it where as the new thing would badly fail with a long list of errors. Sadly, most developers out there never really learned composer correctly and is not firm would really be confused and comming into cms channel asking for support. Just documenting it would not really help as they would not search for such things.

    The pinpoint here is, that there will not be a package version for the removed version in packagist meta-data matching the same version like the other packages.

    failing one and drastically making the `User eXperience` a multidude worser.

    Note: this can be simply tested with following steps (with and without this change:

    cd Build/composer/ && \
      rm -rf public vendor composer.json composer.lock && \
      cp composer.dist.json composer.json && \
      composer require --no-update --no-install \
        "typo3/cms-about":"^10.4" && \
      composer install && echo '>> success - yeah !' || echo '>> failed - bad'

    Further handling

    This requires first a deep discussion into which user experience we want to
    end finally – and take than the appropiated actions.

  10. Gerrit Code Review pushed patch set 6 for main to change 82863 02/09/24, 11:09

  11. Gerrit Code Review pushed patch set 1 for 13.0 to change 82841 02/09/24, 11:16

  12. Gerrit Code Review pushed patch set 1 for 11.5 to change 82873 02/09/24, 11:17

  13. Gerrit Code Review pushed patch set 1 for 12.4 to change 82874 02/09/24, 11:19

  14. Anonymous commented and changed status Under Review Resolved done 0 % 100 % 02/09/24, 11:30

    Applied in changeset commit:3e497b76786984636c1a2a82d39c982fb35cd675.

  15. Benni Mack changed status Resolved Closed 07/09/24, 15:33