-
Notifications
You must be signed in to change notification settings - Fork 0
[Security] Fix CodeQL alert #34: Deserialization of user-controlled data #86
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import pickle | ||
| import json | ||
| import yaml | ||
| import marshal | ||
| from flask import Flask, request | ||
|
|
@@ -9,7 +9,7 @@ | |
| def load_data(): | ||
| data = request.data | ||
|
|
||
| obj = pickle.loads(data) | ||
| obj = json.loads(data) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed pickle import but kept pickle usageHigh Severity The |
||
|
|
||
| return str(obj) | ||
|
|
||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Removed
import picklebutpickleis still used in multiple places, causing NameError at runtimeThe PR replaces
import picklewithimport jsonbut only migrates one of the sixpickle.loads()call sites tojson.loads(). The remaining five usages at lines 20, 29, 40, 50, and 53 will raiseNameError: name 'pickle' is not definedat runtime. This breaks the/sessionendpoint,/importendpoint,deserialize_object(), and bothDataProcessormethods.Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.