cdbattags / lua-resty-jwt

JWT For The Great Openresty
Apache License 2.0
146 stars 44 forks source link

crashes if payload is nil #36

Open ghost opened 4 years ago

ghost commented 4 years ago

If the auth token is corrupt and the payload ends up being nil, the code crashes.

Line 766 of jwt.lua

local val = claim == str_const.full_obj and cjson_decode(jwt_json) or jwt_obj.payload[claim]

Should be

local val = claim == str_const.full_obj and cjson_decode(jwt_json) or (jwt_obj.payload and jwt_obj.payload[claim])

cdbattags commented 4 years ago

Feel free to open a PR!

cdbattags commented 4 years ago

Hi @FredHall! Would you be willing to add a PR? If not I could get to this in a couple weeks

ghost commented 4 years ago

I could... if I knew what you needed for a pull request? Modified file? Patch file?

Sorry, I have never submitted a pull request on github.

cdbattags commented 3 years ago

Hey @FredHall, poking you here. You able to work through how to submit a pull request?