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

Added json as an option for cookie serialization #56

Merged
merged 2 commits into from
Nov 20, 2015
Merged

Added json as an option for cookie serialization #56

merged 2 commits into from
Nov 20, 2015

Conversation

alexei
Copy link
Contributor

@alexei alexei commented Jan 14, 2014

Addresses issue #36 (which in turn addressed issue #35)

@alexei
Copy link
Contributor Author

alexei commented Jan 14, 2014

Btw, should it actually default to json?

return pickle.dumps(data, 2)

def deserialize(data_string, method):
try:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this try block, try to unpickle first, then if that fails use json... defeats the whole purpose of this patch, it's still going to run pickle...

why not just check 'if method == "json"' first, rather than attempting to unpickle first.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my first intention, indeed, but then I realized you're losing existing, pickled, data.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, but at the expense of security, which I personally think is more important.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What expense of security?

Projects that are based on beaker and are currently live, probably use pickle. If you decide to switch from pickle to json (and vice versa), that try block will make sure you don't lose that data. When it reads the data, it tries both formats. When it writes back, it uses the selected format. That means existing pickled data will be json serialized. So, basically, it's for compatibility.

If you think that data might be compromised, then you should probably delete it yourself. My concern, as a developer, is not [to work around] your [compromised] data, but the behavior of the library.

@amol- amol- merged commit e72ef1e into bbangert:master Nov 20, 2015
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

Successfully merging this pull request may close these issues.

3 participants