-
Notifications
You must be signed in to change notification settings - Fork 457
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
Firebase JWT implementation need update after the upgrade from 5.* to 6.* #9110
Comments
Hi @touhidurabir! Thanks, this is my fault, but I haven't started working on it yet. Feel free to self-assign if you'd like to tackle it. |
The changes required to fix it already incorporated with the PR for pkp/pkp-lib#9073 , waiting for the tests to pass . But as pkp/pkp-lib#9073 target a broader changes(Laravel upgrade form 9.x to 10.x) and if that need more discussion and debate before it can get merged , I can make a separate PR for this. @asmecher what do you think ? |
@touhidurabir, this looks good, but it does cause a backwards compatibility break -- anyone using 3.4.0-x or older will have a JWT payload that's a string, which has always been out of spec but was previously accepted by the library and is not any longer. This means that your commits (132b912 and 513c31d) will work for newly created API keys, but will not successfully decode API keys that were generated before the update to JWT-PHP 6.x. While we could make a breaking change that invalidates all existing API keys, that feels pretty drastic. I'd like to look for options that generate "compliant" new keys, but don't break existing keys. Here are a few, off the top of my head...
What do you think? |
@asmecher this is how tested
am I missing something ? I will double check it . Also API keys have been saved as string in both branch Update@asmecher I see the issue now . The reason it's working for my test steps that I mentioned above is because api keys are basically
@asmecher I think this would be least destructive solution even though we will be forced to maintain our own implementation that override the BTW one question , the invalidation of API key comes in factor when we consider user is using the encoded version of API key elsewhere and after this, the will be forced to copy the new encoded version from profile and update at those places . what are such cases where user has the preset ? |
That's an option too, but what I was referring to is simply writing up a
@touhidurabir, I'm not sure this is answering your question, but we have a use case with Coalition Publica where we create a user account with a "subscription manager" role. We generate an API key for that user, and then copy/paste that into the Coalition Publica toolset, where it's used to fetch information from the OJS installation that it wouldn't otherwise be able to access. If existing API keys are invalidated, then it would be necessary to re-generate new keys to replace all of these. |
@asmecher I have added a |
A patch might be less susceptible to falling out of sync with the parent implementation -- if a patch no longer applies cleanly, we'll get an immediate error. But this approach is OK with me too and does solve the problem nicely. Please add some notes to the code header in the child implementation describing why we're overriding the function; I would also support the addition of a call to |
@asmecher Added the class doc and a deprecation warning to error log . If all the tests passes, it should be good to merge . |
Thanks, @touhidurabir! I'll take care of the submodule updates for the other apps. |
Describe the bug
After the upgrade of the package
firebase/php-jwt
from5.*
to6.*
, the usage/implementation ofJWT::encode
andJWT::decode
need to update to match with latest code specification from package itself .To Reproduce
Try to create/update a user
API Key
fromTop right user menu --> Edit Profile
and see it's failing forAPI Key
tab .Also try to make any api required using the api key (such as
http://OJS_BASE_PATH/index.php/JOURNAL_PATH/api/v1/users/USER_ID?apiToken=USER_API_KEY
) and see that it's returning the error500
.What application are you using?
OJS, OMP or OPS
main
branchAdditional information
This cause travis build tests to fail for
main
branch and also rendering api keys are unusable . Also this need to be updated in any plugins such as JatsTemplate that have the previous implementations .The solution is as follow
for
JWT::encode
, the first params need to be anarray
for
JWT::decode
, something similar as belowPRs
pkp-lib --> #9114
ojs --> pkp/ojs#3953
The text was updated successfully, but these errors were encountered: