-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add signing of cache values. #60
base: main
Are you sure you want to change the base?
Conversation
setup.cfg
Outdated
@@ -29,6 +29,8 @@ packages = find: | |||
package_dir = = src | |||
include_package_data = true | |||
python_requires = >= 3.6 | |||
install_requires = | |||
itsdangerous ~= 2.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this also rejects 2.1 even though that's not expected to contain breaking changes. I'd use ~= 2.0
to allow anything <3
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right: https://www.python.org/dev/peps/pep-0440/#compatible-release, fixed with 4f3dc7d
self.default_timeout = default_timeout | ||
if secret_key is not None: | ||
self.__signed_serializer = itsdangerous.Serializer( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why double-underscore names? That makes subclassing less convenient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subclass are only supposed to access _dump/load(s)
, but sure, I can remove a single underscore.
This PR adds the ability to sign the stored cache values. Most classes now accept the extra argument
secret_key
for signing cache values with this key. itsdangerous is used for signing.The "SimpleCache" and "MemcachedCache" classes do not accept the new
secret_key
kwarg - the simple does not have any use, and various memcached client libraries already use pickle internally for serialization.Checklist:
CHANGES.rst
summarizing the change and linking to the issue... versionchanged::
entries in any relevant code docs.pre-commit
hooks and fix any issues.pytest
andtox
, no tests failed. --> let's see what CI/CD say. I unfortunately did not have redis, uwsgi and memcached installed...