Add Rails 7.1 cookie metadata compatibility#24
Open
jivko-chobanov wants to merge 1 commit into
Open
Conversation
Owner
|
@jivko-chobanov thanks for this. Can you also update the test suite, please? |
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.
Fixes #23.
This updates
plug_rails_cookie_session_storeto handle the Rails 7.1 cookie message format while remaining compatible with older Rails behavior.What changed:
purposesupportmetadata_formatsupport (:legacyand:serializer)Notes:
protect_from_forgery store:implementation that reads/writes a dedicated key like:_csrf_token_rails, while Phoenix keeps using its default Plug-managed CSRF key.Context:
Rails 7.1.5.1 cookies could be read by Phoenix via
plug_rails_cookie_session_store, but when Phoenix wrote them back, Rails no longer recognized the payload correctly because the library did not handle Rails' metadata wrapping expectations.I tested this change in a real Phoenix/Rails integration setup by pointing Phoenix to this forked branch and validating the shared session behavior.