fix: auth bypass#5
Closed
shreemaan-abhishek wants to merge 1 commit into
Closed
Conversation
This was referenced Jul 10, 2023
Closed
Sn0rt
approved these changes
Jul 12, 2023
| local iv = _M:jwt_decode(encoded_iv) | ||
| local signature_or_tag = _M:jwt_decode(encoded_auth_tag) | ||
| local basic_jwe = { | ||
| typ = str_const.JWE, |
There was a problem hiding this comment.
Why do you add this, seems meanless
Comment on lines
+835
to
+838
| if alg == nil then | ||
| jwt_obj[str_const.reason] = "No algorithm supplied" | ||
| return jwt_obj | ||
| end |
There was a problem hiding this comment.
we should not check like this, there is already corresponding judgement logic below
else
jwt_obj[str_const.reason] = "Unsupported algorithm " .. alg
end
We just fix the bug when alg == nil
else
jwt_obj[str_const.reason] = "Unsupported algorithm " .. (alg or "nil")
end
Comment on lines
+554
to
556
| if jwt_obj.typ == str_const.JWE or (jwt_obj.typ == nil and (typ == str_const.JWE or jwt_obj.header.enc)) then | ||
| return sign_jwe(self, secret_key, jwt_obj) | ||
| end |
There was a problem hiding this comment.
The way to check if the obj is jwe is not correct. The jwe obj has five dot in the body, i think checking this is more appropriate
There was a problem hiding this comment.
And the function sign_jwe is not correct too, you should refactor the function
| end | ||
|
|
||
| local basic_jwt = { | ||
| typ = str_const.JWT, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes the authentication bypass issue in cdbattags/lua-resty-jwt#61.