avoid marshal.loads in XML_unpickle reachable via ticket allowlist - #2654
Merged
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2654 +/- ##
==========================================
- Coverage 50.99% 50.82% -0.17%
==========================================
Files 42 42
Lines 15532 15531 -1
Branches 3416 3416
==========================================
- Hits 7920 7894 -26
- Misses 6561 6580 +19
- Partials 1051 1057 +6 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gluon.restricted.TicketStorage loads error-ticket data through the SafeUnpickler allow-list, which whitelists gluon.html.XML_unpickle so pickled XML snapshots in a ticket survive the round trip. XML_unpickle runs marshal.loads on the pickled bytes, so a crafted ticket in an app errors/ folder or the web2py_ticket table is still handed to an unsafe deserializer (marshal.loads is documented as not secure against maliciously constructed data) when the admin ticket viewer opens it, which is exactly what the restricted unpickler was meant to prevent. XML only wraps text, so pickle the string directly and drop the marshal indirection; valid tickets round-trip unchanged.