You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
plugins/db.py parses the session transcript buffer from Redis with eval() #13663
get_upsert_segment_to_transcript_plugin in plugins/db.py reads the per-session transcript buffer from Redis and parses it with eval():
segments=r.get(key) # plugin:{plugin_id}:session:{session_id}:transcript_segments
...
segments=eval(segments) # executes arbitrary Python, not just parsing
eval executes whatever the key contains — so any value that is not the plain str(list-of-dicts) this function writes (a manual redis-cli fixup, another writer on the shared Redis instance, a corrupted value) runs as code inside the plugin process, which holds the OpenAI key and Redis credentials. A merely malformed value also crashes the /mentor webhook until the TTL lapses.
Fix: parse with ast.literal_eval (identical format — TranscriptSegment fields are all str/int/float/bool/None, so str() output is always a valid literal), decode the bytes redis-py returns, and treat a non-list literal as an empty buffer. Regression test included: a stored call-expression raises instead of executing.
Submitted as a bounty proposal per the contribution guide; PR incoming.
Activity
fix(plugins): parse the Redis transcript buffer with ast.literal_eval…
fix(plugins): replace unsafe eval with ast.literal_eval in db.py (#13663