Fix pickle RCE vulnerability in Pro app API#111
Fix pickle RCE vulnerability in Pro app API#111patrickkidd-hurin wants to merge 1 commit intomasterfrom
Conversation
Replace all pickle.loads(request.data) calls with a RestrictedUnpickler that only allows safe builtin types (dict, list, str, int, etc.), blocking arbitrary code execution via crafted pickle payloads. - Add btcopilot/pro/safe_pickle.py with two restricted unpicklers: - safe_loads(): for untrusted client request data (builtins only) - safe_loads_diagram(): for database blobs (builtins + PyQt5.QtCore) - Update routes.py: all 20 pickle.loads(request.data) → safe_loads() - Update diagram.py: pickle.loads(self.data) → safe_loads_diagram() - Add 27 tests covering allowed types and blocked RCE payloads Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 28272816 | Triggered | Generic Password | 3c357f4 | btcopilot/tests/pro/test_safe_pickle.py | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the security of the Pro app API by mitigating a Remote Code Execution (RCE) vulnerability. It replaces all direct uses of Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
\ud83d\udce9 Follow-up queued \u2014 resuming agent session to address 1 comment(s). |
Summary
pickle.loads(request.data)calls inpro/routes.pyaccept arbitrary pickle payloads from clients, enabling remote code execution (RCE) on the serverRestrictedUnpicklerinbtcopilot/pro/safe_pickle.pythat allowlists only safe types (builtins, datetime, collections) for request data, and additionally allows PyQt5.QtCore types for diagram database blobsChanges
btcopilot/pro/safe_pickle.pysafe_loads()andsafe_loads_diagram()btcopilot/pro/routes.pypickle.loads(request.data)→safe_loads(request.data)btcopilot/pro/models/diagram.pypickle.loads(self.data)→safe_loads_diagram(self.data)(defense-in-depth)btcopilot/tests/pro/test_safe_pickle.pyTest plan
🤖 Generated with Claude Code