Update cookie.rb to support allow old HMAC generation #55
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.
Hello,
I'm working on upgrading an old codebase that relies on the legacy session cookie format (with the
--$HMACsuffix).I noticed that after https://github.com/rack/rack/pull/1177/files (PR is not merged in
rack/rack, but the code was merged manually in this repository based on this comment), the verification of old session cookies in this format is still supported when legacy options are set but new session cookies are no longer created with the--$HMACsuffix, even iflegacy_generate_hmacandlegacy_hmac_secretare provided.The code comments suggest that backward compatibility should be maintained:
However, the code that previously appended the HMAC to new cookies appears to have been removed:
I couldn't find any other place where the
--$HMACsuffix is added for new cookies.Would you consider restoring this behavior when
legacy_hmac_secretis set?I'm happy to update / add tests if this is acceptable, but I wanted to get an opinion first as I'm not familiar with this codebase and could be wrong here :)
Thanks a lot !