-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Session duration > 30 days not supported #2485
Comments
One easy fix could be to disable Line 242 in 2287ac5
Alternatively, instead of hardcoding |
romanlytvyn
added a commit
to romanlytvyn/hydra
that referenced
this issue
Apr 22, 2021
CookieStore MaxAge is set to 86400 * 30 by default. This prevents secure cookies retrieval with expiration > 30 days. MaxAge: 0 disables MaxAge check by SecureCookie, thus allowing sessions lasting > 30 days.
5 tasks
mitar
pushed a commit
to mitar/hydra
that referenced
this issue
May 13, 2021
CookieStore MaxAge is set to 86400 * 30 by default. This prevents secure cookies retrieval with expiration > 30 days. MaxAge: 0 disables MaxAge check by SecureCookie, thus allowing sessions lasting > 30 days. Closes ory#2485 Co-authored-by: hackerman <3372410+aeneasr@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Session duration >30 days (86400 * 30) is not behaving properly.
oauth2_authentication_session
cookie is rejected after 30 days regardless of specified expiration time.The session cookie expiration can be set at 10 years from now, but hydra rejects it after 30 days.
Reproducing the bug
Steps to reproduce the behavior:
/oauth2/auth
endpoint.remember_for: 7776000
(3600 * 24 * 90) // 90 daysCookie examination reveals that expiration time is properly set at 90 days in the future.
oauth2_authentication_session
cookie is still present and not expired in broswer - looks good.prompt=none
.Prompt 'none' was requested, but no existing login session was found.
Expected behavior
Login flow performed without any errors since session cookie is still not expired.
Environment
Additional context
A bit of a code digging reveals that cookie is not returned by
CookieStore
after 30 days:hydra/consent/strategy_default.go
Line 112 in 2287ac5
A
CookieStore
is initalized byNewCookieStore
:hydra/driver/registry_base.go
Lines 240 to 246 in 2287ac5
Which sets default
MaxAge
to exactly 30 days:https://github.com/gorilla/sessions/blob/61fa50d034f99479a7de0d1c02c5e9dea5ad30cb/store.go#L50-L61
Which later on is used inside
SecureCookie
Decode
method onGet
and returnserrTimestampExpired
error if cookie is older thanMaxAge
:https://github.com/gorilla/securecookie/blob/f37875ef1fb538320ab97fc6c9927d94c280ed5b/securecookie.go#L339
Even though
CookieStore
exposes possibility to overrideMaxAge
via method:https://github.com/gorilla/sessions/blob/61fa50d034f99479a7de0d1c02c5e9dea5ad30cb/store.go#L116
Hydra does not override it, therefore leaving the default
MaxAge: 86400 * 30
, essentially rendering anyremember_for
greater than 30 days completely useless.The text was updated successfully, but these errors were encountered: