Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion vulnerable_deserialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def import_data():
import_file = request.files['file']
content = import_file.read()

data = pickle.loads(content)
import json as _json
data = _json.loads(content)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary inline import with unconventional private alias

Low Severity

The json module is imported inside the function body with an unnecessary underscore-prefixed alias (_json). There is no naming conflict with json in this scope, making the alias pointless and misleading (the underscore prefix conventionally denotes a private/internal name). The import also belongs at the module level alongside pickle, yaml, and marshal rather than being repeated on every call to import_data.

Fix in Cursor Fix in Web


return f"Imported: {data}"

Expand Down
Loading