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

catch other pickle errors when loading content #3325

Merged
merged 2 commits into from
Aug 10, 2018

Conversation

mmerickel
Copy link
Member

Hypothetical: you have more pyramid projects than dummy secrets and the browser starts sending back signed-pickled session cookies from project A to the server for project B. In this case it passes all signature checks but fails to unpickle with a non-ValueError exception.

mmerickel added a commit to mmerickel/pyramid that referenced this pull request Aug 8, 2018
@mmerickel mmerickel added this to the 1.10 milestone Aug 8, 2018
return pickle.loads(bstruct)
# at least ValueError, AttributeError, ImportError but more to be safe
except Exception:
raise ValueError
Copy link
Member

Choose a reason for hiding this comment

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

It seems odd that we have no direct unit tests for PickleSerializer.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, you can rest easy because we have some for the SimpleSerializer that does nothing. :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Anyway the short answer is that the PickleSerializer was pulled out of existing session code and so I just assumed pyramid was exercising those paths well enough. Turns out it was missing a few things. Certainly it'd be easier to write tests for such things directly to the PickleSerializer if it got pulled out but I'm also not upset with more integration tests for sessions either.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was going to let this slide but we are looking at changing the default serializer so I pushed some specific PickleSerializer tests so they don't get lost in translation later.

@mmerickel mmerickel force-pushed the fix-unpickle-crash branch from eadf7a2 to 9d68512 Compare August 8, 2018 23:40
@mmerickel mmerickel merged commit 5488da0 into Pylons:master Aug 10, 2018
@mmerickel mmerickel deleted the fix-unpickle-crash branch November 29, 2020 03:11
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.

2 participants