Update max age of securecookie codecs when setting cookie store options - #309
Open
awhitefox wants to merge 1 commit into
Open
Update max age of securecookie codecs when setting cookie store options#309awhitefox wants to merge 1 commit into
awhitefox wants to merge 1 commit into
Conversation
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 a bug where setting cookie store options using
.Options(...)does not update theMaxAgeof its codecs. This leads to gorilla's securecookie cryptography not respecting the store'sMaxAgeand using the default value of86400 * 30. Because of this, securecookie would accept expired cookies if store'sMaxAgeis lower than the default value or reject fresh cookies if it's higher.Here is how CookieStore setup is done in gorilla/sessions (source):
A
cs.MaxAge(cs.Options.MaxAge)call is made to setMaxAgefor codecs (source):This PR adds the same call to gin's cookie store
.Options(...)receiver: