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 @@ -17,7 +17,8 @@ def load_data():
def restore_session():
session_data = request.form.get('session')

session = pickle.loads(session_data.encode())
import json as _json
session = _json.loads(session_data)

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 alias

Low Severity

The json module is imported inside the function body and aliased as _json, even though there is no naming conflict with json in this file. The underscore-prefixed alias is unconventional and misleading (suggesting a private symbol). The import belongs at the top of the file alongside the other standard library imports (pickle, yaml, marshal).

Fix in Cursor Fix in Web


return f"Session restored: {session}"

Expand Down
Loading