-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
Possible session management issues #374
Comments
Thanks, @bungle . Have you seen https://github.com/zmartzone/lua-resty-openidc#sessions-and-locking ? we are deliberately not closing the session as users may want to use it after we have returned from |
@bodewig, thanks for the info. Makes sense. |
I'll make sure we close the session in the Is there any reason why you wouldn't call |
I've also grep-ed for the places where lua-resty-openidc/lib/resty/openidc.lua Line 282 in 49be803
|
Great findings!
I don't think there is any reason why |
It has been reported to
lua-resty-session
:bungle/lua-resty-session#116
That sessions stay locked after the requests. I did some analysis and found these:
bungle/lua-resty-session#116 (comment)
bungle/lua-resty-session#116 (comment)
The main issue is in two public apis:
The first issue:
https://github.com/zmartzone/lua-resty-openidc/blob/master/lib/resty/openidc.lua#L1393
There you start the session and start holding the possible lock. If any code path after that does return/error the lock will still be held. You must ensure that lock is always released (with
save
,close
,regenerate
ordestroy
) whenstart
is called. There are a lot of places where the lock is not released, but the code returns. The OpenResty does not have a hook where the session library could hook itself to do it always, so it is library users' responsibility. If it is meant for users to close sessions withopenidc.authenticate
then it is the calling code that needs to do this always. But I think here your library is the user and it islua-resty-openidc
's responsibility to "close" after start.The second issue is easy to fix, replace:
https://github.com/zmartzone/lua-resty-openidc/blob/master/lib/resty/openidc.lua#L1518
with:
The text was updated successfully, but these errors were encountered: