Closed iain closed 1 month ago
Does the JSON data get encoded as the raw value of the header? If so, the only solution would be to base64 (or url encode) it, e.g. emoji -> JSON -> url encoded header. IF that's not what we are already doing, I'd accept a PR for that.
Forcing the encoding of serialized_data
in Rack::Session::Encryptor::Serializable#serialize_payload
to BINARY
fixes it; something we should do, as we want to send it as-is. I'll prepare a PR over the weekend, adding tests to cover this scenario. Thanks for the report @iain!
Hi, I was trying to use the JSON serializer and ran into trouble when trying to put an emoji into the session (in real life, this is more likely to happen with flash messages).
Here is the code to reproduce it:
The output is as follows:
It looks like the problem arises from the padding in the encryptor. The padding amount and random bytes are not compatible with the json output, and I don't see an easy way around it either.
Of course the default Marshal encoding works, but I was hoping to move away from that.