Skip to content
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

Encode/decode using JSON instead of Django signed objects #76

Open
yamin-oanda opened this issue Jun 21, 2023 · 0 comments
Open

Encode/decode using JSON instead of Django signed objects #76

yamin-oanda opened this issue Jun 21, 2023 · 0 comments

Comments

@yamin-oanda
Copy link

When saving the session data:

data = self.encode(self._get_session(no_load=must_create))

And loading the session data:

return self.decode(force_unicode(session_data))

It would be better to use json.dumps() and json.loads() rather than self.encode()/self.decode(). The reason is that the latter pair of inherited methods (encode / decode) are both using Django cryptographic signing/signature verification. This is not really needed when we are saving the session data in Redis because the Redis cache is not going to be accessible to the public. So there is no possibility of bad data entering the cache (leaving aside the Django application deliberately setting bad data).

It would simplify the storage/load if the json serialization functions were used instead. And it would also eliminate the need for using any cryptography.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant