Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No PHP 8.3 compatible version of lcobucci/clock installable #6983

Closed
leofeyer opened this issue Mar 8, 2024 · 18 comments · Fixed by #7031
Closed

No PHP 8.3 compatible version of lcobucci/clock installable #6983

leofeyer opened this issue Mar 8, 2024 · 18 comments · Fixed by #7031
Labels
Milestone

Comments

@leofeyer
Copy link
Member

leofeyer commented Mar 8, 2024

Affected version(s)

5.3

Description

When I upgraded from PHP 8.2 to 8.3, I noticed that Composer downgraded lcobucci/clock from version 2.3.0 to 2.2.0. I analyzed why, and this is the situation:

Before version 2.3.0, the package had a php: ^8.0 requirement. But in version 2.3.0, presumably when PHP 8.3 was released, the requirement was narrowed to "php": "~8.1.0 || ~8.2.0" (see lcobucci/clock#680). And "~8.3.0" was only added in version 3.2.0, so a new major version.

We don‘t directly use lcobucci/clock, but it is a dependency of lcobucci/jwt which we use in version "^4.0". However, the new major version of lcobucci/clock is only allowed in version 5 of lcobucci/jwt, so again a new major version.

To fix this, we would have to allow "lcobucci/jwt": "^4.0 || ^5.0" in our composer.json. Our code seems to be compatible with both versions. However, there is a conflict ">=4.2.0" in our contao/conflicts package which prevents the installation of version 5.0. 🙈

I don't remember why we added the conflict, but I assume it has to do with a BC break in version 4.2.0. Maybe something with key lengths? @fritzmg Do you recall?

So if someone uses Contao with PHP 8.3, they get an outdated and apparently incompatible version of lcobucci/clock and there is nothing they can do about it. Therefore we should upgrade lcobucci/jwt to version 5 as soon as possible.

@leofeyer leofeyer added the bug label Mar 8, 2024
@leofeyer leofeyer added this to the 5.3 milestone Mar 8, 2024
@fritzmg
Copy link
Contributor

fritzmg commented Mar 8, 2024

The conflict was added by @bytehead in contao/conflicts#43 because of #5693

I am not entirely sure if we still need that. It's only an issue, if your kernel secret is not long enough - is that correct?

@ausi
Copy link
Member

ausi commented Mar 8, 2024

If I interpret #5693 (comment) correctly, it seems that we can remove that conflict and afterwards update to "lcobucci/jwt": "^4.0 || ^5.0"

@leofeyer
Copy link
Member Author

leofeyer commented Mar 8, 2024

I think so. The conflict was added for non-managed installations that still use ThisTokenIsNotSoSecretChangeIt as kernel secret. These should be few and they are broken anyway due to the too short default secret.

@aschempp
Copy link
Member

aschempp commented Mar 8, 2024

What about websites with existing secrets that are too short?

@leofeyer
Copy link
Member Author

leofeyer commented Mar 8, 2024

Contao has auto-generated secrets since version 4.13 and these secrets are long enough. So the majority of installations should not be affected. Some older installations with too short secrets might break.

But at the moment the dependencies are broken for all users and we have to fix this. We cannot leave it broken for everyone just to avoid breaking a few.

@fritzmg
Copy link
Contributor

fritzmg commented Mar 8, 2024

We could add the conflict to the contao/manager-bundle in 4.13.39 before removing it from contao/conflicts, if we want to avoid breaking a few instances at least in 4.13. Not sure if that's worth it though.

@aschempp
Copy link
Member

aschempp commented Mar 8, 2024

I don't think that's a minority of installations, because most are likely updated from even 4.9 or older, and these will have a too-short secret as well. Should we maybe consider something like an automatic migration? Update the APP_SECRET and store the old one somewhere (for encryption issues)?

@fritzmg
Copy link
Contributor

fritzmg commented Mar 8, 2024

and these will have a too-short secret as well

Not necessarily. Before our APP_SECRET generation the Contao Install Tool was responsible for the automatic generation of the secret parameter since Contao 4.3.5 - and the Contao Install Tool always created secrets of a sufficient length:

$this->parameters['parameters']['secret'] = bin2hex(random_bytes(32));

Your secret will only be too short if you yourself manually set one with less than 32 characters in the past, regardless of the Contao version (at least since 4.3.5).

So in all likelyhood most Contao instances should have a secret of sufficient length.

@leofeyer leofeyer linked a pull request Mar 20, 2024 that will close this issue
leofeyer added a commit that referenced this issue Mar 20, 2024
Description
-----------

Fixes #6983

Commits
-------

875cf9e Allow version 5 of lcobucci/jwt
@de-es
Copy link
Contributor

de-es commented Mar 21, 2024

Mit dem Update von lcobucci/jwt auf v5 wird neu ext-sodium als PHP Extension vorausgesetzt. Nicht, dass man das nicht lösen könnte, aber es kam beim Update auf 5.3.2 gerade etwas überraschend.

@fritzmg
Copy link
Contributor

fritzmg commented Mar 21, 2024

@de-es not sure what you mean, because the requirement still allows v4.

@fritzmg
Copy link
Contributor

fritzmg commented Mar 21, 2024

@de-es besides, v4.1+ already required ext-sodium - so whatever issues you might have, it is not related to this.

@de-es
Copy link
Contributor

de-es commented Mar 21, 2024

@fritzmg Contao 5.3.0/1 (Neuinstallation - PHP 8.3) wurde bei mir mit lcobucci/jwt = 4.0.4 installiert. Composer wollte jetzt nicht auf 5.3.2 updaten, weil ext-sodium nicht installiert war. Nach der Installation der Extension habe ich nun automatisch 5.2.0 von lcobucci/jwt.

@fritzmg
Copy link
Contributor

fritzmg commented Mar 21, 2024

Composer wollte jetzt nicht auf 5.3.2 updaten, weil ext-sodium nicht installiert war.

You should seek help in the Contao community about this issue.

@de-es
Copy link
Contributor

de-es commented Mar 21, 2024

Ich weiß, wie ich das Problem für mich lösen kann. 😀 Wollte das nur als Hinweis hier lassen, falls in den nächsten Tagen andere über das selbe Problem stolpern.

Gerade testweise nochmal ext-sodium deaktiviert und Contao versucht, zu installieren:

> composer create-project contao/managed-edition contao-test53 5.3                                                                                                                                                                                                                                      ✔ 
Creating a "contao/managed-edition" project at "./contao-test53"
Installing contao/managed-edition (5.3)
  - Downloading contao/managed-edition (5.3)
  - Installing contao/managed-edition (5.3): Extracting archive
Created project in /srv/contao/contao-test53
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - contao/newsletter-bundle 5.3.2 requires contao/core-bundle 5.3.2 -> satisfiable by contao/core-bundle[5.3.2].
    - contao/newsletter-bundle 5.3.1 requires contao/core-bundle 5.3.1 -> satisfiable by contao/core-bundle[5.3.1].
    - contao/newsletter-bundle 5.3.0 requires contao/core-bundle 5.3.0 -> satisfiable by contao/core-bundle[5.3.0].
    - contao/core-bundle[5.3.0, ..., 5.3.2] require scheb/2fa-trusted-device ^6.0 -> satisfiable by scheb/2fa-trusted-device[v6.0.0, ..., v6.12.0].
    - scheb/2fa-trusted-device[v6.10.0, ..., v6.12.0] require lcobucci/jwt ^4.1 || ^5.0 -> satisfiable by lcobucci/jwt[4.1.0, ..., 4.3.0, 5.0.0, 5.1.0, 5.2.0].
    - scheb/2fa-trusted-device[v6.0.0, ..., v6.3.0] require php ~8.0.0 || ~8.1.0 -> your php version (8.3.3) does not satisfy that requirement.
    - scheb/2fa-trusted-device[v6.4.0, ..., v6.9.0] require php ~8.0.0 || ~8.1.0 || ~8.2.0 -> your php version (8.3.3) does not satisfy that requirement.
    - lcobucci/jwt[4.1.0, ..., 4.3.0, 5.1.0, ..., 5.2.0] require ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension.
    - lcobucci/jwt 5.0.0 requires php ~8.1.0 || ~8.2.0 -> your php version (8.3.3) does not satisfy that requirement.
    - Root composer.json requires contao/newsletter-bundle ^5.3 -> satisfiable by contao/newsletter-bundle[5.3.0, 5.3.1, 5.3.2].

To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-sodium` to temporarily ignore these required extensions.

Sollten wir dann nicht ggf. die Systemvoraussetzungen aktualisieren?

@fritzmg
Copy link
Contributor

fritzmg commented Mar 21, 2024

@de-es this only applies for PHP 8.3 (due to lcobucci/jwt's requirements). Anyway, it looks like ext-sodium is only a soft dependency for lcobucci/jwt and should probably fixed there.

@ausi
Copy link
Member

ausi commented Mar 21, 2024

Anyway, it looks like ext-sodium is only a soft dependency for lcobucci/jwt and should probably fixed there.

See lcobucci/jwt#1051

@ausi
Copy link
Member

ausi commented Mar 21, 2024

Sollten wir dann nicht ggf. die Systemvoraussetzungen aktualisieren?

As lcobucci/jwt#1051 was not merged, I think we should, yes.

@fritzmg
Copy link
Contributor

fritzmg commented Mar 22, 2024

See contao/docs#1363

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants