-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Restrict pickle deserialization in CookieJar.load() #12091
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
Merged
Dreamsorcerer
merged 15 commits into
aio-libs:master
from
YuvalElbar6:security/cookiejar-restrict-pickle
Feb 20, 2026
Merged
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
59bb357
Security: restrict pickle deserialization in CookieJar.load()
YuvalElbar6 2c899ef
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 81d06a0
Fix partitioned cookie handling in load_json()
YuvalElbar6 146dd89
Fix mypy errors and partitioned cookie test
YuvalElbar6 c05f594
Add new technical terms to docs spelling wordlist
YuvalElbar6 c447986
Add 'untrusted' to docs spelling wordlist
YuvalElbar6 4928513
Add towncrier changelog fragment for CookieJar security fix
YuvalElbar6 86177df
Fix spelling in changelog fragment: deserialized -> loaded
YuvalElbar6 cfa864d
Merge save_json/load_json into save/load per review
YuvalElbar6 a7dd300
Update aiohttp/cookiejar.py
YuvalElbar6 6a23343
Address review: remove defensive defaults, str(), fix return pattern
YuvalElbar6 34b7c90
Store boolean cookie attrs as native JSON booleans
YuvalElbar6 6b691ee
Update cookiejar.py
Dreamsorcerer 08fa653
Merge remote-tracking branch 'origin/master' into security/cookiejar-…
YuvalElbar6 953e228
Merge branch 'security/cookiejar-restrict-pickle' of https://github.c…
YuvalElbar6 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Switched :py:meth:`~aiohttp.CookieJar.save` to use JSON format and | ||
| :py:meth:`~aiohttp.CookieJar.load` to try JSON first with a fallback to | ||
| a restricted pickle unpickler that only allows cookie-related types | ||
| (``SimpleCookie``, ``Morsel``, ``defaultdict``, etc.), preventing | ||
| arbitrary code execution via malicious pickle payloads | ||
| (CWE-502) -- by :user:`YuvalElbar6`. |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.