Skip to content

Replace abandoned packages #47

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

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

cooperaj
Copy link

@cooperaj cooperaj commented Mar 6, 2025

Due the web-token libraries reorganisation there are abandoned packages. The upstream facile-it/php-jose-verifier library has a 0.5-beta version that works with the new web-token but needs changes.

These are included. Lots of changes from @p4veI 's branch and some addition work by me.

I've been unable to get the conformance tests to work with a timeout error and there potentially are a large number of other changes that need making.

Copy link

codecov bot commented Mar 6, 2025

Codecov Report

Attention: Patch coverage is 77.19298% with 13 lines in your changes missing coverage. Please review.

Project coverage is 64.26%. Comparing base (a9bff56) to head (e4983bc).

Files with missing lines Patch % Lines
src/Service/AuthorizationService.php 0.00% 5 Missing ⚠️
...rc/Service/Builder/AuthorizationServiceBuilder.php 0.00% 3 Missing ⚠️
src/Service/Builder/AbstractServiceBuilder.php 0.00% 2 Missing ⚠️
src/Issuer/IssuerBuilder.php 0.00% 1 Missing ⚠️
src/Service/Builder/UserInfoServiceBuilder.php 0.00% 1 Missing ⚠️
src/Service/UserInfoService.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #47      +/-   ##
============================================
+ Coverage     61.75%   64.26%   +2.51%     
+ Complexity      466      461       -5     
============================================
  Files            62       62              
  Lines          1561     1556       -5     
============================================
+ Hits            964     1000      +36     
+ Misses          597      556      -41     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thomasvargiu
Copy link
Member

Hi @cooperaj, thanks!
It's a good start, I'm going to think about it in these days. Probably we'll can merge it and start from your work.

@cooperaj
Copy link
Author

cooperaj commented Mar 6, 2025

There are a large number of failing static analysis points in files that have not been touched so I can only assume the upstream library has changed some interfaces etc.

@cooperaj
Copy link
Author

cooperaj commented Mar 7, 2025

Looks like it should all be passing now but the failing 7.4 test matrix (removed in this PR) stops the rest from completing.

@Jean85
Copy link
Member

Jean85 commented Mar 10, 2025

@cooperaj you can fix that by changing the CI under the include key: there's a specific job for the --prefer-lowest case, were 7.4 is specified; you should bump it to 8.1, since now it's the new minimum requirement.

@cooperaj
Copy link
Author

cooperaj commented Mar 10, 2025

Can't believe I missed that. Thanks.

EDIT.
Though for some reason there aren't any checks running at all now.

@Jean85
Copy link
Member

Jean85 commented Mar 11, 2025

Closing and reopening to trigger actions, it got disabled.

@Jean85 Jean85 closed this Mar 11, 2025
@Jean85 Jean85 reopened this Mar 11, 2025
Until PHP-CS-Fixer/PHP-CS-Fixer#8300 is fixed it won't have full 8.4 support but if language features are kept at 8.1 levels (as they should be to ensure supported versions) then having this flag shouldn't cause issue.
Copy link
Member

@Jean85 Jean85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a changelog entry. In that regard, is it correct to say that this PR does not bring any breaking change to the end user, apart from indirect dependencies change?

"ext-json": "*",
"facile-it/php-jose-verifier": "^0.3 || ^0.4.3",
"facile-it/php-jose-verifier": "^0.5.0-beta1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: if everything is ok, we should re-tag as stable and change the requirement here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite possibly. Though I've not used any of that library in anger apart from what this library touches so I can't vouch for it all.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the 0.5 tag available on that repo yet? I've an issue open there but it is still open?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, I'm thinking that we can use the beta version, and tag this PR in beta too

@cooperaj
Copy link
Author

We need a changelog entry. In that regard, is it correct to say that this PR does not bring any breaking change to the end user, apart from indirect dependencies change?

Apart from the dropping of 7.4 support I'd say that's the case. I don't believe any of the public interfaces were changed but our uses of the library don't touch all the functionality so I'm depending on the unit tests to flag others up.

I've been unable to get the conformance suite running. I think the upstream APIs tondo it have changed since the tests were written (~2020)

Copy link
Member

@thomasvargiu thomasvargiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late additional review.

First of all, thank you! Good job!

We are almost ready to release a beta! Just few changes and clarifications requested.

@@ -15,7 +15,7 @@ public function unpack(ClientInterface $client, array $claims): array
$claimSources = $claims['_claim_sources'] ?? null;
$claimNames = $claims['_claim_names'] ?? null;

if (! is_array($claimSources)) {
if (! array_key_exists('_claim_sources', $claims) || ! is_array($claimSources)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this check? If _claim_sources does not exist it will be null as for the check 3 lines before

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think (it been a minute) that these extra checks were introduced to stop psalm from grumbling.

I'll verify.

@@ -47,7 +47,7 @@ public function fetch(OpenIDClient $client, array $claims, array $accessTokens =
$claimSources = $claims['_claim_sources'] ?? null;
$claimNames = $claims['_claim_names'] ?? null;

if (! is_array($claimSources)) {
if (! array_key_exists('_claim_sources', $claims) || ! is_array($claimSources)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this new check? If _claim_sources does not exist it will be null as for the check 3 lines before

/** @var MetadataProviderBuilder|null */
private $metadataProviderBuilder;
/** @psalm-suppress PropertyNotSetInConstructor */
private ?MetadataProviderBuilder $metadataProviderBuilder;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you set the nullable type you should set it to null without suppressing the error.

/** @var JwksProviderBuilder|null */
private $jwksProviderBuilder;
/** @psalm-suppress PropertyNotSetInConstructor */
private ?JwksProviderBuilder $jwksProviderBuilder;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you set the nullable type you should set it to null without suppressing the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants