security: replace pickle with json for cookie storage#4
Merged
mugenkyou merged 1 commit intomugenkyou:mainfrom Mar 16, 2026
Merged
security: replace pickle with json for cookie storage#4mugenkyou merged 1 commit intomugenkyou:mainfrom
mugenkyou merged 1 commit intomugenkyou:mainfrom
Conversation
- Replace pickle.load/dump with json.load/dump in app.py and scripts - Change cookie file extension from .pkl to .json - Eliminates arbitrary code execution (RCE) risk from pickle deserialization - Addresses OWASP insecure deserialization vulnerability
📥 Pull Request ReceivedThank you for your contribution to Linkify. Your pull request has been received and is currently under review. 🔗 Linked Issues
✅ Pre-Merge ChecklistPlease ensure the following requirements are met:
👤 Reviewer Assigned@mugenkyou has been assigned to review this pull request. Our team will review your submission shortly. We appreciate your effort in improving Linkify. |
🎉 Pull Request Merged SuccessfullyContributor: @asmiverma Your pull request has been successfully merged into the main codebase. Thank you for your valuable contribution to Linkify. 🚀 Next StepsWe encourage you to:
We value your commitment to improving Linkify and look forward to your continued involvement. |
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.
Pull Request Summary
Security: Replace unsafe
pickle-based cookie serialization with JSON to eliminate a potential remote code execution (RCE) vulnerability.This update addresses an insecure deserialization issue found in app.py (lines 122 and 334) where cookie data was loaded using
pickle.load(). Sincepicklecan execute arbitrary code during deserialization, it poses a security risk if the file is tampered with.This PR replaces pickle-based storage with JSON, a safe serialization format that cannot execute code.
Fixes #1
Changes Introduced
pickle.load()/pickle.dump()withjson.load()/json.dump()inapp.pyand related scripts.pklto.jsonrb,wb) to text mode (r,w)Security Impact
Using Python's
picklemodule for loading stored cookies can allow arbitrary code execution if the serialized file is modified or replaced by a malicious actor.Switching to JSON removes this risk because JSON only stores data and cannot execute code during deserialization.
This change mitigates the OWASP insecure deserialization vulnerability.
Screenshots / Demo
N/A — backend security improvement with no UI changes.
Checklist
Additional Notes
driver.get_cookies()returns dictionaries, which are fully compatible with JSON serialization..pklcookie files will need to be removed so the application can generate new.jsoncookie files on the next login.