-
-
Notifications
You must be signed in to change notification settings - Fork 311
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
Replace pickle with JSON #564
Conversation
Co-authored-by: Ivan Klass <klass.ivanklass@gmail.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #564 +/- ##
==========================================
- Coverage 89.92% 86.09% -3.84%
==========================================
Files 31 21 -10
Lines 1032 719 -313
Branches 104 124 +20
==========================================
- Hits 928 619 -309
+ Misses 69 66 -3
+ Partials 35 34 -1 ☔ View full report in Codecov by Sentry. |
@Mogost I love it. Please fix the coverage warnings to merge it. |
Done. All new lines are covered. |
@Mogost how should one go about upgrading to constance V4 without downtime? Doesn't the migration breaking running old versions immediately? |
@phb-teleclinic i think its not possible to migrate v2 -> v3 / v3 -> v4 without downtime. |
@Mogost @camilonova, would you approve a contribution to the 3.x branch to make a release that can both read JSON and Pickle values? |
json/pickle change is in v4. v3 contains table change. Both changes are backward incompatible. |
In collaboration with @ivan-klass, this pull request addresses a critical issue in the
django-constance
where values were saved using Python'spickle
serialization. Moreover redis and database backends do this quite differently. That approach posed significant security risks and made the stored data incompatible with other programming languages.Changes Introduced
Implemented a custom JSON serializer and deserializer for
django-constance
.The new serializer encodes objects in the format:
This change enhances security by eliminating the use of
pickle
and ensuring the data remains human-readable and backend-agnostic.It also enables interoperability with other programming languages since the JSON format is widely supported.
Benefits
pickle
mitigates the associated security vulnerabilities.Risks
pickle
may not be compatible with the new JSON-based serialization. Our changes contain migration strategy, but not all cases might be covered. As a result, this change should bump a major version part.Fix #101